Skip to content

Commit d6f2654

Browse files
authored
chore: [REL-4161] ensure tag is being created in the correct directory (#556)
There was a missing line here to get into the correct directory. This was just an oversight [^1]. However, the error was quite alarming, and it turns out there's some less-than-ideal git practices here that I'll definitely be cleaning up once I finally get this release out the door. The tl;dr is that we have the main coderefs tool that lives in this repo and we have two other repos that contain the coderefs GHA and the coderefs Bitbucket Pipe. As it happens, we are cloning those repos into directories _inside_ the main repo. This seems like a very bad idea, and I can't imagine any possible benefit from doing that. Anyway, in this case, since the `cd githubActionsMetadataUpdates` line was missing, I was still in the `ld-find-code-refs` repo (where the 2.14.0 tag had already been created), and so the [error](https://github.com/launchdarkly/ld-find-code-refs/actions/runs/16786640560/job/47538679234#step:7:785) I got was `fatal: tag 'v2.14.0' already exists` 😬. This could have been very bad depending on what git operations I was doing. I'll make sure this gets fixed up in the very near term. [^1]: I typically opt for `()`-style (instead of `{}`-style) functions in the shell because local variables behave how you would expect. This style of function creates a subshell, so any kind of file system navigation is not preserved. I had assumed since the `setup_gha` finishes in the `githubActionsMetadataUpdates` directory, that's where I would be when running the git commands. But since that function ran in a subshell, I was put back in the `ld-find-code-refs` root directory (the directory my GHA is run from). <!-- 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 2c3137e commit d6f2654

File tree

2 files changed

+8
-6
lines changed

2 files changed

+8
-6
lines changed

scripts/release/targets/bitbucket.sh

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,13 +23,13 @@ clean_up_bitbucket() (
2323

2424
publish_bitbucket() (
2525
setup_bitbucket
26-
cd bitbucketMetadataUpdates
2726

2827
if git ls-remote --tags origin "refs/tags/v$LD_RELEASE_VERSION" | grep -q "v$LD_RELEASE_VERSION"; then
2928
echo "Version exists; skipping publishing BitBucket Pipe"
3029
else
30+
cd bitbucketMetadataUpdates
3131
echo "Live run: will publish pipe to bitbucket."
32-
git tag $LD_RELEASE_VERSION
32+
git tag "$LD_RELEASE_VERSION"
3333
git push bb-origin master --tags
3434
fi
3535

scripts/release/targets/gha.sh

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,14 @@ publish_gha() (
4343
echo "Version exists; skipping publishing GHA"
4444
else
4545
echo "Live run: will publish action to github action marketplace."
46+
47+
cd githubActionsMetadataUpdates
4648
# tag the commit with the release version and create release
47-
git tag $RELEASE_TAG
49+
git tag "$RELEASE_TAG"
4850
git push origin main --tags
49-
git tag -f $RELEASE_TAG_MAJOR
50-
git push -f origin $RELEASE_TAG_MAJOR
51-
gh release create $RELEASE_TAG --notes "$RELEASE_NOTES"
51+
git tag -f "$RELEASE_TAG_MAJOR"
52+
git push -f origin "$RELEASE_TAG_MAJOR"
53+
gh release create "$RELEASE_TAG" --notes "$RELEASE_NOTES"
5254
fi
5355

5456
clean_up_gha

0 commit comments

Comments
 (0)