Skip to content

Commit

Permalink
fix(ci): operator release fails with "chart not found"
Browse files Browse the repository at this point in the history
  • Loading branch information
emosbaugh committed Aug 29, 2024
1 parent 1dc88bf commit ce95aef
Show file tree
Hide file tree
Showing 4 changed files with 19 additions and 7 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

0 comments on commit ce95aef

Please sign in to comment.