-
Notifications
You must be signed in to change notification settings - Fork 116
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
makefile: add command to generate git release tags #720
Conversation
20697bc
to
9667434
Compare
@guggero had the idea of adding a In the github release workflow we could then compare the output of We could then copy this command and release workflow check to LND and other projects. I'll update this PR with that command. |
9667434
to
671d34e
Compare
According to this website, the right way to tag rc2 would be Where the trailing |
ee48da3
to
6187c40
Compare
@guggero @jharveyb I think these are the changes we discussed on our call (I should have taken more notes...):
Let me know if I'm missing anything. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice, looks pretty good! Just a couple of suggestions to fix the actual make target.
6187c40
to
781d160
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Cool, looking forward to the standardized tagging procedure in all our projects 💯
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Great PR to improve our tooling and release flow!
Some nits and clarifying comments but looks close.
Makefile
Outdated
echo "Script encountered an error with exit status $$exit_status."; \ | ||
fi; \ | ||
echo "Adding git tag: $$tag"; \ | ||
git tag -s -a "$$tag" -m "Release $$tag"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this have the word Release
at all? Not sure where this message shows up tbh.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that the git tag message is a git artefact only and isn't used in a github release.
Here we create the git tag message as part of the release-tag
make command which is release specific. The message is just a bit of extra documentation. The $$tag
is probably redundant. We could possibly expand the message to say that the tag was created using the release-tag
command? I think I'll make that change. Let me know what you think.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, the convention for -m
would be: -m "<project_name> <git_tag>"
. So maybe we could pass in the project name from the command line as well? And hard code it in the Makefile as we do with the name of the version.go
file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why is that the convention? It doesn't seem like a good idea to me.
The git_tag
is already included in the tag artefact outside of the message field. Why repeat that in the message field? And I think the project name is obvious, so I don't see why it should be included either.
Why don't we describe in the message how the tag was actually created given that it will be produced by executing a command?
scripts/get-git-tag-name.sh
Outdated
# compliant version string. | ||
check_git_tag_name() { | ||
local tag_name="$1" | ||
semver_regex="^v([0-9]+)\.([0-9]+)\.([0-9]+)(-[0-9A-Za-z-]+(\.[0-9A-Za-z-]+)*)?(\+[0-9A-Za-z-]+)?$" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would be good to have a citation for the source of this regex, my cursory searches for a bash-compatible semver regex were all much longer (maybe those are stricter than we want)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The regex that you're referring to wasn't specific enough. It allowed leading zeros for example.
I've generated a better regex with the help of AI. And also better documentation.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The new semver regex is more general than what we need. So I might do a second round of matching on a LL specific regex.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm wondering also if there is a golang tagging one we could find somewhere?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've been thinking a bit more about this. I think that we don't need a regex which checks for semver compliance in all its possible forms. We just need a check for a Lightning Labs version compliance as a subset of semver compliance. We can just manually check that our simpler regex is a subset of semver.
So I think our regex here can be much simpler and we don't need a golang tagging regex check either.
Do you agree?
version = fmt.Sprintf("%s-%s", version, preRelease) | ||
|
||
// Append any status and pre-release strings to the version string. | ||
switch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Bit confused on this switch, do we ever want appStatus without preRelease? From the tapd tags it looks like we only do both or neither, ex. v0.3.2
, v0.3.0-alpha.rc3
, but no v0.3.0-alpha
nor v0.3.0-rc3
.
Or is this to also match a different pattern used for a different project?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Or is this to also match a different pattern used for a different project?
I think we should make sure that possibility is available to us. I don't think we have a strict org wide rule around the use of status without pre-release. For instance, v0.3.0-alpha
seems like a reasonable tag to me.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
K, I thought leaving out the rc1
suffix when using alpha
or beta
is what caused issues previously? I don't recall exactly which tag caused those though.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What caused the issue previously was leaving out -alpha
while just using an rc
tag (e.g. 0.3.2-rc2
), because then the version check of the release script didn't work as it just did a substring comparison with what the app version string reported (v0.3.2-alpha.rc2
).
So I think we should also update the check_tag_correct
function in scripts/release.sh
to use the new get-git-tag-name.sh
script and compare it to the checked out tag.
And to answer your other question, just having the status is what we want for non-RC releases in all other projects than this one (e.g. lnd).
3c588c4
to
693ec07
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry, found a couple of more things while testing 😅
version = fmt.Sprintf("%s-%s", version, preRelease) | ||
|
||
// Append any status and pre-release strings to the version string. | ||
switch { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What caused the issue previously was leaving out -alpha
while just using an rc
tag (e.g. 0.3.2-rc2
), because then the version check of the release script didn't work as it just did a substring comparison with what the app version string reported (v0.3.2-alpha.rc2
).
So I think we should also update the check_tag_correct
function in scripts/release.sh
to use the new get-git-tag-name.sh
script and compare it to the checked out tag.
And to answer your other question, just having the status is what we want for non-RC releases in all other projects than this one (e.g. lnd).
@ffranr, remember to re-request review from reviewers when ready |
The modifications in this commit streamline version.go for easier parsing with bash, setting the stage for enhancements in a subsequent commit.
This commit removes the characters `.`, `-`, and ` ` from the semantic alphabet.
693ec07
to
1ca78d5
Compare
Addressed (responded to) all review comments. New code pushed. Re-requested reviews. |
One last issue with the tag name (#720 (comment)), then we're good to go 🎉 |
aaa02b4
to
b4b391e
Compare
This commit introduces a makefile command that generates a git release tag by parsing the version string from version.go via the newly created script get-git-tag-name.sh.
This commit adds a check to this project's GitHub release workflow to ensure that the release version string is SemVer compliant. It also indirectly ensures that the version string matches the tag that would have been created with the `make release-tag` command.
This commit narrows the field of acceptable characters to 0-9 and a-z. The alphabet is compliant with SemVer but also stricter.
This commit modifies the release build script such that it checks the validity of the checked-out git tag by cross-referencing with the output of the `get-git-tag-name.sh` script.
b4b391e
to
4d6aa3a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
tACK, LGTM 🎉
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, great to see the alphabet changes + Makefile updates! 💯
Closes #729
This commit adds a check to this project's GitHub release workflow to ensure that the release version string is SemVer compliant.