Skip to content

Commit

Permalink
Merge pull request #702 from wzshiming/ci/prefix-bucket
Browse files Browse the repository at this point in the history
Fix prefix of bucket
  • Loading branch information
wzshiming authored Jul 4, 2023
2 parents 71dc497 + bcebb00 commit beff3a0
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 3 deletions.
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,7 @@ manifests:
--gh-release=${GH_RELEASE} \
--image-prefix=${IMAGE_PREFIX} \
--version=${VERSION} \
--staging-prefix=${STAGING_PREFIX} \
--dry-run=${DRY_RUN} \
--push=${PUSH}

Expand Down
12 changes: 11 additions & 1 deletion hack/manifests.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ BUCKET=""
GH_RELEASE=""
IMAGE_PREFIX="${DEFAULT_IMAGE_PREFIX}"
VERSION=""
STAGING_PREFIX=""
DRY_RUN=false
PUSH=false
KUSTOMIZES=()
Expand All @@ -33,6 +34,7 @@ function usage() {
echo " --gh-release <gh-release> is github release"
echo " --image-prefix <image-prefix> is kwok image prefix"
echo " --version <version> is version of binary"
echo " --staging-prefix <staging-prefix> is staging prefix for bucket"
echo " --push will push binary to bucket"
echo " --dry-run just show what would be done"
}
Expand Down Expand Up @@ -62,6 +64,10 @@ function args() {
[[ "${arg#*=}" != "${arg}" ]] && VERSION="${arg#*=}" || { VERSION="${2}" && shift; } || :
shift
;;
--staging-prefix | --staging-prefix=*)
[[ "${arg#*=}" != "${arg}" ]] && STAGING_PREFIX="${arg#*=}" || { STAGING_PREFIX="${2}" && shift; } || :
shift
;;
--push | --push=*)
[[ "${arg#*=}" != "${arg}" ]] && PUSH="${arg#*=}" || PUSH="true" || :
shift
Expand Down Expand Up @@ -107,7 +113,11 @@ function main() {
dry_run rm -r "./artifacts/kustomize"
if [[ "${PUSH}" == "true" ]]; then
if [[ "${BUCKET}" != "" ]]; then
dry_run gsutil cp -P "./artifacts/${kustomize}.yaml" "${BUCKET}/releases/${VERSION}/manifests/${kustomize}.yaml"
prefix="${BUCKET}/releases/"
if [[ "${STAGING_PREFIX}" != "" ]]; then
prefix="${BUCKET}/releases/${STAGING_PREFIX}-"
fi
dry_run gsutil cp -P "./artifacts/${kustomize}.yaml" "${prefix}${VERSION}/manifests/${kustomize}.yaml"
fi
if [[ "${GH_RELEASE}" != "" ]]; then
dry_run gh -R "${GH_RELEASE}" release upload "${VERSION}" "./artifacts/${kustomize}.yaml"
Expand Down
4 changes: 2 additions & 2 deletions test/release/build.test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ function manifests_with_push_bucket() {
echo "kustomize build . -o ../../kwok.yaml"
echo "cd -"
echo "rm -r ./artifacts/kustomize"
echo "gsutil cp -P ./artifacts/kwok.yaml bucket/releases/${VERSION}/manifests/kwok.yaml"
echo "gsutil cp -P ./artifacts/kwok.yaml bucket/releases/${PREFIX}-${VERSION}/manifests/kwok.yaml"
}

function main() {
Expand Down Expand Up @@ -515,7 +515,7 @@ function main() {

make --no-print-directory -C "${ROOT_DIR}" IMAGE_PREFIX=${IMAGE_PREFIX} manifests | diff -u <(want_manifests) - || failed+=("manifests")
make --no-print-directory -C "${ROOT_DIR}" PUSH=true GH_RELEASE=ghrelease IMAGE_PREFIX=${IMAGE_PREFIX} manifests | diff -u <(manifests_with_push_ghrelease) - || failed+=("manifests-with-push-ghrelease")
make --no-print-directory -C "${ROOT_DIR}" PUSH=true BUCKET=bucket IMAGE_PREFIX=${IMAGE_PREFIX} manifests | diff -u <(manifests_with_push_bucket) - || failed+=("manifests-with-push-bucket")
make --no-print-directory -C "${ROOT_DIR}" PUSH=true BUCKET=bucket STAGING=true STAGING_PREFIX=${PREFIX} IMAGE_PREFIX=${IMAGE_PREFIX} manifests | diff -u <(manifests_with_push_bucket) - || failed+=("manifests-with-push-bucket")

if [[ "${#failed[@]}" -ne 0 ]]; then
echo "Error: Some tests failed"
Expand Down

0 comments on commit beff3a0

Please sign in to comment.