Skip to content

Commit 4f22d05

Browse files
authored
Merge pull request #106 from infosiftr/save-deploy
Speed up deploy optimistically
2 parents 5ea6680 + bedef05 commit 4f22d05

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'),
@@ -88,7 +106,7 @@ node('put-shared') { ansiColor('xterm') {
88106
./.go-env.sh go build -trimpath -o bin/deploy ./cmd/deploy
89107
fi
90108
)
91-
.scripts/bin/deploy < deploy.json
109+
.scripts/bin/deploy < filtered-deploy.json
92110
'''
93111
}
94112
}

0 commit comments

Comments
 (0)