Skip to content

Commit

Permalink
simplify ci-entrypoint.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
jackfrancis committed Jun 2, 2022
1 parent 0298a7d commit 563a5c6
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 12 deletions.
4 changes: 2 additions & 2 deletions docs/book/src/developers/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -552,8 +552,8 @@ You can optionally set the following variables:
| `AZURE_SSH_PUBLIC_KEY_FILE` | Use your own SSH key. |
| `SKIP_CLEANUP` | Skip deleting the cluster after the tests finish running. |
| `KUBECONFIG` | Provide your existing cluster kubeconfig filepath. If no kubeconfig is provided, `./kubeconfig` will be used. |
| `USE_CI_ARTIFACTS` | Use a CI version of Kubernetes, ie. not a released version (eg. `v1.19.0-alpha.1.426+0926c9c47677e9`) |
| `CI_VERSION` | Provide a custom CI version of Kubernetes. By default, the latest master commit will be used. |
| `KUBERNETES_VERSION` | Desired Kubernetes version to test. You can pass in a definitive released version, e.g., "v1.24.0"; or request the most recent patch release of a desired minor release by using the "stable-" prefix, e.g., "stable-1.24"; finally, you can request the most recent patch version of the newest minor release by simply using "stable". If you want to use pre-released CI bits of a particular release you may use the "latest-" prefix, e.g., "latest-1.24"; you may use the very latest built CI bits from the kubernetes/kubernetes master branch by passing in "latest".
| `CI_VERSION` | Provide a custom CI version of Kubernetes (e.g., `v1.25.0-alpha.0.597+aa49dffc7f24dc`). If not specified, this will be determined from the KUBERNETES_VERSION above if it is an unreleased version. |
| `TEST_CCM` | Build a cluster that uses custom versions of the Azure cloud-provider cloud-controller-manager and node-controller-manager images |
| `EXP_MACHINE_POOL` | Use [Machine Pool](../topics/machinepools.md) for worker machines. |
| `TEST_WINDOWS` | Build a cluster that has Windows worker nodes. |
Expand Down
17 changes: 7 additions & 10 deletions scripts/ci-entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -79,28 +79,25 @@ select_cluster_template() {
# shellcheck source=scripts/ci-build-kubernetes.sh
source "${REPO_ROOT}/scripts/ci-build-kubernetes.sh"
export CLUSTER_TEMPLATE="test/dev/cluster-template-custom-builds.yaml"
elif [[ -n "${CI_VERSION:-}" ]] || [[ -n "${USE_CI_ARTIFACTS:-}" ]] || [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]]; then
elif [[ "${KUBERNETES_VERSION:-}" =~ "latest" ]] || [[ -n "${CI_VERSION:-}" ]]; then
# export cluster template which contains the manifests needed for creating the Azure cluster to run the tests
GOPATH="$(go env GOPATH)"
if ls "${GOPATH}"/src/k8s.io/kubernetes; then
KUBERNETES_BRANCH="$(cd "${GOPATH}/src/k8s.io/kubernetes" && git rev-parse --abbrev-ref HEAD)"
fi
if [[ "${KUBERNETES_BRANCH:-}" =~ "release-" ]]; then
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
CI_VERSION_URL="https://dl.k8s.io/ci/${KUBERNETES_VERSION}.txt"
else
CI_VERSION_URL="https://dl.k8s.io/ci/latest.txt"
fi
export CLUSTER_TEMPLATE="test/ci/cluster-template-prow-ci-version.yaml"
export CI_VERSION="${CI_VERSION:-$(curl -sSL ${CI_VERSION_URL})}"
export KUBERNETES_VERSION="${CI_VERSION}"
else
export CLUSTER_TEMPLATE="test/ci/cluster-template-prow.yaml"
if [[ "${KUBERNETES_VERSION:-}" =~ "stable" ]]; then
CI_VERSION_URL="https://dl.k8s.io/release/${KUBERNETES_VERSION}.txt"
fi
fi

if [[ -n "${TEST_CCM:-}" ]]; then
# use the correct external-cloud-provider template
# replace 'prow' with 'prow-external-cloud-provider' in the template name if testing out-of-tree
export CLUSTER_TEMPLATE="${CLUSTER_TEMPLATE/prow/prow-external-cloud-provider}"
fi

Expand Down

0 comments on commit 563a5c6

Please sign in to comment.