Skip to content

Commit 39eb313

Browse files
authored
fix(ci): operator release fails with "chart not found" (#1056)
* fix(ci): operator release fails with "chart not found" * f * f
1 parent d842047 commit 39eb313

File tree

6 files changed

+51
-13
lines changed

6 files changed

+51
-13
lines changed

.github/workflows/ci.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -251,7 +251,7 @@ jobs:
251251
AWS_REGION: "us-east-1"
252252
run: |
253253
export SHORT_SHA=dev-${{ needs.git-sha.outputs.git_sha }}
254-
export EC_VERSION="v${SHORT_SHA}"
254+
export EC_VERSION="${SHORT_SHA}"
255255
export OPERATOR_IMAGE=proxy.replicated.com/anonymous/${{ needs.build-operator.outputs.operator-image }}
256256
export OPERATOR_VERSION=${{ needs.build-operator.outputs.operator-version }}
257257

.github/workflows/release-prod.yaml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,6 @@ jobs:
9494
HELM_USER: ${{secrets.REPLICATED_LIBRARY_SERVICE_ACCOUNT}}
9595
HELM_PASS: ${{secrets.REPLICATED_LIBRARY_SERVICE_ACCOUNT}}
9696
HELM_REGISTRY: registry.replicated.com
97-
CHART_VERSION: ${{needs.get-tag.outputs.tag-name}}
9897
run: |
9998
make -C operator build-chart \
10099
PACKAGE_VERSION=${{ needs.get-tag.outputs.tag-name }}

operator/Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ export IMAGE_NAME ?= $(IMAGE_NAMESPACE)/embedded-cluster-operator-image
139139
export IMAGE_TAG ?= $(shell echo "$(PACKAGE_VERSION)" | sed 's/+/-/')
140140
export IMAGE ?= $(IMAGE_NAME):$(IMAGE_TAG)
141141
export CHART_REMOTE ?= oci://registry.replicated.com/library
142-
export CHART_VERSION ?= $(PACKAGE_VERSION)
142+
export CHART_VERSION ?= $(shell echo "$(PACKAGE_VERSION)" | sed 's/^v//')
143143

144144
export MELANGE_CONFIG := deploy/melange.tmpl.yaml
145145

scripts/cache-files.sh

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -115,10 +115,16 @@ function metadata() {
115115
return 0
116116
fi
117117

118+
# append a 'v' prefix to the version if it doesn't already have one
119+
local version="$EC_VERSION"
120+
if ! echo "$version" | grep -q "^v"; then
121+
version="v$version"
122+
fi
123+
118124
# check if a file 'metadata.json' exists in the directory
119-
# if it does, upload it as metadata/${ec_version}.json
125+
# if it does, upload it as metadata/${version}.json
120126
if [ -f metadata.json ]; then
121-
retry 3 aws s3 cp --no-progress metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json"
127+
retry 3 aws s3 cp --no-progress metadata.json "s3://${S3_BUCKET}/metadata/${version}.json"
122128
else
123129
echo "metadata.json not found, skipping upload"
124130
fi
@@ -130,10 +136,17 @@ function embeddedcluster() {
130136
echo "EC_VERSION unset, not uploading embedded cluster release"
131137
return 0
132138
fi
139+
140+
# append a 'v' prefix to the version if it doesn't already have one
141+
local version="$EC_VERSION"
142+
if ! echo "$version" | grep -q "^v"; then
143+
version="v$version"
144+
fi
145+
133146
# check if a file 'embedded-cluster-linux-amd64.tgz' exists in the directory
134-
# if it does, upload it as releases/${ec_version}.tgz
147+
# if it does, upload it as releases/${version}.tgz
135148
if [ -f embedded-cluster-linux-amd64.tgz ]; then
136-
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz"
149+
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${version}.tgz"
137150
else
138151
echo "embedded-cluster-linux-amd64.tgz not found, skipping upload"
139152
fi

scripts/create-previous-k0s-release.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ function metadata() {
4040
return 0
4141
fi
4242

43+
# append a 'v' prefix to the version if it doesn't already have one
44+
local version="$EC_VERSION"
45+
if ! echo "$version" | grep -q "^v"; then
46+
version="v$version"
47+
fi
48+
4349
# mutate the metadata-previous-k0s.json to create a suitable upgrade
4450
if [ -f metadata-previous-k0s.json ]; then
4551
sudo apt-get install jq -y
4652

4753
jq '(.Configs.charts[] | select(.name == "embedded-cluster-operator")).values += "resources:\n requests:\n cpu: 123m"' metadata-previous-k0s.json > install-metadata.json
4854
cat install-metadata.json
4955

50-
retry 3 aws s3 cp --no-progress install-metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json"
56+
retry 3 aws s3 cp --no-progress install-metadata.json "s3://${S3_BUCKET}/metadata/${version}.json"
5157
else
5258
echo "metadata-previous-k0s.json not found, skipping upload"
5359
fi
@@ -59,10 +65,17 @@ function embeddedcluster() {
5965
echo "EC_VERSION unset, not uploading embedded cluster release"
6066
return 0
6167
fi
68+
69+
# append a 'v' prefix to the version if it doesn't already have one
70+
local version="$EC_VERSION"
71+
if ! echo "$version" | grep -q "^v"; then
72+
version="v$version"
73+
fi
74+
6275
# check if a file 'embedded-cluster-linux-amd64-previous-k0s.tgz' exists in the directory
63-
# if it does, upload it as releases/${ec_version}.tgz
76+
# if it does, upload it as releases/${version}.tgz
6477
if [ -f embedded-cluster-linux-amd64-previous-k0s.tgz ]; then
65-
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64-previous-k0s.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz"
78+
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64-previous-k0s.tgz "s3://${S3_BUCKET}/releases/${version}.tgz"
6679
else
6780
echo "embedded-cluster-linux-amd64-previous-k0s.tgz not found, skipping upload"
6881
fi

scripts/create-upgrade-release.sh

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,20 @@ function metadata() {
4040
return 0
4141
fi
4242

43+
# append a 'v' prefix to the version if it doesn't already have one
44+
local version="$EC_VERSION"
45+
if ! echo "$version" | grep -q "^v"; then
46+
version="v$version"
47+
fi
48+
4349
# mutate the metadata.json to create a suitable upgrade
4450
if [ -f metadata.json ]; then
4551
sudo apt-get install jq -y
4652

4753
jq '(.Configs.charts[] | select(.name == "embedded-cluster-operator")).values += "resources:\n requests:\n cpu: 123m"' metadata-upgrade.json > upgrade-metadata.json
4854
cat upgrade-metadata.json
4955

50-
retry 3 aws s3 cp --no-progress upgrade-metadata.json "s3://${S3_BUCKET}/metadata/${EC_VERSION}.json"
56+
retry 3 aws s3 cp --no-progress upgrade-metadata.json "s3://${S3_BUCKET}/metadata/${version}.json"
5157
else
5258
echo "metadata.json not found, skipping upload"
5359
fi
@@ -59,10 +65,17 @@ function embeddedcluster() {
5965
echo "EC_VERSION unset, not uploading embedded cluster release"
6066
return 0
6167
fi
68+
69+
# append a 'v' prefix to the version if it doesn't already have one
70+
local version="$EC_VERSION"
71+
if ! echo "$version" | grep -q "^v"; then
72+
version="v$version"
73+
fi
74+
6275
# check if a file 'embedded-cluster-linux-amd64.tgz' exists in the directory
63-
# if it does, upload it as releases/${ec_version}.tgz
76+
# if it does, upload it as releases/${version}.tgz
6477
if [ -f embedded-cluster-linux-amd64.tgz ]; then
65-
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${EC_VERSION}.tgz"
78+
retry 3 aws s3 cp --no-progress embedded-cluster-linux-amd64.tgz "s3://${S3_BUCKET}/releases/${version}.tgz"
6679
else
6780
echo "embedded-cluster-linux-amd64.tgz not found, skipping upload"
6881
fi

0 commit comments

Comments
 (0)