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

Multi-platform support #711

Conversation

SaschaSchwarze0
Copy link
Member

Changes

This enables our build to produce multi-platform images. Details:

  • I am switching to ko 0.8.1, 0.8.0 probably also works, but I locally worked with the latest version.
  • In the Makefile, I rename the global environment variables GOOS and GOARCH to GO_OS and GO_ARCH. I need to do this to prevent those variable to be present anywhere, especially in the release target where ko is now ran with the --platform=all argument to produce the multi-platform image. In that case, the GOOS and GOARCH environment variables must not be set. For other targets that are invoking ko, I am setting those two environment variables specifically to make sure the image is built for the platform of the user's machine. Otherwise, ko would always be building linux/amd64
  • The README adds a defensive support statement around this.
  • The build strategy documentation is extended to mention the platform support.
  • I changed the ko build strategy to be cross-platform, building actually for the platform of the Kube cluster until we can give more control to the Build user once we have spec.params.

Fixes #698

Submitter Checklist

  • Includes tests if functionality changed/was added
  • Includes docs if changes are user-facing
  • Set a kind label on this PR
  • Release notes block has been filled in, or marked NONE

Release Notes

The Shipwright Build controller image is now provided for multiple platforms

@openshift-ci-robot openshift-ci-robot added the release-note Label for when a PR has specified a release note label Apr 1, 2021
@SaschaSchwarze0 SaschaSchwarze0 added the kind/feature Categorizes issue or PR as related to a new feature. label Apr 1, 2021
Copy link
Contributor

@imjasonh imjasonh left a comment

Choose a reason for hiding this comment

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

Love it! Thanks for adding this! 🎉

/lgtm

- [How does Tekton Pipelines handle resources](#how-does-tekton-pipelines-handle-resources)
- [Examples of Tekton resources management](#examples-of-tekton-resources-management)
- [Annotations](#annotations)
- [BuildStrategies](#buildstrategies)
Copy link
Contributor

Choose a reason for hiding this comment

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

GitHub generates its own table of contents now, we might consider not writing our own anymore (doesn't have to be in this PR, just something to consider)

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 1, 2021
@openshift-ci-robot openshift-ci-robot removed the lgtm Indicates that a PR is ready to be merged. label Apr 5, 2021
@SaschaSchwarze0
Copy link
Member Author

Rebased to resolve merge conflicts.

Copy link
Member

@adambkaplan adambkaplan left a comment

Choose a reason for hiding this comment

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

/lgtm

KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS}" ko resolve -t "$TAG" --bare -R -f deploy/ > release.yaml
KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS} -tags=pprof_enabled" ko resolve -t "$TAG-debug" --bare -R -f deploy/ > release-debug.yaml
KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS}" ko resolve -t "$TAG" --bare --platform=all -R -f deploy/ > release.yaml
KO_DOCKER_REPO="$IMAGE_HOST/$IMAGE" GOFLAGS="${GO_FLAGS} -tags=pprof_enabled" ko resolve -t "$TAG-debug" --bare --platform=all -R -f deploy/ > release-debug.yaml
Copy link
Member

Choose a reason for hiding this comment

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

For reference - ko inspects the manifest list of the base image, and then does a golang build for each platform in the manifest [1]. I assume this also means ko resolve will push a manifest list.

[1] https:/google/ko#multi-platform-images

Copy link
Member Author

Choose a reason for hiding this comment

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

@openshift-ci-robot openshift-ci-robot added the lgtm Indicates that a PR is ready to be merged. label Apr 6, 2021
@adambkaplan
Copy link
Member

/approve

@openshift-ci-robot
Copy link

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: adambkaplan

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci-robot openshift-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Apr 6, 2021
@openshift-merge-robot openshift-merge-robot merged commit e168bbf into shipwright-io:master Apr 6, 2021
@SaschaSchwarze0 SaschaSchwarze0 deleted the sascha-multi-platform-support branch April 6, 2021 13:22
@adambkaplan adambkaplan added this to the release-v0.5.0 milestone Jun 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. kind/feature Categorizes issue or PR as related to a new feature. lgtm Indicates that a PR is ready to be merged. release-note Label for when a PR has specified a release note
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Provide shipwright build controller as multi-arch image
5 participants