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

Enable multi-arch builds in GHA for the main branch #161

Merged

Conversation

rooftopcellist
Copy link
Member

We should build multi-arch images for the eda-server-operator, starting with the the images built for the main branch.

Example of a successful run on my fork:

@jon-nfc
Copy link
Contributor

jon-nfc commented Jan 8, 2024

@rooftopcellist, great minds think alike (#162) and if it wasn't for @kurokobo, I would not have noticed your work.

I'll post what I've done so far as it might give some ideas.

jon-nfc added a commit to jon-nfc/eda-server-operator that referenced this pull request Jan 8, 2024
by using docker buildx build, multi arch builds can be achieved.

see makefile `PLATFORMS` var for default architectures that are build.

PR ansible#161
- These images can later be re-tagged and used by the Release GHA

Author: jon-nfc
Signed-off-by: Christian M. Adams <chadams@redhat.com>
@rooftopcellist
Copy link
Member Author

This worked as expected when I tested it on my fork:

Copy link
Contributor

@Alex-Izquierdo Alex-Izquierdo left a comment

Choose a reason for hiding this comment

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

LGTM, but why not going far away and be able to generate also a tagged image?

run: |
IMG=eda-server-operator:main make docker-build
- name: Log into registry ghcr.io
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
Copy link
Contributor

Choose a reason for hiding this comment

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

Just out of curiosity, why use the commit with a comment with the tag instead of just the tag?

Copy link
Member Author

Choose a reason for hiding this comment

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

@Alex-Izquierdo that change was made by @jon-nfc , but my guess is that it was to pin to a particular known working version of the docker login action in case a new release breaks it. However, I do not know of a specific issue why this might have been done.

The commit is correct for v3.0.0:

Copy link
Contributor

Choose a reason for hiding this comment

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

@Alex-Izquierdo

@rooftopcellist is correct it originated from myself. Code was copied directly from github action template. However the reason for keeping it this way is very simple, Security.

A word none of us like, but must deal with. Security in this case is the prevention (reduction in probability) of supply chain attack or more correctly put limiting attack surface.

A git hash in the context of a repository will always remain the same and always be in the same location in the git history. You can not change a git hash. Even if you submit the same code in the same location in the git history, the git hash will always be different.

A Git tag is tied to a git hash. The problem with a git tag for chain of custody is that the git tag can move hashes. You can delete an existing tag and attach it to another commit hash. This is problem when using it to reference a dependency.

A hash to reference the same work as a git tag is preferable. one would hope that the developer whom used the code had reviewed the dependent repo. This I suppose you could call now a dependency in a known and "approved" state. If the hash changes, which would make it not exist, then an error will occur.

Whilst it's not impossible for a hash collision to occur, the probability of it occurring is in the order of 2^40 which is significantly larger than the tag change which anyone with access to commit can do.

Copy link
Contributor

Choose a reason for hiding this comment

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

addendum.

the commented tag version exists next to the hash as we are humans, and readability is important.

@rooftopcellist
Copy link
Member Author

@Alex-Izquierdo I'm not sure I understood this bit.

LGTM, but why not going far away and be able to generate also a tagged image?

Currently, it will create an image with the git commit sha as the tag and push it to ghcr.io to be re-tagged for release, or for debugging purposes. It will also push to quay.io with the main tag so that users always have a build of the latest changes in the main branch of the operator.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants