Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modify release script to distinguish git tag errors #1745

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

LeiGlobus
Copy link
Contributor

When I released 2.32.0 earlier this week, the git tag command in release.sh failed(my gpg key, only used for tags, expired a few weeks earlier), but I missed the error message amongst the release output:

...
error: gpg failed to sign the data
error: unable to sign the tag
...

The script thinks it's a 'tag already exists' error and asks to confirm, which I answered 'y' without becoming suspicious of why the tag would already be pre-existing. In the end, the packages were released but the tag wasn't pushed.

Instead, the user should be prompted for 'already exists' situations, but the script should abort for other, unknown issues.

@LeiGlobus LeiGlobus added no-news-is-good-news This change does not require a news file quick-review Review of this should be quick and easy labels Dec 6, 2024
@LeiGlobus LeiGlobus self-assigned this Dec 6, 2024
Copy link
Contributor

@khk-globus khk-globus left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good call!

Please double check the arguments to Git in the subshell, but in concept, this is a nice addition. Thanks!

Comment on lines +35 to +36
TAG_STDERR="$(git tag -s -m \"v$VERSION\" \"$VERSION\" 2>&1 > /dev/null)"
if [[ $? == 0 ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FWIW, inside of the subshell, there's not a need to escape the quotes. Consider:

TAG_STDERR="$(git tag -s -m "v$VERSION" "$VERSION" 2>&1 > /dev/null)"

Please double check me, but I think the escapes might even include the quotes in what's given to Git:

$ show_args a \"b\" c
ARG 0: show_args
ARG 1: a
ARG 2: "b"
ARG 3: c

$ SOME_VAR="$(show_args a \"b\" c)"

$ echo -e "$SOME_VAR"
ARG 0: show_args
ARG 1: a
ARG 2: "b"
ARG 3: c

Comment on lines +45 to +46
echo Git tag failed: "$TAG_STDERR"
[[ $0 = $BASH_SOURCE ]] && exit 1
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Mildly odd to make that 4 arguments to echo instead of 1, but "meh."

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
no-news-is-good-news This change does not require a news file quick-review Review of this should be quick and easy
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants