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

simplify ci-entrypoint.sh #2325

Merged

Conversation

jackfrancis
Copy link
Contributor

@jackfrancis jackfrancis commented May 23, 2022

What type of PR is this?

/kind cleanup

What this PR does / why we need it:

This PR removes the USE_CI_ARTIFACTS option (by convention USE_CI_ARTIFACTS=true is supported; any non-zero value to USE_CI_ARTIFACTS effectively means boolean true) as the existing KUBERNETES_VERSION=latest interface provides the same functionality with more semantic expressiveness.

Additionally, we remove the inferential check to see if k/k is in the GOPATH, and to use the checked out sha as the KUBERNETES_VERSION. Going forward we will require usages of ci-entrypoint.sh to declare the desired version of Kubernetes to build via the KUBERNETES_VERSION environment variable (this is already the practice in the vast majority of test-infra jobs).

This test-infra PR needs to merge first so that we are sure we remove any automated usages of the deprecated config interface!:

kubernetes/test-infra#26397

Finally, we add support for using the "stable" prefix to automatically gather the latest patch release. Using 1.23 as an example, "stable-1.23" will yield "v1.23.7" at the time of this writing. Simply using "stable" yields "v1.24.1" at the time of this writing.

Which issue(s) this PR fixes (optional, in fixes #<issue number>(, fixes #<issue_number>, ...) format, will close the issue(s) when PR gets merged):
Fixes #

Special notes for your reviewer:

Please confirm that if this PR changes any image versions, then that's the sole change this PR makes.

TODOs:

  • squashed commits
  • includes documentation
  • adds unit tests

Release note:

NONE

@k8s-ci-robot k8s-ci-robot added kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. size/S Denotes a PR that changes 10-29 lines, ignoring generated files. release-note-none Denotes a PR that doesn't merit a release note. and removed do-not-merge/release-note-label-needed Indicates that a PR should not merge because it's missing one of the release note labels. labels May 23, 2022
@jackfrancis
Copy link
Contributor Author

/hold until kubernetes/test-infra#26397 merges

@k8s-ci-robot k8s-ci-robot added the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label May 23, 2022
@marosset
Copy link
Contributor

I think that specifying KUBERNETES_VERSION as anything with 'latest' will not work for Windows.

That would cause this envsubst to container a pre-release tag and therefore not match to any of the kubeproxy images for windows that we currently maintain.

true\n containers:\n - image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION/+/_}-calico-hostprocess\n

I'll try testing this out manually by checking out from this PR branch and trying to build a cluster.

@marosset
Copy link
Contributor

I think that specifying KUBERNETES_VERSION as anything with 'latest' will not work for Windows.

That would cause this envsubst to container a pre-release tag and therefore not match to any of the kubeproxy images for windows that we currently maintain.

true\n containers:\n - image: sigwindowstools/kube-proxy:${KUBERNETES_VERSION/+/_}-calico-hostprocess\n

I'll try testing this out manually by checking out from this PR branch and trying to build a cluster.

