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

Add multi-arch and automatic Go version build support #391

Merged
merged 13 commits into from
Jan 30, 2023

Conversation

RedbackThomson
Copy link
Contributor

Extends #358

Description of changes:
Adds support for GOARCH in the controller image Dockerfile and relevant scripts. Updates the Dockerfile to use the Go version specified in go.mod file (upgraded to 1.19).

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.

@ack-bot ack-bot requested review from jljaco and vijtrip2 January 20, 2023 22:11
@RedbackThomson
Copy link
Contributor Author

/hold
While I debug the Docker failures in Prow

@ack-bot ack-bot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 25, 2023
@aws-controllers-k8s aws-controllers-k8s deleted a comment from a-hilaly Jan 25, 2023
@aws-controllers-k8s aws-controllers-k8s deleted a comment from a-hilaly Jan 25, 2023
@aws-controllers-k8s aws-controllers-k8s deleted a comment from a-hilaly Jan 25, 2023
Copy link
Member

@a-hilaly a-hilaly left a comment

Choose a reason for hiding this comment

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

Looks good! I have two questions

Comment on lines +74 to +75
SERVICE_CONTROLLER_GIT_VERSION=$(git describe --tags --always --dirty || echo "unknown")
SERVICE_CONTROLLER_GIT_COMMIT=$(git rev-parse HEAD)
Copy link
Member

Choose a reason for hiding this comment

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

Ah, i guess this is shellcheck recommendation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes. Using backticks to run commands is not recommended

@@ -79,6 +88,11 @@ if ! is_public_ecr_logged_in; then
aws ecr-public get-login-password --region us-east-1 | docker login --username AWS --password-stdin public.ecr.aws
fi

pushd "$ROOT_DIR" 1>/dev/null
# Get the golang version from the code-generator
GOLANG_VERSION=${GOLANG_VERSION:-"$(go list -f {{.GoVersion}} -m)"}
Copy link
Member

Choose a reason for hiding this comment

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

So if i understand well, now controllers will be built using a Go compiler version parsed from code-generator go.mod? Meaning that if we bump the version in the go.mod, it will bump the compiler version?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

That's correct. We need to be using the minimum Golang version as the code-generator, which should also be the same minimum version as the runtime.

Copy link
Contributor

@jljaco jljaco left a comment

Choose a reason for hiding this comment

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

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 26, 2023
Copy link
Collaborator

@jaypipes jaypipes left a comment

Choose a reason for hiding this comment

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

Diggin' these changes, thank you @RedbackThomson!

ARG base_image=public.ecr.aws/eks-distro-build-tooling/eks-distro-minimal-base-nonroot:2021-12-01-1638322424

# Golang image to use for compiling the manager
ARG builder_image=public.ecr.aws/docker/library/golang
Copy link
Collaborator

Choose a reason for hiding this comment

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

cool that we're updating to the AWS-maintained golang. ++

@a-hilaly
Copy link
Member

/retest
/lgtm

@RedbackThomson
Copy link
Contributor Author

/unhold
Let's send it

@ack-bot ack-bot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jan 30, 2023
@ack-bot ack-bot removed the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2023
@a-hilaly
Copy link
Member

/lgtm

@ack-bot ack-bot added the lgtm Indicates that a PR is ready to be merged. label Jan 30, 2023
@ack-bot
Copy link
Collaborator

ack-bot commented Jan 30, 2023

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: A-Hilaly, jaypipes, jljaco, RedbackThomson

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:
  • OWNERS [A-Hilaly,RedbackThomson,jljaco]

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

@ack-bot ack-bot merged commit 9c766d9 into aws-controllers-k8s:main Jan 30, 2023
@ack-bot
Copy link
Collaborator

ack-bot commented Jan 30, 2023

@RedbackThomson: The following tests failed, say /retest to rerun all failed tests:

Test name Commit Details Rerun command
s3-controller-test 01f67f4 link /test s3-controller-test
dynamodb-controller-test 01f67f4 link /test dynamodb-controller-test
ecr-controller-test 01f67f4 link /test ecr-controller-test

Full PR test history. Your PR dashboard.

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/test-infra repository. I understand the commands that are listed here.

@RedbackThomson RedbackThomson deleted the go-1-19 branch January 30, 2023 22:12
ack-prow bot pushed a commit to aws-controllers-k8s/test-infra that referenced this pull request Feb 1, 2023
Description of changes:
When adding the [Go version and architecture to the code-generator Dockerfile](aws-controllers-k8s/code-generator#391), it broke the continuous deployment scripts which use a separate set of calls (to `buildah`) instead of using `build-controller-image.sh`. This pull request adds the same `GOARCH` and `GOLANG_VERSION` build arguments to the `release-controller.sh` script and adds the Go CLI to the deploy container to support them.

These changes were validated by running a custom edit of the Prowjob against the new images and script. Log output: https://prow.ack.aws.dev/view/s3/ack-prow-logs/logs/lambda-post-submit/1620583281521070080

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
approved lgtm Indicates that a PR is ready to be merged.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants