-
Notifications
You must be signed in to change notification settings - Fork 41
/
pr_check.sh
executable file
·61 lines (50 loc) · 2.23 KB
/
pr_check.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
#!/bin/bash
# --------------------------------------------
# Export vars for helper scripts to use
# --------------------------------------------
# name of app-sre "application" folder this component lives in; needs to match for quay
export COMPONENT="rbac"
# Needs to match the quay repo name set by app.yaml in app-interface
export IMAGE="quay.io/cloudservices/rbac-frontend"
export WORKSPACE=${WORKSPACE:-$APP_ROOT} # if running in jenkins, use the build's workspace
export APP_ROOT=$(pwd)
COMMON_BUILDER=https://raw.githubusercontent.com/RedHatInsights/insights-frontend-builder-common/master
# --------------------------------------------
# Options that must be configured by app owner
# --------------------------------------------
IQE_PLUGINS="rbac"
IQE_MARKER_EXPRESSION="smoke"
IQE_FILTER_EXPRESSION=""
set -exv
CHROME_SHA=$(curl -X GET "https://quay.io/api/v1/repository/cloudservices/insights-chrome-frontend/tag/?onlyActiveTags=true&limit=100" | jq '.tags | [.[] | select(.name | test("^[a-zA-Z0-9]{7,40}$"))] | .[0].name' -r)
CHROME_CONTAINER_NAME=chrome-$CHROME_SHA
docker run -d --name $CHROME_CONTAINER_NAME --replace --network bridge quay.io/cloudservices/insights-chrome-frontend:$CHROME_SHA
mkdir -p dist
docker cp $CHROME_CONTAINER_NAME:/opt/app-root/src/build/stable/index.html dist/
CHROME_HOST=$(docker inspect -f '{{range.NetworkSettings.Networks}}{{.IPAddress}}{{end}}' $CHROME_CONTAINER_NAME)
docker run -t \
-v $PWD:/e2e:ro,Z \
-w /e2e \
-e CHROME_ACCOUNT=$CHROME_ACCOUNT \
-e CHROME_PASSWORD=$CHROME_PASSWORD \
-e RBAC_FRONTEND_USER=$RBAC_FRONTEND_USER \
-e RBAC_FRONTEND_PASSWORD=$RBAC_FRONTEND_PASSWORD \
-e CHROME_HOST=$CHROME_HOST \
--add-host stage.foo.redhat.com:127.0.0.1 \
--add-host prod.foo.redhat.com:127.0.0.1 \
--entrypoint bash \
--network bridge \
quay.io/cloudservices/cypress-e2e-image:b8480a8 /e2e/run-e2e.sh
echo "After docker run"
# source is preferred to | bash -s in this case to avoid a subshell
source <(curl -sSL $COMMON_BUILDER/src/frontend-build.sh)
BUILD_RESULTS=$?
# Stubbed out for now
mkdir -p $WORKSPACE/artifacts
cat << EOF > $WORKSPACE/artifacts/junit-dummy.xml
<testsuite tests="1">
<testcase classname="dummy" name="dummytest"/>
</testsuite>
EOF
# teardown_docker
exit $BUILD_RESULTS