diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 23645e42e..1c31cb10d 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -251,7 +251,7 @@ jobs: AWS_REGION: "us-east-1" run: | export SHORT_SHA=dev-${{ needs.git-sha.outputs.git_sha }} - export EC_VERSION="v${SHORT_SHA}" + export EC_VERSION="${SHORT_SHA}" export OPERATOR_IMAGE=proxy.replicated.com/anonymous/${{ needs.build-operator.outputs.operator-image }} export OPERATOR_VERSION=${{ needs.build-operator.outputs.operator-version }} diff --git a/.github/workflows/release-prod.yaml b/.github/workflows/release-prod.yaml index 05d278b9f..ff65fd33b 100644 --- a/.github/workflows/release-prod.yaml +++ b/.github/workflows/release-prod.yaml @@ -94,7 +94,6 @@ jobs: HELM_USER: ${{secrets.REPLICATED_LIBRARY_SERVICE_ACCOUNT}} HELM_PASS: ${{secrets.REPLICATED_LIBRARY_SERVICE_ACCOUNT}} HELM_REGISTRY: registry.replicated.com - CHART_VERSION: ${{needs.get-tag.outputs.tag-name}} run: | make -C operator build-chart \ PACKAGE_VERSION=${{ needs.get-tag.outputs.tag-name }} diff --git a/operator/Makefile b/operator/Makefile index e3c96b509..712d33b09 100644 --- a/operator/Makefile +++ b/operator/Makefile @@ -139,7 +139,7 @@ export IMAGE_NAME ?= $(IMAGE_NAMESPACE)/embedded-cluster-operator-image export IMAGE_TAG ?= $(shell echo "$(PACKAGE_VERSION)" | sed 's/+/-/') export IMAGE ?= $(IMAGE_NAME):$(IMAGE_TAG) export CHART_REMOTE ?= oci://registry.replicated.com/library -export CHART_VERSION ?= $(PACKAGE_VERSION) +export CHART_VERSION ?= $(shell echo "$(PACKAGE_VERSION)" | sed 's/^v//') export MELANGE_CONFIG := deploy/melange.tmpl.yaml diff --git a/scripts/cache-files.sh b/scripts/cache-files.sh index 3e12db4c3..c3b539096 100755 --- a/scripts/cache-files.sh +++ b/scripts/cache-files.sh @@ -115,10 +115,16 @@ function metadata() { return 0 fi + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # check if a file 'metadata.json' exists in the directory - # if it does, upload it as metadata/${ec_version}.json + # if it does, upload it as metadata/${version}.json if [ -f metadata.json ]; then - retry 3 aws s3 cp --no-progress metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json" + retry 3 aws s3 cp --no-progress metadata.json "s3://${S3_BUCKET}/metadata/${version}.json" else echo "metadata.json not found, skipping upload" fi @@ -130,10 +136,17 @@ function embeddedcluster() { echo "EC_VERSION unset, not uploading embedded cluster release" return 0 fi + + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # check if a file 'embedded-cluster-linux-amd64.tgz' exists in the directory - # if it does, upload it as releases/${ec_version}.tgz + # if it does, upload it as releases/${version}.tgz if [ -f embedded-cluster-linux-amd64.tgz ]; then - retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz" + retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${version}.tgz" else echo "embedded-cluster-linux-amd64.tgz not found, skipping upload" fi diff --git a/scripts/create-previous-k0s-release.sh b/scripts/create-previous-k0s-release.sh index 3a1b19fb0..504bede64 100755 --- a/scripts/create-previous-k0s-release.sh +++ b/scripts/create-previous-k0s-release.sh @@ -40,6 +40,12 @@ function metadata() { return 0 fi + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # mutate the metadata-previous-k0s.json to create a suitable upgrade if [ -f metadata-previous-k0s.json ]; then sudo apt-get install jq -y @@ -47,7 +53,7 @@ function metadata() { jq '(.Configs.charts[] | select(.name == "embedded-cluster-operator")).values += "resources:\n requests:\n cpu: 123m"' metadata-previous-k0s.json > install-metadata.json cat install-metadata.json - retry 3 aws s3 cp --no-progress install-metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json" + retry 3 aws s3 cp --no-progress install-metadata.json "s3://${S3_BUCKET}/metadata/${version}.json" else echo "metadata-previous-k0s.json not found, skipping upload" fi @@ -59,10 +65,17 @@ function embeddedcluster() { echo "EC_VERSION unset, not uploading embedded cluster release" return 0 fi + + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # check if a file 'embedded-cluster-linux-amd64-previous-k0s.tgz' exists in the directory - # if it does, upload it as releases/${ec_version}.tgz + # if it does, upload it as releases/${version}.tgz if [ -f embedded-cluster-linux-amd64-previous-k0s.tgz ]; then - retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64-previous-k0s.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz" + retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64-previous-k0s.tgz "s3://${S3_BUCKET}/releases/${version}.tgz" else echo "embedded-cluster-linux-amd64-previous-k0s.tgz not found, skipping upload" fi diff --git a/scripts/create-upgrade-release.sh b/scripts/create-upgrade-release.sh index 72d9a6ddd..f00ae1da6 100755 --- a/scripts/create-upgrade-release.sh +++ b/scripts/create-upgrade-release.sh @@ -40,6 +40,12 @@ function metadata() { return 0 fi + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # mutate the metadata.json to create a suitable upgrade if [ -f metadata.json ]; then sudo apt-get install jq -y @@ -47,7 +53,7 @@ function metadata() { jq '(.Configs.charts[] | select(.name == "embedded-cluster-operator")).values += "resources:\n requests:\n cpu: 123m"' metadata-upgrade.json > upgrade-metadata.json cat upgrade-metadata.json - retry 3 aws s3 cp --no-progress upgrade-metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json" + retry 3 aws s3 cp --no-progress upgrade-metadata.json "s3://${S3_BUCKET}/metadata/${version}.json" else echo "metadata.json not found, skipping upload" fi @@ -59,10 +65,17 @@ function embeddedcluster() { echo "EC_VERSION unset, not uploading embedded cluster release" return 0 fi + + # append a 'v' prefix to the version if it doesn't already have one + local version="$EC_VERSION" + if ! echo "$version" | grep -q "^v"; then + version="v$version" + fi + # check if a file 'embedded-cluster-linux-amd64.tgz' exists in the directory - # if it does, upload it as releases/${ec_version}.tgz + # if it does, upload it as releases/${version}.tgz if [ -f embedded-cluster-linux-amd64.tgz ]; then - retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz" + retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${version}.tgz" else echo "embedded-cluster-linux-amd64.tgz not found, skipping upload" fi