6
6
#
7
7
# Check travis config for `gdb --batch` command to print all crash logs
8
8
9
+ parameters :
10
+ # When this parameter is set to anything other than an empty string the tests
11
+ # will only be executed when the commit updates submodules
12
+ only_on_updated_submodules : ' '
13
+
9
14
steps :
10
15
11
16
# Disable automatic line ending conversion, which is enabled by default on
@@ -21,6 +26,22 @@ steps:
21
26
- checkout : self
22
27
fetchDepth : 2
23
28
29
+ # Set the SKIP_JOB environment variable if this job is supposed to only run
30
+ # when submodules are updated and they were not. The following time consuming
31
+ # tasks will be skipped when the environment variable is present.
32
+ - ${{ if parameters.only_on_updated_submodules }} :
33
+ - bash : |
34
+ set -e
35
+ # Submodules pseudo-files inside git have the 160000 permissions, so when
36
+ # those files are present in the diff a submodule was updated.
37
+ if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
38
+ echo "Executing the job since submodules are updated"
39
+ else
40
+ echo "Not executing this job since no submodules were updated"
41
+ echo "##vso[task.setvariable variable=SKIP_JOB;]1"
42
+ fi
43
+ displayName: Decide whether to run this job
44
+
24
45
# Spawn a background process to collect CPU usage statistics which we'll upload
25
46
# at the end of the build. See the comments in the script here for more
26
47
# information.
71
92
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
72
93
sudo service docker restart
73
94
displayName : Enable IPv6
74
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
95
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
75
96
76
97
# Disable automatic line ending conversion (again). On Windows, when we're
77
98
# installing dependencies, something switches the git configuration directory or
@@ -87,12 +108,12 @@ steps:
87
108
set -e
88
109
mkdir -p $HOME/rustsrc
89
110
$BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
90
- condition : and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
111
+ condition : and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
91
112
displayName : Check out submodules (Unix)
92
113
- script : |
93
114
if not exist D:\cache\rustsrc\NUL mkdir D:\cache\rustsrc
94
115
sh src/ci/init_repo.sh . /d/cache/rustsrc
95
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
116
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
96
117
displayName : Check out submodules (Windows)
97
118
98
119
# See also the disable for autocrlf above, this just checks that it worked
@@ -124,10 +145,10 @@ steps:
124
145
retry pip3 install awscli --upgrade --user
125
146
echo "##vso[task.prependpath]$HOME/.local/bin"
126
147
displayName : Install awscli (Linux)
127
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
148
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
128
149
- script : pip install awscli
129
150
displayName : Install awscli (non-Linux)
130
- condition : and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
151
+ condition : and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Linux'))
131
152
132
153
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
133
154
# step to see what's going on.
@@ -145,7 +166,7 @@ steps:
145
166
python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
146
167
cd ..
147
168
rm -rf rust-toolstate
148
- condition : and(succeeded(), eq(variables['IMAGE'], 'mingw-check'))
169
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
149
170
displayName : Verify the publish_toolstate script works
150
171
151
172
- bash : |
@@ -166,6 +187,7 @@ steps:
166
187
SRC : .
167
188
AWS_SECRET_ACCESS_KEY : $(AWS_SECRET_ACCESS_KEY)
168
189
TOOLSTATE_REPO_ACCESS_TOKEN : $(TOOLSTATE_REPO_ACCESS_TOKEN)
190
+ condition : and(succeeded(), not(variables.SKIP_JOB))
169
191
displayName : Run build
170
192
171
193
# If we're a deploy builder, use the `aws` command to publish everything to our
@@ -188,7 +210,7 @@ steps:
188
210
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
189
211
env :
190
212
AWS_SECRET_ACCESS_KEY : $(AWS_SECRET_ACCESS_KEY)
191
- condition : and(succeeded(), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
213
+ condition : and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
192
214
displayName : Upload artifacts
193
215
194
216
# Upload CPU usage statistics that we've been gathering this whole time. Always
0 commit comments