Skip to content

Commit 2a4f053

Browse files
CecileRobertMichonk8s-infra-cherrypick-robot
authored andcommitted
Don't use job name as container name for CI binaries
1 parent 80106bb commit 2a4f053

12 files changed

+32
-36
lines changed

docs/book/src/developers/development.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -548,7 +548,6 @@ With the following environment variables defined, CAPZ runs `./scripts/ci-build-
548548
| ------------------------- | ------------------------------------------------------------------------ |
549549
| `AZURE_STORAGE_ACCOUNT` | Your Azure storage account name |
550550
| `AZURE_STORAGE_KEY` | Your Azure storage key |
551-
| `JOB_NAME` | `test` (an environment variable used by CI, can be any non-empty string) |
552551
| `USE_LOCAL_KIND_REGISTRY` | `false` |
553552
| `REGISTRY` | Your Registry |
554553
| `TEST_K8S` | `true` |

docs/book/src/developers/kubernetes-developers.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ export AZURE_STORAGE_ACCOUNT=<AzureStorageAccount>
2121
export AZURE_STORAGE_KEY=<AzureStorageKey>
2222
export REGISTRY=<Registry>
2323
export TEST_K8S="true"
24-
export JOB_NAME="test" # an environment variable used by CI, can be any non-empty string
2524

2625
source ./scripts/ci-build-kubernetes.sh
2726
```

scripts/ci-build-azure-ccm.sh

Lines changed: 9 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,6 @@ source "${REPO_ROOT}/hack/parse-prow-creds.sh"
3030

3131
: "${AZURE_STORAGE_ACCOUNT:?Environment variable empty or not defined.}"
3232
: "${AZURE_STORAGE_KEY:?Environment variable empty or not defined.}"
33-
# JOB_NAME is an environment variable set by a prow job -
34-
# https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md#job-environment-variables
35-
: "${JOB_NAME:?Environment variable empty or not defined.}"
3633
: "${REGISTRY:?Environment variable empty or not defined.}"
3734

3835
# cloud controller manager image
@@ -41,6 +38,8 @@ export CCM_IMAGE_NAME=azure-cloud-controller-manager
4138
export CNM_IMAGE_NAME=azure-cloud-node-manager
4239
# cloud node manager windows image version
4340
export WINDOWS_IMAGE_VERSION=1809
41+
# container name
42+
export AZURE_BLOB_CONTAINER_NAME="${AZURE_BLOB_CONTAINER_NAME:-"kubernetes-ci"}"
4443

