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

Adding multi-arch matrix pipeline #1236

Merged
merged 4 commits into from
Aug 21, 2024
Merged

Conversation

arewm
Copy link
Member

@arewm arewm commented Aug 2, 2024

This is a draft PR for a multi-arch pipeline with matrix builds. It cannot be merged yet as there are still a couple of outstanding issues with running a matrix build including:

Before you complete this pull request ...

Look for any open pull requests in the repository with the title "e2e-tests update" and
see if there are recent e2e-tests updates that will be applicable to your change.

Copy link
Member

@zregvart zregvart left a comment

Choose a reason for hiding this comment

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

I like this

pipelines/docker-build-multi-arch-oci-ta/README.md Outdated Show resolved Hide resolved
# add matrix to run based on build-platforms
# change build-image-index to use results from build-containers as well as run after it
# change build-image-index to build image index
# change JAVA_COMMUNITY_DEPENDENCIES value to "$(tasks.build-containers.results.JAVA_COMMUNITY_DEPENDENCIES[0])"
Copy link
Member

Choose a reason for hiding this comment

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

I guess we don't care from which image build the JAVA_COMMUNITY_DEPENDENCIES resulted, all architectures will generate the same?

Copy link
Member Author

Choose a reason for hiding this comment

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

This has been the pattern that we have maintained when exploring multi-arch pipelines. It can be revisited when the java build pipeline is reassessed for multi-arch support.

pipelines/docker-build-multi-arch-oci-ta/patch.yaml Outdated Show resolved Hide resolved
value: build-containers
- op: replace
path: /spec/tasks/3/taskRef/name
value: buildah-remote-oci-ta
Copy link
Member

Choose a reason for hiding this comment

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

We build everything remotely, pragmatic approach...

Copy link
Member Author

Choose a reason for hiding this comment

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

Well, we use the same task for everything. The intention behind some of the linked issues in the beginning is to allow these to be a "pass through" to an in-cluster build without changing the task used.

pipelines/docker-build-multi-arch-oci-ta/patch.yaml Outdated Show resolved Hide resolved
pipelines/docker-build-oci-ta/patch.yaml Show resolved Hide resolved
@arewm
Copy link
Member Author

arewm commented Aug 2, 2024

/retest build-definitions-pull-request

@arewm arewm force-pushed the multi-arch-pipeline branch 2 times, most recently from e3a97f4 to b86405f Compare August 2, 2024 18:04
@ifireball
Copy link
Member

Is this an implementation of STONEBLD-2567?

@arewm
Copy link
Member Author

arewm commented Aug 5, 2024

@ifireball, yes. As is #1226.

@simonbaird
Copy link
Contributor

IIUC, this is semi-blocked until tektoncd/chains#1164 becomes generally available within Konflux. Is that accurate?

@simonbaird
Copy link
Contributor

See also #1226 which may have some overlap.

@arewm
Copy link
Member Author

arewm commented Aug 5, 2024

@simonbaird, This is not blocked on the Chains bug fix. I have worked around that with #1204

@simonbaird
Copy link
Contributor

@simonbaird, This is not blocked on the Chains bug fix. I have worked around that with #1204

Ack, so I think we're likely to abandon #1226, which (AIUI) tries to implement a multi-arch pipeline without matrix support. Do you agree @joejstuart ?

Copy link

@openshift-ci openshift-ci bot left a comment

Choose a reason for hiding this comment

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

@arewm: 1 invalid OWNERS file

In response to this:

This is a draft PR for a multi-arch pipeline with matrix builds. It cannot be merged yet as there are still a couple of outstanding issues with running a matrix build including:

Before you complete this pull request ...

Look for any open pull requests in the repository with the title "e2e-tests update" and
see if there are recent e2e-tests updates that will be applicable to your change.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

task/build-image-index/OWNERS Outdated Show resolved Hide resolved
@arewm arewm force-pushed the multi-arch-pipeline branch 3 times, most recently from fdbe24f to de741da Compare August 15, 2024 15:05
@arewm arewm changed the title DO NOT MERGE: Adding multi-arch pipeline Adding multi-arch matrix pipeline Aug 15, 2024
@arewm arewm marked this pull request as ready for review August 15, 2024 15:05
@arewm arewm requested a review from a team August 15, 2024 15:05
@arewm arewm force-pushed the multi-arch-pipeline branch 3 times, most recently from 59a8c06 to 089a8a1 Compare August 20, 2024 17:24
@arewm
Copy link
Member Author

