Skip to content

Commit 06a9f8b

Browse files
Generated commit to update templated files based on rev c9d1f74 in stackabletech/operator-templating repo. (#578)
Triggered by: Manual run triggered by: razvan with message [streamline CI workflows]
1 parent a1cbdac commit 06a9f8b

File tree

4 files changed

+27
-2
lines changed

4 files changed

+27
-2
lines changed

Diff for: .envrc.sample

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# vim: syntax=conf
2+
#
3+
# If you use direnv, you can autoload the nix shell:
4+
# You will need to allow the directory the first time.
5+
use nix

Diff for: .github/workflows/build.yml

+5
Original file line numberDiff line numberDiff line change
@@ -351,15 +351,20 @@ jobs:
351351
uses: sigstore/cosign-installer@9614fae9e5c5eddabb09f90a270fcb487c9f7149 # tag=v3.3.0
352352
- name: Install syft
353353
uses: anchore/sbom-action/download-syft@24b0d5238516480139aa8bc6f92eeb7b54a9eb0a # tag=v0.15.5
354+
- name: Build Docker image and Helm chart
355+
run: make -e build
354356
- name: Publish Docker image and Helm chart
357+
if: ${{ !github.event.pull_request.head.repo.fork }}
355358
run: make -e publish
356359
# Output the name of the published image to the Job output for later use
357360
- id: printtag
358361
name: Output image name and tag
362+
if: ${{ !github.event.pull_request.head.repo.fork }}
359363
run: echo "IMAGE_TAG=$(make -e print-docker-tag)" >> $GITHUB_OUTPUT
360364

361365
openshift_preflight:
362366
name: Run the OpenShift Preflight check on the published images
367+
if: ${{ !github.event.pull_request.head.repo.fork }}
363368
needs:
364369
- package_and_publish
365370
runs-on: ubuntu-latest

Diff for: .gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -13,3 +13,7 @@ result
1313
image.tar
1414

1515
tilt_options.json
16+
17+
.direnv/
18+
.direnvrc
19+
.envrc

Diff for: Makefile

+13-2
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,18 @@ docker-publish:
4545
fi;\
4646
# This generates a signature and publishes it to the registry, next to the image\
4747
# Uses the keyless signing flow with Github Actions as identity provider\
48-
cosign sign -y "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE"
48+
cosign sign -y "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE";\
49+
# Generate the SBOM for the operator image, this leverages the already generated SBOM for the operator binary by cargo-cyclonedx\
50+
syft scan --output cyclonedx-json=sbom.json --select-catalogers "-cargo-auditable-binary-cataloger" --scope all-layers --source-name "${OPERATOR_NAME}" --source-version "${VERSION}" "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE";\
51+
# Determine the PURL for the container image\
52+
PURL="pkg:docker/${ORGANIZATION}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE?repository_url=${DOCKER_REPO}";\
53+
# Get metadata from the image\
54+
IMAGE_DESCRIPTION=$$(docker inspect --format='{{.Config.Labels.description}}' "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}");\
55+
IMAGE_NAME=$$(docker inspect --format='{{.Config.Labels.name}}' "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}:${VERSION}");\
56+
# Merge the SBOM with the metadata for the operator\
57+
jq -s '{"metadata":{"component":{"description":"'"$$IMAGE_NAME. $$IMAGE_DESCRIPTION"'","supplier":{"name":"Stackable GmbH","url":["https://stackable.tech/"]},"author":"Stackable GmbH","purl":"'"$$PURL"'","publisher":"Stackable GmbH"}}} * .[0]' sbom.json > sbom.merged.json;\
58+
# Attest the SBOM to the image\
59+
cosign attest -y --predicate sbom.merged.json --type cyclonedx "${DOCKER_REPO}/${ORGANIZATION}/${OPERATOR_NAME}@$$REPO_DIGEST_OF_IMAGE"
4960

5061
# Push to Harbor
5162
# We need to use "value" here to prevent the variable from being recursively expanded by make (username contains a dollar sign, since it's a Harbor bot)
@@ -137,7 +148,7 @@ regenerate-nix:
137148

138149
build: regenerate-charts regenerate-nix helm-package docker-build
139150

140-
publish: build docker-publish helm-publish
151+
publish: docker-publish helm-publish
141152

142153
run-dev:
143154
kubectl apply -f deploy/stackable-operators-ns.yaml

0 commit comments

Comments
 (0)