Skip to content

CD Proposal: Don't update 'latest' Docker tag on Github pre-release#285

Closed
arm4b wants to merge 3 commits intomainfrom
ci/pre-release
Closed

CD Proposal: Don't update 'latest' Docker tag on Github pre-release#285
arm4b wants to merge 3 commits intomainfrom
ci/pre-release

Conversation

@arm4b
Copy link
Copy Markdown
Contributor

@arm4b arm4b commented Aug 19, 2022

Based on #283, we updated the latest Docker tag on releasing the 2.0.0-rc which might be great for preview, but not a completely stable version.
An alternative is to additionally use the Github pre-release functionality in Github:

image
image

With this PR, Github pre-releases won't update the latest tag on Docker Hub, only "stable" releases will.
This way we would control more granularly the usage of latest Docker tag users rely on.

@arm4b arm4b added enhancement ✨ New feature or request CI/CD proposal labels Aug 19, 2022
@mickmcgrath13
Copy link
Copy Markdown
Contributor

mickmcgrath13 commented Aug 19, 2022

@armab what tag does the published bitops image end up with for a github pre-release? Have you tested that it works as expected?

@arm4b
Copy link
Copy Markdown
Contributor Author

arm4b commented Aug 19, 2022

@mickmcgrath13 Taking table here as an example: https://bitovi.github.io/bitops/versioning/#official-images, the pre-release will publish the tags as before, but won't update the latest reference.

This means if we, for example, publish a new v2.1.0-rc and mark it as "pre-release", it will push the bitovi/bitops:2.1.0-rc-omnibus as usual, but won't update the latest. Once we're confident with the quality we can publish then a "normal" Github release.

And yes, I'll need to test this PR functionality somehow.

Copy link
Copy Markdown
Contributor

@mickmcgrath13 mickmcgrath13 left a comment

Choose a reason for hiding this comment

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

@armab
approved so long as it's tested somehow. Can you outline in this PR a plan to test?

@arm4b
Copy link
Copy Markdown
Contributor Author

arm4b commented Aug 23, 2022

Yeah, working on my fork. Looks like there's a rabbit hole, considering that release workflow for prebuilt images was never actually ran.

Good call on testing 👍

Fixes:
```
Traceback (most recent call last):
13
  File "/entrypoint.py", line 39, in <module>
14
    file.write(template.render(**variables) + '\n')
15
  File "/usr/lib/python3.7/site-packages/jinja2/asyncsupport.py", line 76, in render
16
    return original_render(self, *args, **kwargs)
17
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 1008, in render
18
    return self.environment.handle_exception(exc_info, True)
19
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 780, in handle_exception
20
    reraise(exc_type, exc_value, tb)
21
  File "/usr/lib/python3.7/site-packages/jinja2/_compat.py", line 37, in reraise
22
    raise value.with_traceback(tb)
23
  File "<template>", line 1, in top-level template code
24
  File "/usr/lib/python3.7/site-packages/jinja2/environment.py", line 430, in getattr
25
    return getattr(obj, attribute)
26
jinja2.exceptions.UndefinedError: 'tags' is undefined
```

when using `tags.bitops_base` in 'variables'
Comment on lines 32 to 33
commitChange: true
updateFile: true
Copy link
Copy Markdown
Contributor Author

@arm4b arm4b Aug 23, 2022

Choose a reason for hiding this comment

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

@PhillypHenning I'm afraid the multi-step logic updating the bitops tag via commit becomes out of date since we agreed on introducing the dev tag that's generated from the main branch.

The problem is that TAG file update (including for releases) happens in the main branch too where the source of truth for the tag is that file.
Instead of that we could be just taking the tag from the original release version and consider that as a source of truth for tagging the "stable" BitOps docker images via GH Workflows in one go without multi-step tag file update.

Are you fine with this approach? Do you see any corner cases going that way?
I can work on refactoring the workflow in another PR if agreed.
WDYT?

Copy link
Copy Markdown
Contributor

@mickmcgrath13 mickmcgrath13 Aug 25, 2022

Choose a reason for hiding this comment

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

we could be just taking the tag from the original release version

@armab Is this to say that we use a GitHub tag based workflow, and whatever the GitHub Tag is is what we use for the image versions?

@PhillypHenning remind me why we had the multi-step approach (i.e. update a file)?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

@mickmcgrath13
The idea behind it was that if anything source wise changed it would regenerate the base tag, which then would bump the tag file, which was the trigger for the loaded images.

@armab
I like the approach you're suggesting 👍

Comment on lines +19 to +20
release:
types: [ published ]
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Looks like the omnibus image wasn't built on a release event, but instead the built was triggered when another "base" workflow updated the tag file.
With that approach there is no way to figure if it's a release or pre-release event here.

@arm4b arm4b changed the title CI Proposal: Don't update 'latest' Docker tag on Github pre-release CD Proposal: Don't update 'latest' Docker tag on Github pre-release Aug 23, 2022
@arm4b arm4b marked this pull request as draft August 23, 2022 20:05
@arm4b
Copy link
Copy Markdown
Contributor Author

arm4b commented Aug 29, 2022

Closing this PR in favor of #293 as a proper implementation will need some rework.

@arm4b arm4b closed this Aug 29, 2022
@arm4b arm4b deleted the ci/pre-release branch August 29, 2022 17:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants