-
Notifications
You must be signed in to change notification settings - Fork 24.8k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ci: move bazel saucelabs execution to script to be used across all Angular repos #32141
Conversation
4b325bf
to
b5df73e
Compare
b5df73e
to
797d8f8
Compare
797d8f8
to
1f46ef7
Compare
@@ -0,0 +1,189 @@ | |||
#!/usr/bin/env bash | |||
|
|||
set -u -o pipefail |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No -e
? 😱
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't have -e
on this script because we explicitly want to make sure we continue on errors so that we make sure we close the tunnel everytime.
For instance, if the bazel test fails, we don't want its erring exit code to cause the entire script to exit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems dangerous. If you're wanting to close the tunnel if the bazel test fails you can set +e
set -e
around the bazel eval and check its exit code manually so that the script continues and closes the tunnel. You still want the script to exit with the exit code of the bazel test in that case so CI reports the test failure.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That works too, updated.
function touch-safe { | ||
for f in "$@"; do | ||
[ -d $f:h ] || mkdir -p $f:h && command touch $f | ||
done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Inconsistent indentation 😱
# acquire CircleCI instances for too long if sauceconnect failed, we need a connect timeout. | ||
readonly SAUCE_READY_FILE_TIMEOUT=120 | ||
|
||
# Create saucelabs log file it doesn't already exist. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Missing "if".
badCommandSyntax=1; | ||
elif [[ ! $USER_COMMAND =~ ^(yarn bazel) ]]; then | ||
echo "The command provided must be a bazel command run via yarn, beginning with \"yarn bazel\""; | ||
badCommandSyntax=1 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No semicolon? 🤔
1f46ef7
to
993acf9
Compare
( | ||
cd $GIT_ROOT_DIR && \ | ||
# Run bazel command with saucelabs specific environment variables passed to the action | ||
eval "$USER_COMMAND --define=KARMA_WEB_TEST_MODE=SL_REQUIRED \ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you're looking to drop this script into other repos, note that the --define=KARMA_WEB_TEST_MODE=SL_REQUIRED
is specific to the angular repo and it corresponds to the browsers defined by /browser-providers.conf.js
and consumed by /karma-js.conf.js
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Commented, noting this fact
# The root directory of the git project the script is running in. | ||
readonly GIT_ROOT_DIR=$(git rev-parse --show-toplevel 2> /dev/null) | ||
# Location for the saucelabs log file. | ||
readonly SAUCE_LOG_FILE=/tmp/angular/sauce-connect.log |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
could use mktemp
(https://www.gnu.org/software/autogen/mktemp.html) instead to make this generic and not angular specific
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think we should be fine to leave it as angular
for now since our main use case is on CI and its only being used for angular repos as of now. If we were to set this up as fully available to anyone we would need to address it though.
424eb3c
to
46842ed
Compare
46842ed
to
04d9b30
Compare
…gular repos (angular#32141) PR Close angular#32141
…gular repos (angular#32141) PR Close angular#32141
This issue has been automatically locked due to inactivity. Read more about our automatic conversation locking policy. This action has been performed automatically by a bot. |
No description provided.