arewm commented Aug 20, 2024

/retest

@@ -107,7 +107,7 @@ spec:
results:
- description: Digest of the image just built
name: IMAGE_DIGEST
- description: Image repository where the built image was pushed
- description: Image repository and tag where the built image was pushed
Copy link
Contributor

Choose a reason for hiding this comment

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

The "and tag" part is technically up to the user; if they use a tag-less image as IMAGE, then IMAGE_URL won't have a tag either.

But this should be rare if not non-existent in practice

Copy link
Member Author

Choose a reason for hiding this comment

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

If no tag is set than an implicit tag of latest will be used.

Copy link
Contributor

Choose a reason for hiding this comment

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

Used yes, but not returned in IMAGE_URL

if [[ $(echo $i | tr -cd ":" | wc -c) == 2 ]]; then
TOADD_REPOSITORY="$(echo "$i" | cut -d@ -f1)"
TOADD_DIGEST="$(echo "$i" | cut -d@ -f2)"
TOADD_TAG="$(echo "$IMAGE" | cut -d: -f2)"
Copy link
Contributor

Choose a reason for hiding this comment

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

Shouldn't we be extracting the tag from $i rather than $IMAGE? Do we want to ignore the actual tag in IMAGES for some reason?

Note: this code wouldn't work as is, the tag extraction doesn't handle digests (and port numbers in the registry host, but that's a problem across almost every task in the pipeline)

Copy link
Member Author

Choose a reason for hiding this comment

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

I added this tag logic because the e2e tests were failing since no tag was getting set. After looking at the pipeline definitions again, this is because I was passing the IMAGE_REF from the container build instead of IMAGE_URL. The result of this is that the IMAGE_URL that was returned ended up stripping off the tag.

For a matrix build, we need to pass IMAGE_REF, but for non-matrix builds, however, $(tasks.build-container.results.IMAGE_URL)@$(tasks.build-container.results.IMAGE_DIGEST) should be used to define the input IMAGES to allow the pass-through functionality.

Copy link
Contributor

Choose a reason for hiding this comment

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

I'm not sure I understood that, but it would be great if the task worked in general, not only for some possible configurations of a pipeline

Copy link
Contributor

@chmeliik chmeliik left a comment

Choose a reason for hiding this comment

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

I think this works, though the build-image-index code is a bit mind-bending in its handling of tags

@openshift-merge-robot
Copy link

PR needs rebase.

Instructions for interacting with me using PR comments are available here. If you have questions or suggestions related to my behavior, please file an issue against the kubernetes-sigs/prow repository.

* Use of Image Index
* Inclusion of image tag in IMAGE_URL result

Signed-off-by: arewm <[email protected]>
* Created a new task that has an appropriate name (build-image-index)
* Changed the build-image-manifest task to be a rebuild of the new
  build-image-index task
* Enabled the image index task to run and skip the generation of an
  index image. This lets the task be added into "single arch" pipelines
  as well as there are still situations where an image index should be
  created

Signed-off-by: arewm <[email protected]>
The build-image-index task is added to all pipelines but the generation
of an image index is disabled by default.

Signed-off-by: arewm <[email protected]>
@arewm arewm enabled auto-merge August 21, 2024 13:59
@arewm arewm added this pull request to the merge queue Aug 21, 2024
Merged via the queue into konflux-ci:main with commit c251fc3 Aug 21, 2024
13 checks passed
@arewm arewm deleted the multi-arch-pipeline branch August 21, 2024 15:07
arewm added a commit to arewm/infra-deployments that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
arewm added a commit to arewm/hac-dev that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
arewm added a commit to arewm/hac-dev that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
arewm added a commit to arewm/infra-deployments that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
rhtap-qe-bots-2 pushed a commit to redhat-appstudio-qe/infra-deployments that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
openshift-merge-bot bot pushed a commit to redhat-appstudio/infra-deployments that referenced this pull request Aug 21, 2024
With konflux-ci/build-definitions#1236, we
started building a multi-arch pipeline. This change adds it to the
config map so that it can be used for configuring components.

Signed-off-by: arewm <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants