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

build kots with apko+melange in presubmit #3959

Closed
wants to merge 3 commits into from

Conversation

cbodonnell
Copy link
Contributor

@cbodonnell cbodonnell commented Jul 5, 2023

What this PR does / why we need it:

This PR adds a presubmit GitHub Actions workflow to build and publish a kots image from the PR's source, including relevant other packages like helm, kustomize, and kubectl. For now, only the latest kubectl is included in the image, but we should be able to add older supported kubectls relatively soon.

To do this, the PR adds an apko.yaml and melange.yaml to be used with (you guessed it) apko and melange to build kots into an APK and to install that APK into an image.

Which issue(s) this PR fixes:

None that I'm aware of.

Special notes for your reviewer:

None

Steps to reproduce

See apko_melange_build.md

Does this PR introduce a user-facing change?

None at this time, though this could be extended to produce user-visible images by this process either on pushes to main or at release-time.

NONE

Does this PR require documentation?

Yes, added in apko_melange_build.md

cc @denhamparry

@cbodonnell cbodonnell force-pushed the cherry-pick/imjasonh-apko-build branch from 189e17d to d064244 Compare July 6, 2023 18:54
@cbodonnell
Copy link
Contributor Author

@denhamparry @imjasonh

The new workflow itself looks good. We need to integrate this into our existing build-test workflow and ensure that the built image is used by the tests. It's possible it will require a couple of small tweaks, but we should be able to take this one from here. Thanks for putting this together!

@imjasonh
Copy link
Contributor

imjasonh commented Jul 7, 2023

It's possible it will require a couple of small tweaks, but we should be able to take this one from here.

Glad to hear it! Don't hesitate to reach out if there's any trouble. 🚀

contents: read
steps:
- uses: actions/checkout@v3
- uses: actions/setup-go@v3
Copy link
Contributor

Choose a reason for hiding this comment

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

let's get on actions/setup-go@v4 since this is a new workflow.


jobs:
presubmit-image:
runs-on: ubuntu-latest
Copy link
Contributor

Choose a reason for hiding this comment

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

can we pin to a specific ubuntu major version (preferably 22.04)?

run-as: kotsadm

environment:
VERSION: v1.98.3
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 assuming this refers to the KOTS version? I feel like this should be a variable assuming the file format supports them, else we need to envsubst and pipe into apko.


archs:
- x86_64
- aarch64
Copy link
Contributor

Choose a reason for hiding this comment

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

Have we started supporting KOTS on arm64? If not, should we remove this? I don't feel like we're doing a lot of local dev on KOTS.

KOTS_KUSTOMIZE_BIN_DIR=/usr/local/bin

# TODO: fix pact build error on arm https://github.com/pact-foundation/pact-js-core/issues/264
export PACT_SKIP_BINARY_INSTALL=true
Copy link
Contributor

Choose a reason for hiding this comment

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

This should no longer be necessary as we should be on the latest version of pact-js which bundles the multi-arch Rust core.

I'll submit a PR for kotsadm today to address that.

Comment on lines +58 to +59
make -C web deps lint build-kotsadm
make vet kots build
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we move the static analysis steps into jobs outside of the package build, and just do the build here? That will allow us to parallelize those items and save some CI time.

with:
config: apko.yaml
archs: x86_64
tag: ttl.sh/kots
Copy link
Contributor Author

Choose a reason for hiding this comment

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

It would probably make integration easier if we match the chainguard image name to our current image name kotsadm

Copy link
Contributor Author

@cbodonnell cbodonnell Jul 14, 2023

Choose a reason for hiding this comment

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

Additionally, we will usually push the image with a namespace to avoid conflicts on ttl.sh. For example ttl.sh/<some-identifier>/kotsadm:24h

config: melange.yaml
archs: x86_64
sign-with-temporary-key: true
- uses: chainguard-images/actions/apko-publish@main
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I see that this action pushes the image with a digest instead of a tag. Our tests currently leverages a --kotsadm-tag flag to override the image used during the install. For example: https://github.com/replicatedhq/kots/blob/v1.100.3/.github/workflows/build-test.yaml#L988-L990

@cbodonnell
Copy link
Contributor Author

closing as #4018 is merged

@cbodonnell cbodonnell closed this Dec 7, 2023
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.

3 participants