I was mis-informed and it looks like this DOES work for Windows.
It looks like we pull an arbitrary kube-proxy image and then tag it as `sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess

ctr.exe -n k8s.io images tag docker.io/sigwindowstools/kube-proxy:v1.23.1-calico-hostprocess "docker.io/sigwindowstools/kube-proxy:${CI_VERSION/+/_}-calico-hostprocess"

@CecileRobertMichon
Copy link
Contributor

since kubernetes/test-infra#26397 already merged, is this ready to go?

CI_VERSION_URL="https://dl.k8s.io/ci/latest-${KUBERNETES_BRANCH/release-}.txt"
elif [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]]; then
export CLUSTER_TEMPLATE="test/ci/cluster-template-prow-ci-version.yaml"
if [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]]; then
Copy link
Contributor

Choose a reason for hiding this comment

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

we can add another elif here if we want to support stable versions and resolve to CI_VERSION_URL="https://dl.k8s.io/release/${KUBERNETES_VERSION}.txt

Copy link
Contributor

Choose a reason for hiding this comment

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

actually for stable- versions we don't need the ci-version template since it will just resolve to the latest released patch version, example https://storage.googleapis.com/kubernetes-release/release/stable-1.23.txt is v1.23.7 right now, so it needs to be outside the if statement that sets the template to cluster-template-prow-ci-version.yaml.

We can do this in a separate PR too.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah, you're right, see my latest change

I think this is a simple enough addition that is makes sense to incorporate it in here

@jackfrancis
Copy link
Contributor Author

I've audited tests since kubernetes/test-infra#26397 merged and I don't observe any regressions.

This PR is ready for final review/merge.

/assign @CecileRobertMichon

@jackfrancis jackfrancis force-pushed the ci-entrypoint-simplify branch from 563a5c6 to c61d331 Compare June 2, 2022 18:21
@k8s-ci-robot k8s-ci-robot added size/M Denotes a PR that changes 30-99 lines, ignoring generated files. and removed size/S Denotes a PR that changes 10-29 lines, ignoring generated files. labels Jun 2, 2022
@jackfrancis jackfrancis force-pushed the ci-entrypoint-simplify branch 2 times, most recently from 6dd6366 to 3b4561c Compare June 2, 2022 22:41
@jackfrancis jackfrancis force-pushed the ci-entrypoint-simplify branch from 3b4561c to 1ebc2c3 Compare June 3, 2022 16:03
scripts/ci-entrypoint.sh Outdated Show resolved Hide resolved
scripts/ci-entrypoint.sh Outdated Show resolved Hide resolved
@jackfrancis jackfrancis force-pushed the ci-entrypoint-simplify branch from 1ebc2c3 to 8c3ee4f Compare June 3, 2022 16:37
@jackfrancis jackfrancis force-pushed the ci-entrypoint-simplify branch from 8c3ee4f to 504593c Compare June 3, 2022 16:51
Copy link
Contributor

@CecileRobertMichon CecileRobertMichon left a comment

Choose a reason for hiding this comment

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

/lgtm

@k8s-ci-robot k8s-ci-robot added the lgtm "Looks good to me", indicates that a PR is ready to be merged. label Jun 3, 2022
@CecileRobertMichon
Copy link
Contributor

/assign @mboersma

@jackfrancis ready to remove the hold?

@mboersma
Copy link
Contributor

mboersma commented Jun 3, 2022

/lgtm
/approve

@k8s-ci-robot
Copy link
Contributor

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: mboersma

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

@k8s-ci-robot k8s-ci-robot added the approved Indicates a PR has been approved by an approver from all required OWNERS files. label Jun 3, 2022
@jackfrancis
Copy link
Contributor Author

/hold cancel

@k8s-ci-robot k8s-ci-robot removed the do-not-merge/hold Indicates that a PR should not merge because someone has issued a /hold command. label Jun 3, 2022
@k8s-ci-robot k8s-ci-robot merged commit 3849ac6 into kubernetes-sigs:main Jun 3, 2022
@k8s-ci-robot k8s-ci-robot added this to the v1.4 milestone Jun 3, 2022
@jackfrancis jackfrancis deleted the ci-entrypoint-simplify branch June 7, 2022 18:31
@jackfrancis
Copy link
Contributor Author

/cherry-pick release-1.3

@k8s-infra-cherrypick-robot

@jackfrancis: new pull request created: #2363

In response to this:

/cherry-pick release-1.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
Labels
approved Indicates a PR has been approved by an approver from all required OWNERS files. cncf-cla: yes Indicates the PR's author has signed the CNCF CLA. kind/cleanup Categorizes issue or PR as related to cleaning up code, process, or technical debt. lgtm "Looks good to me", indicates that a PR is ready to be merged. release-note-none Denotes a PR that doesn't merit a release note. size/M Denotes a PR that changes 30-99 lines, ignoring generated files.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants