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

chore(ci): rename release branch image's tag #48

Merged
merged 6 commits into from
Nov 8, 2023

Conversation

mwangggg
Copy link
Member

@mwangggg mwangggg commented Nov 2, 2023

fixes: #39

@mwangggg mwangggg added chore Refactor, rename, cleanup, etc. ci labels Nov 2, 2023
@andrewazores
Copy link
Member

So with this, the pushed branch name is used:

  • main -> main + latest
  • cryostat-vX.Y -> X.Y.0

Right?

I think that's a good enough improvement. I might prefer to have cryostat-vX.Y -> X.Y. X.Y.0, X.Y.1 would be better to do using git tags somehow.

@andrewazores
Copy link
Member

andrewazores commented Nov 2, 2023

Oh, I meant that the .0 and .1 tags should not normally be applied. If there is a push to the branch cryostat-v2.4 then this should result in the image only being tagged as 2.4, not as 2.4.0 or 2.4.1. The 2.4.0 and 2.4.1 image tags would ideally be created somehow based on git tags.

I'm imagining a workflow where we cut a release branch like cryostat-v2.4 off of main. Any push to cryostat-v2.4 (ex. PRs getting backported) would result in the 2.4 image tag getting bumped up to the most recent image built from that branch. Image tags like 2.4.0 and 2.4.1 would be additionally applied to container images if they are built from commits that have a git tag like 2.4.0 or 2.4.1 on them. So at some point in time, there would be a container image tagged as both 2.4 and 2.4.0. If another backport goes into the cryostat-v2.4 branch, then the 2.4 tag would get updated and point to that newer container image, but 2.4.0 would remain on the previous one that was built from the specific commit with that git tag.

I think git describe --tags --exact-match sounds like it would be useful for this (man git-describe).

$ pwd
/home/work/workspace/cryostat-grafana-dashboard
$ git describe --tags --exact-match
fatal: no tag exactly matches 'd3a5158a827f34e205eea6ef5512737e66c3c229'
$ git tag
1.0.0-BETA4
v1.0.0
v2.1.0
v2.3.0
$ git checkout v2.3.0
$ git describe --tags --exact-match
v2.3.0

So something like git describe --tags --exact-match 2>/dev/null || echo -n '' can be run. If the current commit exactly matches a git tag, then that git tag's name is output to stdout. Otherwise it's the empty string.

@mwangggg
Copy link
Member Author

mwangggg commented Nov 2, 2023

ohhh I thought the period was a comma. Time to get glasses

andrewazores
andrewazores previously approved these changes Nov 2, 2023
Copy link
Member

@andrewazores andrewazores left a comment

Choose a reason for hiding this comment

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

LGTM. WDYT @ebaron ?

@andrewazores
Copy link
Member

If Elliott also agrees on tagging container images using git tags this way then we should do the same or similar across all of our repos that produce container images, too. This makes the release process a little easier/more automated, and keeps it consistent across repos.

@ebaron
Copy link
Member

ebaron commented Nov 6, 2023

I'm a little concerned with using something like 2.4 to represent a development build. I would naively expect that tag to point to whatever the latest 2.4.x release is. Keeping some kind of suffix like -dev or -snapshot would make this distinction a lot more obvious.

@andrewazores
Copy link
Member

andrewazores commented Nov 6, 2023

That's fair. We could have pushes to the branch cryostat-vX.Y tag images as X.Y-dev, and then create X.Y.0 and X.Y.1 image tags using git tags.

We could leave it at that, or we could add a small snippet of JS or shell code that also tags the image as X.Y whenever the push corresponds to a git tag X.Y.Z. That could go another step further and also add the image tag X.

Copy link
Contributor

@aali309 aali309 left a comment

Choose a reason for hiding this comment

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

LGTM

andrewazores
andrewazores previously approved these changes Nov 7, 2023
@andrewazores andrewazores dismissed their stale review November 7, 2023 19:58

spotted one potential tag handling bug

@andrewazores andrewazores merged commit 2c73a76 into cryostatio:main Nov 8, 2023
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
chore Refactor, rename, cleanup, etc. ci
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Task] CI should tag images like 2.4.0 rather than cryostat-v2.4
4 participants