-
Notifications
You must be signed in to change notification settings - Fork 897
ci: publish main commit tag to ghcr.io/coder/coder-preview
#8897
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
Conversation
.github/workflows/ci.yaml
Outdated
# Get old package tag | ||
previous_package_tag=$(gh api /repos/coder/coder/commits/main | jq -r '.parents[0].sha[:8]') | ||
echo "previous_package_tag=$previous_package_tag" >> GITHUB_OUTPUT |
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.
This isn't robust because on failure we will fail to delete old tags. This should be changed to find all old tags on the registry using the API and delete commits older than a couple of days/weeks or something. Deleting commits immediately means that new replicas will fail to pull on new nodes.
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.
Ok. So something like if it is older than 7 days?
Also as this package also hosts pr1234
tags and some tags like gvisor-fix
that we do not want to delete, so I opted for deleting only a specific tag as filtering will include more complexity
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.
You could also push to a public gcr.io dir instead for better safety, we could make a project on our billing account and add the CI's service account to have permissions to manage images in that project on artifact registry
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.
Hmm. I want to keep it here for now to reduce further complexity. I will try to develop a more robust way to delete all old tags. Thanks for the feedback.
organization: coder | ||
container: coder-preview | ||
dry-run: true | ||
keep-younger-than: 7 # days |
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.
this will delete all old image tags older than 7 days that does not start with pr
e.g. pr1234
and will delete images that start with main-
i.e. main-632hst52
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.
cc: @deansheather
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.
this will also not delete custom pushed tags like gvisor-fix
ghcr.io/coder/coder-preview
I had a stale review from earlier that I forgot to approve, disregard the comments |
This will publish 2 tags
ghcr.io/coder/coder-preview:main
andghcr.io/coder/coder-preview:main-shortsha
on each merge to main.Also, it will prune
ghcr.io/coder/coder-preview
for all previous tags that are older than 7 days while preserving anypr1234
tags and custom tags likegvisor-fix
.