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

Set Golang version in Dockerfile #132

Merged
merged 2 commits into from
Mar 15, 2024

Conversation

razo7
Copy link
Member

@razo7 razo7 commented Mar 12, 2024

Why we need this PR

Fix the way we set the Golang version in the Dockerfile.
See the below error from post-submit job that blocks the container build, of the pushed code (after merging PR or setting new tag), and eventually pushing it to Quay.

.
.
.
RUN export GO_VERSION=$(grep -E "go [[:digit:]].[[:digit:]][[:digit:]]" go.mod | awk ...
go: downloading golang.org/dl v0.0.0-20240305174203-2885f567d808
go: golang.org/dl/go1.21@latest: module golang.org/dl@latest found (v0.0.0-20240305174203-2885f567d808), but does not contain package golang.org/dl/go1.21

It tries to use Golang v1.21 (latest installed Golang version) for installing Golang v1.20.

Changes made

Directly install a desired Go version instead of first installing what the builder image provides, and then using Golang CLI to get the desired version. It stems from an error we have seen in building the contianer at the post-submit job

Which issue(s) this PR fixes

No issues, but an error from post-submit job

Directly install a desired Go version instead of first installing what the builder image provides, and then using Golang CLI to get the desired version. It stems from an error we have seen in building the contianer at post-submit job
Copy link
Contributor

openshift-ci bot commented Mar 12, 2024

Skipping CI for Draft Pull Request.
If you want CI signal for your change, please convert it to an actual PR.
You can still manually trigger a test run with /test all

@razo7
Copy link
Member Author

razo7 commented Mar 12, 2024

/test 4.15-openshift-e2e

Dockerfile Outdated
@@ -1,19 +1,28 @@
# Build the manager binary
FROM quay.io/centos/centos:stream8 AS builder
RUN dnf install -y golang git \
RUN dnf install -y golang jq git \
Copy link
Member

Choose a reason for hiding this comment

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

remove golang

Makefile Outdated Show resolved Hide resolved
@razo7 razo7 force-pushed the set-go-version-dockerfile branch 3 times, most recently from 4b455d4 to 3c785ea Compare March 14, 2024 16:44
Dockerfile Outdated
Comment on lines 10 to 11
RUN GO_VERSION=$(grep -E "go [[:digit:]]\.[[:digit:]][[:digit:]]" go.mod | awk '{print $2}') \
&& dnf install golang-1.21.7 git -y && go version \
Copy link
Contributor

Choose a reason for hiding this comment

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

Why extract GO_VERSION if we always install 1.21.7?

Copy link
Member Author

Choose a reason for hiding this comment

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

that was for testing :(

Copy link
Member Author

Choose a reason for hiding this comment

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

The idea of using the patch version in go.mod isn't supported in Golang v1.20 and below, so I will introduce it in #133

@razo7 razo7 force-pushed the set-go-version-dockerfile branch from 3c785ea to a324327 Compare March 15, 2024 05:51
Redundant step, and Golang desired version will be installed afterward from official page
@razo7
Copy link
Member Author

razo7 commented Mar 15, 2024

/test 4.15-openshift-e2e

Copy link
Contributor

openshift-ci bot commented Mar 15, 2024

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: razo7, slintes

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

@razo7 razo7 marked this pull request as ready for review March 15, 2024 15:52
@openshift-ci openshift-ci bot requested review from beekhof and mshitrit March 15, 2024 15:52
@openshift-merge-bot openshift-merge-bot bot merged commit eae3de2 into medik8s:main Mar 15, 2024
18 checks passed
@razo7
Copy link
Member Author

razo7 commented Mar 17, 2024

/cherry-pick release-0.3

@openshift-cherrypick-robot

@razo7: new pull request created: #134

In response to this:

/cherry-pick release-0.3

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.

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.

4 participants