Skip to content

Commit 4eea47f

Browse files
authored
chore: [REL-4161] dont run setup or cleanup if tag already exists (#557)
I had setup some idempotency checks in the GHA, Bitbucket Pipe and Circleci Orb scripts, so that if we had a partially successful run, we would skip any releases that had already completed successfully (based on the existence of the tag). However, I realized that the setup for those releases also needs to be skipped if the tag exists, so that's what this update does. Cursor also noticed that using the fully-qualified repo in the tag check is wiser since we have this weird nested git repo thing going on, and we don't want to accidentally check the wrong repo. I'll be updating this so the repos are fully isolated once I get this release out the door. <!-- ld-jira-link --> --- Related Jira issue: [REL-4161: Migrate ld-find-code-refs from Releaser to GHA](https://launchdarkly.atlassian.net/browse/REL-4161) <!-- end-ld-jira-link -->
1 parent d6f2654 commit 4eea47f

File tree

2 files changed

+12
-11
lines changed

2 files changed

+12
-11
lines changed

scripts/release/targets/bitbucket.sh

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -22,18 +22,19 @@ clean_up_bitbucket() (
2222
)
2323

2424
publish_bitbucket() (
25-
setup_bitbucket
26-
27-
if git ls-remote --tags origin "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then
25+
if git ls-remote --tags https://bitbucket.org/launchdarkly/ld-find-code-refs-pipe.git "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then
2826
echo "Version exists; skipping publishing BitBucket Pipe"
2927
else
30-
cd bitbucketMetadataUpdates
28+
setup_bitbucket
29+
3130
echo "Live run: will publish pipe to bitbucket."
31+
32+
cd bitbucketMetadataUpdates
3233
git tag "$LD_RELEASE_VERSION"
3334
git push bb-origin master --tags
34-
fi
3535

36-
clean_up_bitbucket
36+
clean_up_bitbucket
37+
fi
3738
)
3839

3940
dry_run_bitbucket() (

scripts/release/targets/gha.sh

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,11 @@ clean_up_gha() (
3737
)
3838

3939
publish_gha() (
40-
setup_gha
41-
42-
if git ls-remote --tags origin "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then
40+
if git ls-remote --tags [email protected]:launchdarkly/find-code-references.git "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then
4341
echo "Version exists; skipping publishing GHA"
4442
else
43+
setup_gha
44+
4545
echo "Live run: will publish action to github action marketplace."
4646

4747
cd githubActionsMetadataUpdates
@@ -51,9 +51,9 @@ publish_gha() (
5151
git tag -f "$RELEASE_TAG_MAJOR"
5252
git push -f origin "$RELEASE_TAG_MAJOR"
5353
gh release create "$RELEASE_TAG" --notes "$RELEASE_NOTES"
54-
fi
5554

56-
clean_up_gha
55+
clean_up_gha
56+
fi
5757
)
5858

5959
dry_run_gha() (

0 commit comments

Comments
 (0)