@@ -17,61 +17,77 @@ PROJECT_DIR="$(
17
17
# shellcheck source=ci/images/ci-runner/hack/bin/utils.sh
18
18
source " $PROJECT_DIR /ci/images/ci-runner/hack/bin/utils.sh"
19
19
20
- export GITHUB_USER GITHUB_TOKEN QUAY_TOKEN QUAY_OAUTH_USER QUAY_OAUTH_TOKEN QUAY_OAUTH_TOKEN_RELEASE_SOURCE QUAY_OAUTH_TOKEN_RELEASE_DESTINATION \
21
- GITHUB_ACCOUNTS_ARRAY PREVIOUS_RATE_REMAINING GITHUB_USERNAME_ARRAY GH_RATE_REMAINING
22
-
23
- printf " Fetch secrets from bitwarden server\n" | indent 2
24
- open_bitwarden_session
25
- get_github_user
26
- get_github_token
27
- get_quay_token
28
- get_quay_oauth_user
29
- get_quay_oauth_token
30
- get_quay_oauth_token_release_source
31
- get_quay_oauth_token_release_destination
32
- get_github_accounts
33
-
34
-
35
- PREVIOUS_RATE_REMAINING=0
36
-
37
- # user stored: username:token,username:token
38
- for account in " ${GITHUB_ACCOUNTS_ARRAY[@]} "
39
- do :
40
- IFS=' :' read -r -a GITHUB_USERNAME_ARRAY <<< " $account"
41
-
42
- GH_RATE_REMAINING=$( curl -s \
43
- -H " Accept: application/vnd.github+json" \
44
- -H " Authorization: Bearer ${GITHUB_USERNAME_ARRAY[1]} " \
45
- https://api.github.com/rate_limit | jq " .rate.remaining" )
46
-
47
- echo -e " [INFO ] user: ${GITHUB_USERNAME_ARRAY[0]} with rate limit remaining $GH_RATE_REMAINING "
48
- if [[ " ${GH_RATE_REMAINING} " -ge " ${PREVIOUS_RATE_REMAINING} " ]]; then
49
- GITHUB_USER=" ${GITHUB_USERNAME_ARRAY[0]} "
50
- GITHUB_TOKEN=" ${GITHUB_USERNAME_ARRAY[1]} "
51
- fi
52
- PREVIOUS_RATE_REMAINING=" ${GH_RATE_REMAINING} "
53
- done
54
-
55
- echo -e " [INFO] Start tests with user: ${GITHUB_USER} "
56
-
57
- # #git config
58
- git config --global user.name " redhat-appstudio-qe-bot"
59
- git config --global user.email
[email protected]
60
-
61
- mkdir -p " ${HOME} /creds"
62
- GIT_CREDS_PATH=" ${HOME} /creds/file"
63
- git config --global credential.helper " store --file ${GIT_CREDS_PATH} "
64
- echo " https://${GITHUB_USER} :${GITHUB_TOKEN} @github.com" > " ${GIT_CREDS_PATH} "
65
-
66
-
67
- cd " $( mktemp -d) "
68
-
69
- git clone --branch main " https://${GITHUB_TOKEN} @github.com/redhat-appstudio/e2e-tests.git" .
70
- # # Deploy StoneSoup
71
- make local/cluster/prepare
72
-
73
- # # Launch partial StoneSoup e2e tests
74
- go mod tidy
75
- go mod vendor
76
- make build
77
- ./bin/e2e-appstudio --ginkgo.label-filter " pipeline" --ginkgo.vv
20
+ export_variables () {
21
+ printf " Export variables\n" | indent 2
22
+ # The following variables are exported by the Stonesoup CI:
23
+ # DEFAULT_QUAY_ORG DEFAULT_QUAY_ORG_TOKEN GITHUB_USER GITHUB_TOKEN QUAY_TOKEN QUAY_OAUTH_USER QUAY_OAUTH_TOKEN QUAY_OAUTH_TOKEN_RELEASE_SOURCE QUAY_OAUTH_TOKEN_RELEASE_DESTINATION
24
+ # GITHUB_ACCOUNTS_ARRAY PREVIOUS_RATE_REMAINING GITHUB_USERNAME_ARRAY GH_RATE_REMAINING
25
+
26
+ export DEFAULT_QUAY_ORG=redhat-appstudio-qe
27
+ printf " Fetch secrets from bitwarden server\n" | indent 2
28
+
29
+ open_bitwarden_session
30
+ get_default_quay_org_token
31
+ get_github_user
32
+ get_github_token
33
+ get_quay_token
34
+ get_quay_oauth_user
35
+ get_quay_oauth_token
36
+ get_quay_oauth_token_release_source
37
+ get_quay_oauth_token_release_destination
38
+ get_github_accounts
39
+ }
40
+
41
+ handle_ratelimit () {
42
+ PREVIOUS_RATE_REMAINING=0
43
+
44
+ # user stored: username:token,username:token
45
+ for account in " ${GITHUB_ACCOUNTS_ARRAY[@]} "
46
+ do :
47
+ IFS=' :' read -r -a GITHUB_USERNAME_ARRAY <<< " $account"
48
+
49
+ GH_RATE_REMAINING=$( curl -s \
50
+ -H " Accept: application/vnd.github+json" \
51
+ -H " Authorization: Bearer ${GITHUB_USERNAME_ARRAY[1]} " \
52
+ https://api.github.com/rate_limit | jq " .rate.remaining" )
53
+
54
+ echo -e " [INFO ] user: ${GITHUB_USERNAME_ARRAY[0]} with rate limit remaining $GH_RATE_REMAINING "
55
+ if [[ " ${GH_RATE_REMAINING} " -ge " ${PREVIOUS_RATE_REMAINING} " ]]; then
56
+ GITHUB_USER=" ${GITHUB_USERNAME_ARRAY[0]} "
57
+ GITHUB_TOKEN=" ${GITHUB_USERNAME_ARRAY[1]} "
58
+ fi
59
+ PREVIOUS_RATE_REMAINING=" ${GH_RATE_REMAINING} "
60
+ done
61
+
62
+ echo -e " [INFO] Start tests with user: ${GITHUB_USER} "
63
+ }
64
+
65
+ run_test () {
66
+ # #git config
67
+ git config --global user.name " redhat-appstudio-qe-bot"
68
+ git config --global user.email
[email protected]
69
+
70
+ mkdir -p " ${HOME} /creds"
71
+ GIT_CREDS_PATH=" ${HOME} /creds/file"
72
+ git config --global credential.helper " store --file ${GIT_CREDS_PATH} "
73
+ echo " https://${GITHUB_USER} :${GITHUB_TOKEN} @github.com" > " ${GIT_CREDS_PATH} "
74
+
75
+
76
+ cd " $( mktemp -d) "
77
+
78
+ git clone --branch main " https://${GITHUB_TOKEN} @github.com/redhat-appstudio/e2e-tests.git" .
79
+ # # Deploy StoneSoup
80
+ make local/cluster/prepare
81
+
82
+ # Launch partial StoneSoup e2e tests
83
+ go mod tidy
84
+ go mod vendor
85
+ make build
86
+ ./bin/e2e-appstudio --ginkgo.label-filter " pipeline" --ginkgo.vv
87
+ }
88
+
89
+
90
+
91
+ export_variables
92
+ handle_ratelimit
93
+ run_test
0 commit comments