Skip to content

Commit

Permalink
fix(ci): operator release fails with "chart not found" (#1056)
Browse files Browse the repository at this point in the history
* fix(ci): operator release fails with "chart not found"

* f

* f
  • Loading branch information
emosbaugh authored Aug 29, 2024
1 parent d842047 commit 39eb313
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/release-prod.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
2 changes: 1 addition & 1 deletion operator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
21 changes: 17 additions & 4 deletions scripts/cache-files.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
19 changes: 16 additions & 3 deletions scripts/create-previous-k0s-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ 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

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
Expand All @@ -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
Expand Down
19 changes: 16 additions & 3 deletions scripts/create-upgrade-release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,20 @@ 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

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
Expand All @@ -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
Expand Down

0 comments on commit 39eb313

Please sign in to comment.