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

Fix prefix of bucket #702

Merged
merged 1 commit into from
Jul 4, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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