Skip to content

Commit

Permalink
Merge pull request #33700 from hairyhum/external-snapshot-metadata-br…
Browse files Browse the repository at this point in the history
…anch

Use correct main branch in image publishing of external-snapshot-metadata
  • Loading branch information
k8s-ci-robot authored Oct 31, 2024
2 parents 25a99d8 + 458ce4b commit ecddd0e
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 8 deletions.
30 changes: 26 additions & 4 deletions config/jobs/image-pushing/k8s-staging-sig-storage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -41,19 +41,37 @@ readonly REPOS=(
kubernetes-sigs/container-object-storage-interface-provisioner-sidecar
)

# Repos using "main" branch instead of "master" as default
readonly REPOS_MAIN_BRANCH=(
kubernetes-csi/external-snapshot-metadata
)

# Repos which should eventually enable cloud image builds but currently
# don't.
readonly BROKEN_REPOS=(
kubernetes-csi/csi-proxy
)

using_main_branch() {
for repo_main in "${REPOS_MAIN_BRANCH[@]}"; do
if [[ ${repo_main} == ${1} ]]; then
return 0
fi
done
return 1
}

cat >"${OUTPUT}" <<EOF
# Automatically generated by k8s-staging-sig-storage-gen.sh.
postsubmits:
EOF

for repo in "${REPOS[@]}" "${BROKEN_REPOS[@]}"; do
default_branch="master"
if using_main_branch ${repo}; then
default_branch="main"
fi
IFS=/ read -r org repo <<<"${repo}"
cat >>"${OUTPUT}" <<EOF
${org}/${repo}:
Expand All @@ -75,7 +93,7 @@ for repo in "${REPOS[@]}" "${BROKEN_REPOS[@]}"; do
grace_period: 15m
branches:
# For publishing canary images.
- ^master$
- ^${default_branch}$
- ^release-
# For publishing tagged images. Those will only get built once, i.e.
# existing images are not getting overwritten. A new tag must be set to
Expand Down Expand Up @@ -107,13 +125,17 @@ cat >>"${OUTPUT}" <<EOF
# them periodically. One additional benefit is that build errors show up
# in the sig-storage-image-build *before* tagging a release.
#
# Periodic jobs are currently only specified for the "master" branch
# Periodic jobs are currently only specified for the default branch
# which produces the "canary" images. While other branches
# could produce release-x.y-canary images, we don't use those.
periodics:
EOF

for repo in "${REPOS[@]}"; do
default_branch="master"
if using_main_branch ${repo}; then
default_branch="main"
fi
IFS=/ read -r org repo <<<"${repo}"
cat >>"${OUTPUT}" <<EOF
- name: canary-${repo}-push-images
Expand All @@ -127,7 +149,7 @@ cat >>"${OUTPUT}" <<EOF
# the cloud image build.
- org: ${org}
repo: ${repo}
base_ref: master
base_ref: ${default_branch}
spec:
serviceAccountName: gcb-builder
containers:
Expand All @@ -138,7 +160,7 @@ cat >>"${OUTPUT}" <<EOF
# We need to emulate a pull job for the cloud build to work the same
# way as it usually does.
- name: PULL_BASE_REF
value: master
value: ${default_branch}
args:
# this is the project GCB will run in, which is the same as the GCR
# images are pushed to.
Expand Down
8 changes: 4 additions & 4 deletions config/jobs/image-pushing/k8s-staging-sig-storage.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -340,7 +340,7 @@ postsubmits:
grace_period: 15m
branches:
# For publishing canary images.
- ^master$
- ^main$
- ^release-
# For publishing tagged images. Those will only get built once, i.e.
# existing images are not getting overwritten. A new tag must be set to
Expand Down Expand Up @@ -848,7 +848,7 @@ postsubmits:
# them periodically. One additional benefit is that build errors show up
# in the sig-storage-image-build *before* tagging a release.
#
# Periodic jobs are currently only specified for the "master" branch
# Periodic jobs are currently only specified for the default branch
# which produces the "canary" images. While other branches
# could produce release-x.y-canary images, we don't use those.
periodics:
Expand Down Expand Up @@ -1111,7 +1111,7 @@ periodics:
# the cloud image build.
- org: kubernetes-csi
repo: external-snapshot-metadata
base_ref: master
base_ref: main
spec:
serviceAccountName: gcb-builder
containers:
Expand All @@ -1122,7 +1122,7 @@ periodics:
# We need to emulate a pull job for the cloud build to work the same
# way as it usually does.
- name: PULL_BASE_REF
value: master
value: main
args:
# this is the project GCB will run in, which is the same as the GCR
# images are pushed to.
Expand Down

0 comments on commit ecddd0e

Please sign in to comment.