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
@@ -18,6 +23,22 @@ steps:
18
23
- checkout : self
19
24
fetchDepth : 2
20
25
26
+ # Set the SKIP_JOB environment variable if this job is supposed to only run
27
+ # when submodules are updated and they were not. The following time consuming
28
+ # tasks will be skipped when the environment variable is present.
29
+ - ${{ if parameters.only_on_updated_submodules }} :
30
+ - bash : |
31
+ set -e
32
+ # Submodules pseudo-files inside git have the 160000 permissions, so when
33
+ # those files are present in the diff a submodule was updated.
34
+ if git diff HEAD^ | grep "^index .* 160000" >/dev/null 2>&1; then
35
+ echo "Executing the job since submodules are updated"
36
+ else
37
+ echo "Not executing this job since no submodules were updated"
38
+ echo "##vso[task.setvariable variable=SKIP_JOB;]1"
39
+ fi
40
+ displayName: Decide whether to run this job
41
+
21
42
# Spawn a background process to collect CPU usage statistics which we'll upload
22
43
# at the end of the build. See the comments in the script here for more
23
44
# information.
@@ -68,20 +89,20 @@ steps:
68
89
echo '{"ipv6":true,"fixed-cidr-v6":"fd9a:8454:6789:13f7::/64"}' | sudo tee /etc/docker/daemon.json
69
90
sudo service docker restart
70
91
displayName : Enable IPv6
71
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
92
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
72
93
73
94
# Check out all our submodules, but more quickly than using git by using one of
74
95
# our custom scripts
75
96
- bash : |
76
97
set -e
77
98
mkdir -p $HOME/rustsrc
78
99
$BUILD_SOURCESDIRECTORY/src/ci/init_repo.sh . $HOME/rustsrc
79
- condition : and(succeeded(), ne(variables['Agent.OS'], 'Windows_NT'))
100
+ condition : and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Windows_NT'))
80
101
displayName : Check out submodules (Unix)
81
102
- script : |
82
103
if not exist D:\cache\rustsrc\NUL mkdir D:\cache\rustsrc
83
104
sh src/ci/init_repo.sh . /d/cache/rustsrc
84
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'))
105
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Windows_NT'))
85
106
displayName : Check out submodules (Windows)
86
107
87
108
# Ensure the `aws` CLI is installed so we can deploy later on, cache docker
@@ -93,10 +114,10 @@ steps:
93
114
retry pip3 install awscli --upgrade --user
94
115
echo "##vso[task.prependpath]$HOME/.local/bin"
95
116
displayName : Install awscli (Linux)
96
- condition : and(succeeded(), eq(variables['Agent.OS'], 'Linux'))
117
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['Agent.OS'], 'Linux'))
97
118
- script : pip install awscli
98
119
displayName : Install awscli (non-Linux)
99
- condition : and(succeeded(), ne(variables['Agent.OS'], 'Linux'))
120
+ condition : and(succeeded(), not(variables.SKIP_JOB), ne(variables['Agent.OS'], 'Linux'))
100
121
101
122
# Configure our CI_JOB_NAME variable which log analyzers can use for the main
102
123
# step to see what's going on.
@@ -112,7 +133,7 @@ steps:
112
133
python2.7 "$BUILD_SOURCESDIRECTORY/src/tools/publish_toolstate.py" "$(git rev-parse HEAD)" "$(git log --format=%s -n1 HEAD)" "" ""
113
134
cd ..
114
135
rm -rf rust-toolstate
115
- condition : and(succeeded(), eq(variables['IMAGE'], 'mingw-check'))
136
+ condition : and(succeeded(), not(variables.SKIP_JOB), eq(variables['IMAGE'], 'mingw-check'))
116
137
displayName : Verify the publish_toolstate script works
117
138
118
139
- bash : |
@@ -133,6 +154,7 @@ steps:
133
154
SRC : .
134
155
AWS_SECRET_ACCESS_KEY : $(AWS_SECRET_ACCESS_KEY)
135
156
TOOLSTATE_REPO_ACCESS_TOKEN : $(TOOLSTATE_REPO_ACCESS_TOKEN)
157
+ condition : and(succeeded(), not(variables.SKIP_JOB))
136
158
displayName : Run build
137
159
138
160
# If we're a deploy builder, use the `aws` command to publish everything to our
@@ -155,7 +177,7 @@ steps:
155
177
retry aws s3 cp --no-progress --recursive --acl public-read ./$upload_dir s3://$DEPLOY_BUCKET/$deploy_dir/$BUILD_SOURCEVERSION
156
178
env :
157
179
AWS_SECRET_ACCESS_KEY : $(AWS_SECRET_ACCESS_KEY)
158
- condition : and(succeeded(), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
180
+ condition : and(succeeded(), not(variables.SKIP_JOB), or(eq(variables.DEPLOY, '1'), eq(variables.DEPLOY_ALT, '1')))
159
181
displayName : Upload artifacts
160
182
161
183
# Upload CPU usage statistics that we've been gathering this whole time. Always
0 commit comments