Skip to content

Commit bedef05

Browse files
committed
Speed up deploy optimistically
Trust that if an item was pushed successfully in a previous deploy, then we don't need to push it this time
1 parent e25ff36 commit bedef05

File tree

1 file changed

+20
-2
lines changed

1 file changed

+20
-2
lines changed

Jenkinsfile.deploy

Lines changed: 20 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,27 @@ node('put-shared') { ansiColor('xterm') {
7070
include "deploy";
7171
arch_tagged_manifests(env.BASHBREW_ARCH)
7272
| deploy_objects[]
73-
' builds.json | tee deploy.json
73+
' builds.json > deploy.json
7474
'''
7575
}
76+
stage('Filter') {
77+
// using the previous successful deploy.json, filter the current deploy.json with items already pushed last time
78+
sh'''
79+
wget --timeout=5 -qO past-deploy.json "$JOB_URL/lastSuccessfulBuild/artifact/deploy.json"
80+
# swap to this touch instead of the wget above to (re)bootstrap
81+
#touch past-deploy.json
82+
jq --slurpfile past ./past-deploy.json 'select( IN($past[]) | not )' ./deploy.json > filtered-deploy.json
83+
'''
84+
}
85+
stage('Archive') {
86+
archiveArtifacts(
87+
artifacts: [
88+
'deploy.json',
89+
'filtered-deploy.json',
90+
].join(','),
91+
fingerprint: true,
92+
)
93+
}
7694

7795
withCredentials([
7896
string(credentialsId: 'dockerhub-public-proxy', variable: 'DOCKERHUB_PUBLIC_PROXY'),
@@ -89,7 +107,7 @@ node('put-shared') { ansiColor('xterm') {
89107
./.go-env.sh go build -trimpath -o bin/deploy ./cmd/deploy
90108
fi
91109
)
92-
.scripts/bin/deploy < deploy.json
110+
.scripts/bin/deploy < filtered-deploy.json
93111
'''
94112
}
95113
}

0 commit comments

Comments
 (0)