@@ -23,6 +23,7 @@ NC='\033[0m' # No Color
2323# Default configuration
2424PIPELINE=" ci"
2525DRY_RUN=true
26+ TORCH_NIGHTLY=false
2627
2728usage () {
2829 cat << EOF
@@ -34,12 +35,14 @@ Sets RUN_ALL=1 and NIGHTLY=1 environment variables.
3435SAFETY: Dry-run by default. Use --execute to actually trigger a build.
3536
3637Options:
37- --execute Actually trigger the build (default: dry-run)
38- --pipeline Buildkite pipeline slug (default: ${PIPELINE} )
39- --commit Override commit SHA (default: current HEAD)
40- --branch Override branch name (default: current branch)
41- --message Custom build message (default: auto-generated)
42- --help Show this help message
38+ --execute Actually trigger the build (default: dry-run)
39+ --pipeline Buildkite pipeline slug (default: ${PIPELINE} )
40+ --commit Override commit SHA (default: current HEAD)
41+ --branch Override branch name (default: current branch)
42+ --message Custom build message (default: auto-generated)
43+ --torch-nightly Also build and run the full suite against torch nightly
44+ (sets TORCH_NIGHTLY=1)
45+ --help Show this help message
4346
4447Prerequisites:
4548 - bk CLI installed: brew tap buildkite/buildkite && brew install buildkite/buildkite/bk
@@ -49,6 +52,7 @@ Examples:
4952 $( basename " $0 " ) # Dry-run, show what would happen
5053 $( basename " $0 " ) --execute # Actually trigger the build
5154 $( basename " $0 " ) --pipeline ci-shadow # Dry-run with different pipeline
55+ $( basename " $0 " ) --torch-nightly # Dry-run a full torch-nightly run
5256EOF
5357 exit 1
5458}
@@ -96,6 +100,10 @@ while [[ $# -gt 0 ]]; do
96100 MESSAGE=" $2 "
97101 shift 2
98102 ;;
103+ --torch-nightly)
104+ TORCH_NIGHTLY=true
105+ shift
106+ ;;
99107 --help|-h)
100108 usage
101109 ;;
@@ -171,11 +179,17 @@ if [[ $(echo "$REMOTE_BRANCHES" | wc -l) -gt 5 ]]; then
171179fi
172180echo " "
173181
182+ # Environment variables passed to the build.
183+ BUILD_ENV=(" RUN_ALL=1" " NIGHTLY=1" )
184+ if [[ " $TORCH_NIGHTLY " == true ]]; then
185+ BUILD_ENV+=(" TORCH_NIGHTLY=1" )
186+ fi
187+
174188log_info " Pipeline: ${PIPELINE} "
175189log_info " Branch: ${BRANCH} "
176190log_info " Commit: ${COMMIT} "
177191log_info " Message: ${MESSAGE} "
178- log_info " Environment: RUN_ALL=1, NIGHTLY=1 "
192+ log_info " Environment: ${BUILD_ENV[*]} "
179193echo " "
180194
181195# Build the command
@@ -187,9 +201,10 @@ CMD=(bk build create
187201 --commit " ${COMMIT} "
188202 --branch " ${BRANCH} "
189203 --message " ${MESSAGE} "
190- --env " RUN_ALL=1"
191- --env " NIGHTLY=1"
192204)
205+ for env_var in " ${BUILD_ENV[@]} " ; do
206+ CMD+=(--env " ${env_var} " )
207+ done
193208
194209if [[ " $DRY_RUN " == true ]]; then
195210 echo " =========================================="
@@ -210,8 +225,14 @@ if [[ "$DRY_RUN" == true ]]; then
210225 echo " --commit '$( escape_for_shell " ${COMMIT} " ) ' \\ "
211226 echo " --branch '$( escape_for_shell " ${BRANCH} " ) ' \\ "
212227 echo " --message '$( escape_for_shell " ${MESSAGE} " ) ' \\ "
213- echo " --env 'RUN_ALL=1' \\ "
214- echo " --env 'NIGHTLY=1'"
228+ last_idx=$(( ${# BUILD_ENV[@]} - 1 ))
229+ for i in " ${! BUILD_ENV[@]} " ; do
230+ if [[ $i -eq $last_idx ]]; then
231+ echo " --env '$( escape_for_shell " ${BUILD_ENV[$i]} " ) '"
232+ else
233+ echo " --env '$( escape_for_shell " ${BUILD_ENV[$i]} " ) ' \\ "
234+ fi
235+ done
215236 echo " "
216237 echo " =========================================="
217238 echo -e " ${YELLOW} To actually trigger this build, run:${NC} "
0 commit comments