4544
setup() {
4645
AZURE_CLOUD_PROVIDER_ROOT="${AZURE_CLOUD_PROVIDER_ROOT:-""}"
@@ -85,14 +84,14 @@ main() {
8584
echo "Building and pushing Linux and Windows amd64 Azure ACR credential provider"
8685
make -C "${AZURE_CLOUD_PROVIDER_ROOT}" bin/azure-acr-credential-provider bin/azure-acr-credential-provider.exe
8786

88-
if [[ "$(az storage container exists --name "${JOB_NAME}" --query exists --output tsv)" == "false" ]]; then
89-
echo "Creating ${JOB_NAME} storage container"
90-
az storage container create --name "${JOB_NAME}" > /dev/null
91-
az storage container set-permission --name "${JOB_NAME}" --public-access container > /dev/null
87+
if [[ "$(az storage container exists --name "${AZURE_BLOB_CONTAINER_NAME}" --query exists --output tsv)" == "false" ]]; then
88+
echo "Creating ${AZURE_BLOB_CONTAINER_NAME} storage container"
89+
az storage container create --name "${AZURE_BLOB_CONTAINER_NAME}" > /dev/null
90+
az storage container set-permission --name "${AZURE_BLOB_CONTAINER_NAME}" --public-access container > /dev/null
9291
fi
9392

94-
az storage blob upload --overwrite --container-name "${JOB_NAME}" --file "${AZURE_CLOUD_PROVIDER_ROOT}/bin/azure-acr-credential-provider" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider"
95-
az storage blob upload --overwrite --container-name "${JOB_NAME}" --file "${AZURE_CLOUD_PROVIDER_ROOT}/bin/azure-acr-credential-provider.exe" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider.exe"
93+
az storage blob upload --overwrite --container-name "${AZURE_BLOB_CONTAINER_NAME}" --file "${AZURE_CLOUD_PROVIDER_ROOT}/bin/azure-acr-credential-provider" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider"
94+
az storage blob upload --overwrite --container-name "${AZURE_BLOB_CONTAINER_NAME}" --file "${AZURE_CLOUD_PROVIDER_ROOT}/bin/azure-acr-credential-provider.exe" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/azure-acr-credential-provider.exe"
9695
fi
9796
fi
9897
}
@@ -113,7 +112,7 @@ can_reuse_artifacts() {
113112

114113
if [[ "${TEST_ACR_CREDENTIAL_PROVIDER:-}" =~ "true" ]]; then
115114
for BINARY in azure-acr-credential-provider azure-acr-credential-provider.exe; do
116-
if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/${BINARY}" --query exists --output tsv)" == "false" ]]; then
115+
if [[ "$(az storage blob exists --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${IMAGE_TAG_ACR_CREDENTIAL_PROVIDER}/${BINARY}" --query exists --output tsv)" == "false" ]]; then
117116
echo "false" && return
118117
fi
119118
done

scripts/ci-build-kubernetes.sh

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -35,9 +35,6 @@ source "${REPO_ROOT}/hack/util.sh"
3535
: "${AZURE_STORAGE_ACCOUNT:?Environment variable empty or not defined.}"
3636
: "${AZURE_STORAGE_KEY:?Environment variable empty or not defined.}"
3737
: "${REGISTRY:?Environment variable empty or not defined.}"
38-
# JOB_NAME is an environment variable set by a prow job -
39-
# https://github.com/kubernetes/test-infra/blob/master/prow/jobs.md#job-environment-variables
40-
: "${JOB_NAME:?Environment variable empty or not defined.}"
4138

4239
declare -a BINARIES=("kubeadm" "kubectl" "kubelet" "e2e.test")
4340
declare -a WINDOWS_BINARIES=("kubeadm" "kubectl" "kubelet" "kube-proxy")
@@ -78,13 +75,15 @@ setup() {
7875
# ref: https://github.com/kubernetes/kubernetes/blob/5491484aa91fd09a01a68042e7674bc24d42687a/build/lib/release.sh#L345-L346
7976
export KUBE_IMAGE_TAG="${KUBE_GIT_VERSION/+/_}"
8077
echo "using K8s KUBE_IMAGE_TAG=${KUBE_IMAGE_TAG}"
78+
79+
export AZURE_BLOB_CONTAINER_NAME="${AZURE_BLOB_CONTAINER_NAME:-"kubernetes-ci"}"
8180
}
8281

8382
main() {
84-
if [[ "$(az storage container exists --name "${JOB_NAME}" --query exists --output tsv)" == "false" ]]; then
85-
echo "Creating ${JOB_NAME} storage container"
86-
az storage container create --name "${JOB_NAME}" > /dev/null
87-
az storage container set-permission --name "${JOB_NAME}" --public-access container > /dev/null
83+
if [[ "$(az storage container exists --name "${AZURE_BLOB_CONTAINER_NAME}" --query exists --output tsv)" == "false" ]]; then
84+
echo "Creating ${AZURE_BLOB_CONTAINER_NAME} storage container"
85+
az storage container create --name "${AZURE_BLOB_CONTAINER_NAME}" > /dev/null
86+
az storage container set-permission --name "${AZURE_BLOB_CONTAINER_NAME}" --public-access container > /dev/null
8887
fi
8988

9089
if [[ "${KUBE_BUILD_CONFORMANCE:-}" =~ [yY] ]]; then
@@ -112,12 +111,12 @@ main() {
112111
docker tag "${OLD_IMAGE_URL}" "${NEW_IMAGE_URL}" && docker push "${NEW_IMAGE_URL}"
113112
done
114113

115-
echo "Uploading binaries to Azure storage container ${JOB_NAME}"
114+
echo "Uploading binaries to Azure storage container ${AZURE_BLOB_CONTAINER_NAME}"
116115

117116
for BINARY in "${BINARIES[@]}"; do
118117
BIN_PATH="${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}"
119118
echo "uploading ${BIN_PATH}"
120-
az storage blob upload --overwrite --container-name "${JOB_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/linux/amd64/${BINARY}" --name "${BIN_PATH}"
119+
az storage blob upload --overwrite --container-name "${AZURE_BLOB_CONTAINER_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/linux/amd64/${BINARY}" --name "${BIN_PATH}"
121120
done
122121

123122
if [[ "${TEST_WINDOWS:-}" == "true" ]]; then
@@ -130,7 +129,7 @@ main() {
130129
for BINARY in "${WINDOWS_BINARIES[@]}"; do
131130
BIN_PATH="${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe"
132131
echo "uploading ${BIN_PATH}"
133-
az storage blob upload --overwrite --container-name "${JOB_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/windows/amd64/${BINARY}.exe" --name "${BIN_PATH}"
132+
az storage blob upload --overwrite --container-name "${AZURE_BLOB_CONTAINER_NAME}" --file "${KUBE_ROOT}/_output/dockerized/bin/windows/amd64/${BINARY}.exe" --name "${BIN_PATH}"
134133
done
135134
fi
136135
fi
@@ -145,14 +144,14 @@ can_reuse_artifacts() {
145144
done
146145

147146
for BINARY in "${BINARIES[@]}"; do
148-
if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" --query exists --output tsv)" == "false" ]]; then
147+
if [[ "$(az storage blob exists --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${KUBE_GIT_VERSION}/bin/linux/amd64/${BINARY}" --query exists --output tsv)" == "false" ]]; then
149148
echo "false" && return
150149
fi
151150
done
152151

153152
if [[ "${TEST_WINDOWS:-}" == "true" ]]; then
154153
for BINARY in "${WINDOWS_BINARIES[@]}"; do
155-
if [[ "$(az storage blob exists --container-name "${JOB_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists --output tsv)" == "false" ]]; then
154+
if [[ "$(az storage blob exists --container-name "${AZURE_BLOB_CONTAINER_NAME}" --name "${KUBE_GIT_VERSION}/bin/windows/amd64/${BINARY}.exe" --query exists --output tsv)" == "false" ]]; then
156155
echo "false" && return
157156
fi
158157
done

templates/test/dev/cluster-template-custom-builds-machine-pool.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/dev/cluster-template-custom-builds.yaml

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

templates/test/dev/custom-builds-machine-pool/patches/custom-builds.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ spec:
2020
declare -a BINARIES=("kubeadm" "kubectl" "kubelet")
2121
for BINARY in "$${BINARIES[@]}"; do
2222
echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}"
23-
curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}"
23+
curl --retry 10 --retry-delay 5 "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_BLOB_CONTAINER_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" --output "/usr/bin/$${BINARY}"
2424
done
2525
systemctl restart kubelet
2626

templates/test/dev/custom-builds-machine-pool/patches/kubeadm-bootstrap-machine-pool-windows-k8s-pr-binaries.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
if($$KUBE_GIT_VERSION -ne "")
1111
{
1212
$$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy")
13-
$$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
13+
$$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_BLOB_CONTAINER_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
1414
foreach ( $$binary in $$binaries )
1515
{
1616
echo "downloading binary: $$ci_url/$$binary.exe"

templates/test/dev/custom-builds/patches/kubeadm-bootstrap-windows-k8s-pr-binaries.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@
2727
$env:PATH +=";C:\Program Files (x86)\Microsoft SDKs\Azure\CLI2\wbin"
2828
# Install Binaries
2929
$$binaries=@("kubeadm", "kubectl", "kubelet", "kube-proxy")
30-
$$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
30+
$$ci_url="https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_BLOB_CONTAINER_NAME}/${KUBE_GIT_VERSION}/bin/windows/amd64"
3131
echo "running az login via identity"
3232
az login --identity
3333
foreach ( $$binary in $$binaries )

templates/test/dev/custom-builds/patches/kubeadm-bootstrap.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
az login --identity
1414
for BINARY in "$${BINARIES[@]}"; do
1515
echo "* installing package: $${BINARY} ${KUBE_GIT_VERSION}"
16-
az storage blob download --blob-url "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${JOB_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" -f "/usr/bin/$${BINARY}" --auth-mode login
16+
az storage blob download --blob-url "https://${AZURE_STORAGE_ACCOUNT}.blob.core.windows.net/${AZURE_BLOB_CONTAINER_NAME}/${KUBE_GIT_VERSION}/bin/linux/amd64/$${BINARY}" -f "/usr/bin/$${BINARY}" --auth-mode login
1717
done
1818
systemctl restart kubelet
1919

0 commit comments

Comments
 (0)