Skip to content

Commit b405684

Browse files
committed
Add reproducible make targets for catalog and certified charts
- Add install-image-packer / install-chart-packer targets that fetch pinned binaries into bin/$(OS)_$(ARCH) - Add update-chart-dependencies, update-certified-charts, update-catalog and verify-catalog targets; wire verify-catalog into verify - Switch CI workflows to the new make targets for installing image-packer and updating chart dependencies Signed-off-by: Tamal Saha <tamal@appscode.com>
1 parent 46a85a8 commit b405684

12 files changed

Lines changed: 81 additions & 619 deletions

File tree

.github/workflows/ci.yml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,6 @@ jobs:
3535
# install kubectl
3636
curl -LO https://storage.googleapis.com/kubernetes-release/release/v1.31.0/bin/linux/amd64/kubectl
3737
chmod +x ./kubectl
38-
sudo mv ./kubectl /usr/local/bin/kubectl
3938
4039
- name: Run checks
4140
run: |

.github/workflows/cve-report.yml

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -37,11 +37,8 @@ jobs:
3737
3838
- name: Install image packer
3939
run: |
40-
cd /tmp
41-
curl -fsSL -O https://github.com/kmodules/image-packer/releases/latest/download/image-packer-linux-amd64.tar.gz
42-
tar -xvf image-packer-linux-amd64.tar.gz
43-
chmod +x image-packer-linux-amd64
44-
sudo mv image-packer-linux-amd64 /usr/local/bin/image-packer
40+
make install-image-packer
41+
echo "$(pwd)/bin/linux_amd64" >> "$GITHUB_PATH"
4542
4643
- name: Generate report
4744
run: |

.github/workflows/publish-oci.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,5 +59,5 @@ jobs:
5959
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
6060
run: |
6161
export REGISTRY_0=oci://ghcr.io/appscode-charts
62-
./hack/scripts/update-chart-dependencies.sh
62+
make update-chart-dependencies
6363
$RUNNER_WORKSPACE/$(basename $CHART_REPOSITORY)/hack/scripts/publish-oci-charts.sh $(pwd)

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,7 +53,7 @@ jobs:
5353
GITHUB_TOKEN: ${{ secrets.LGTM_GITHUB_TOKEN }}
5454
CHART_REPOSITORY: ${{ secrets.CHART_REPOSITORY }}
5555
run: |
56-
./hack/scripts/update-chart-dependencies.sh
56+
make update-chart-dependencies
5757
cd $RUNNER_WORKSPACE/$(basename $CHART_REPOSITORY)
5858
GIT_TAG=${GITHUB_REF#"refs/tags/"}
5959
if [[ $GIT_TAG =~ "-alpha." ]] || [[ $GIT_TAG =~ "-beta." ]]; then

Makefile

Lines changed: 51 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -227,6 +227,50 @@ manifests: gen-crds gen-schema patch-schema gen-chart-doc
227227
.PHONY: gen
228228
gen: codegen manifests
229229

230+
BIN_DIR ?= $(CURDIR)/bin/$(OS)_$(ARCH)
231+
232+
.PHONY: install-image-packer
233+
install-image-packer:
234+
@mkdir -p $(BIN_DIR)
235+
curl -fsSL -o $(BIN_DIR)/image-packer.tar.gz https://github.com/kmodules/image-packer/releases/latest/download/image-packer-$(OS)-$(ARCH).tar.gz
236+
tar -xzf $(BIN_DIR)/image-packer.tar.gz -C $(BIN_DIR)
237+
chmod +x $(BIN_DIR)/image-packer-$(OS)-$(ARCH)
238+
mv $(BIN_DIR)/image-packer-$(OS)-$(ARCH) $(BIN_DIR)/image-packer
239+
rm -f $(BIN_DIR)/image-packer.tar.gz
240+
241+
.PHONY: install-chart-packer
242+
install-chart-packer:
243+
@mkdir -p $(BIN_DIR)
244+
curl -fsSL -o $(BIN_DIR)/chart-packer.tar.gz https://github.com/kmodules/chart-packer/releases/latest/download/chart-packer-$(OS)-$(ARCH).tar.gz
245+
tar -xzf $(BIN_DIR)/chart-packer.tar.gz -C $(BIN_DIR)
246+
chmod +x $(BIN_DIR)/chart-packer-$(OS)-$(ARCH)
247+
mv $(BIN_DIR)/chart-packer-$(OS)-$(ARCH) $(BIN_DIR)/chart-packer
248+
rm -f $(BIN_DIR)/chart-packer.tar.gz
249+
250+
.PHONY: update-chart-dependencies
251+
update-chart-dependencies:
252+
./hack/scripts/update-chart-dependencies.sh
253+
254+
.PHONY: update-certified-charts
255+
update-certified-charts: update-chart-dependencies install-chart-packer
256+
rm -rf charts/ace-installer-certified charts/ace-installer-certified-crds
257+
PATH="$(BIN_DIR):$$PATH" chart-packer crd-less --input charts/ace-installer --output charts
258+
PATH="$(BIN_DIR):$$PATH" chart-packer crd-only --input charts/ace-installer --output charts
259+
@$(MAKE) gen-chart-doc --no-print-directory
260+
helm dependency update charts/ace-installer-certified
261+
@# Revert Chart.lock if the only change is the `generated:` timestamp line
262+
@if ! git diff --quiet -- charts/ace-installer-certified/Chart.lock; then \
263+
changed=$$(git diff -U0 -- charts/ace-installer-certified/Chart.lock | grep -E '^[+-]' | grep -vE '^(\+\+\+|---)' | grep -vE '^[+-]generated:'); \
264+
if [ -z "$$changed" ]; then \
265+
echo "Reverting charts/ace-installer-certified/Chart.lock (only generated: timestamp changed)"; \
266+
git checkout -- charts/ace-installer-certified/Chart.lock; \
267+
fi; \
268+
fi
269+
270+
.PHONY: update-catalog
271+
update-catalog: update-certified-charts install-image-packer
272+
PATH="$(BIN_DIR):$$PATH" ./hack/scripts/update-catalog.sh
273+
230274
CHART_REGISTRY ?= appscode
231275
CHART_REGISTRY_URL ?= https://charts.appscode.com/stable/
232276
CHART_VERSION ?=
@@ -398,7 +442,7 @@ $(BUILD_DIRS):
398442
dev: gen fmt
399443

400444
.PHONY: verify
401-
verify: verify-gen verify-modules
445+
verify: verify-gen verify-modules verify-catalog
402446

403447
.PHONY: verify-modules
404448
verify-modules:
@@ -414,6 +458,12 @@ verify-gen: gen fmt
414458
echo "generated files are out of date, run make gen"; exit 1; \
415459
fi
416460

461+
.PHONY: verify-catalog
462+
verify-catalog: update-catalog
463+
@if !(git diff --exit-code HEAD); then \
464+
echo "catalog image lists are out of date, run ./hack/scripts/update-catalog.sh"; exit 1; \
465+
fi
466+
417467
.PHONY: add-license
418468
add-license:
419469
@echo "Adding license header"

0 commit comments

Comments
 (0)