Skip to content

Commit 5f72a6e

Browse files
committed
Update auto-release pattern
Previously, if the patch version of the CLI was bumped due to the `check-for-updated-binary-version` task returning successfully, then the `check-for-patched-cves` task afterward would fail because it would try to look up the new version as a git tag. If that didn't cause a failure and it also returned successfully, the version could have been bumped twice. Now, the golang-release task scripts create a release-notes/needs-release file when the condition for the script is met. This allows us to chain the scripts together, build up release notes from each script, then bump a single time if any of the scripts were successful.
1 parent f1ffcd2 commit 5f72a6e

File tree

1 file changed

+29
-15
lines changed

1 file changed

+29
-15
lines changed

ci/pipeline.yml

Lines changed: 29 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -163,14 +163,6 @@ jobs:
163163
params:
164164
PREVIOUS_BINARY_PATTERN: bosh-cli-*-linux-amd64
165165
CURRENT_BINARY_PATTERN: bosh-cli-*-linux-amd64
166-
on_success:
167-
do:
168-
- put: release-notes
169-
params:
170-
file: release-notes/release-notes.md
171-
- put: version-semver
172-
params:
173-
bump: patch
174166
- try:
175167
task: check-for-patched-cves
176168
file: golang-release/ci/tasks/shared/check-for-patched-cves.yml
@@ -180,20 +172,42 @@ jobs:
180172
params:
181173
SEVERITY: CRITICAL,HIGH
182174
SOURCE_PATH: # root path
175+
- task: ensure-cve-checker-succeeded
176+
file: golang-release/ci/tasks/shared/ensure-cve-checker-succeeded.yml
177+
image: ubuntu-image
178+
params:
179+
description: |
180+
Since the previous step is wrapped in a "try", this task checks that the previous step fully executed.
181+
- try:
182+
task: check-needs-release
183+
config:
184+
platform: linux
185+
image_resource:
186+
type: docker-image
187+
source: {repository: alpine}
188+
inputs:
189+
- name: release-notes
190+
run:
191+
path: /bin/sh
192+
args:
193+
- -c
194+
- |
195+
if [ -f release-notes/needs-release ]; then
196+
echo "## Release Notes"
197+
echo "${release-notes/release-notes.md}"
198+
exit 0
199+
else
200+
echo "No release needed"
201+
exit 1
202+
fi
183203
on_success:
184204
do:
185205
- put: release-notes
186206
params:
187-
file: patched_cves/release-notes.md
207+
file: release-notes/release-notes.md
188208
- put: version-semver
189209
params:
190210
bump: patch
191-
- task: ensure-cve-checker-succeeded
192-
file: golang-release/ci/tasks/shared/ensure-cve-checker-succeeded.yml
193-
image: ubuntu-image
194-
params:
195-
description: |
196-
Since the previous step is wrapped in a "try", this task checks that the previous step fully executed.
197211

198212
- name: build
199213
public: true

0 commit comments

Comments
 (0)