Skip to content

Commit

Permalink
clean up
Browse files Browse the repository at this point in the history
  • Loading branch information
garethahealy committed Nov 24, 2023
1 parent 28a6ff8 commit f5ed37a
Showing 1 changed file with 20 additions and 23 deletions.
43 changes: 20 additions & 23 deletions .github/workflows/release-operator.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,7 @@ jobs:

- name: "Build Operator Image"
uses: docker/build-push-action@v3
id: build_push
with:
context: .
file: "./ci.Dockerfile"
Expand All @@ -323,20 +324,16 @@ jobs:
tags: "${{ env.OPERATOR_IMAGE_REPOSITORY }}:latest-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }},${{ env.OPERATOR_IMAGE_REPOSITORY }}:${{ env.OPERATOR_VERSION }}-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }}"

- name: Cosign login and initialize
env:
image_registry: ${{ env.OPERATOR_IMAGE_REGISTRY }}
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | cosign login --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin ${image_registry%%/*}
echo "${{ secrets.REGISTRY_PASSWORD }}" | cosign login --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin ${OPERATOR_IMAGE_REGISTRY%%/*}
cosign initialize
- name: Sign Operator Image
id: sign_operator
env:
IMAGE_URI: ${{ env.OPERATOR_IMAGE_REPOSITORY }}:latest-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }}
IMAGE_URI: ${{ env.OPERATOR_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
run: |
signed_image_digest=$(cosign triangulate --type=digest ${{ env.IMAGE_URI }})
echo "signed_image_digest=${signed_image_digest}" >> $GITHUB_OUTPUT
cosign sign --yes ${signed_image_digest}
cosign sign --yes ${IMAGE_URI}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
Expand All @@ -345,7 +342,7 @@ jobs:
TRIVY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
with:
scan-type: image
image-ref: ${{ steps.sign_operator.outputs.signed_image_digest }}
image-ref: ${{ env.OPERATOR_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
format: "cosign-vuln"
output: "cosign-vuln.json"

Expand All @@ -356,14 +353,16 @@ jobs:
TRIVY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
with:
scan-type: image
image-ref: ${{ steps.sign_operator.outputs.signed_image_digest }}
image-ref: ${{ env.OPERATOR_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
format: "cyclonedx"
output: "cyclonedx-sbom.json"

- name: Attach attestations for Operator Image
env:
IMAGE_URI: ${{ env.OPERATOR_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
run: |
cosign attest --yes --type vuln --predicate cosign-vuln.json ${{ steps.sign_operator.outputs.signed_image_digest }}
cosign attest --yes --type cyclonedx --predicate cyclonedx-sbom.json ${{ steps.sign_operator.outputs.signed_image_digest }}
cosign attest --yes --type vuln --predicate cosign-vuln.json ${IMAGE_URI}
cosign attest --yes --type cyclonedx --predicate cyclonedx-sbom.json ${IMAGE_URI}
- name: Prepare Distribution Artifacts
shell: bash
Expand Down Expand Up @@ -518,6 +517,7 @@ jobs:

- name: "Build Bundle Image"
uses: docker/build-push-action@v3
id: build_push
with:
context: .
file: ./bundle.Dockerfile
Expand All @@ -527,20 +527,16 @@ jobs:
tags: "${{ env.BUNDLE_IMAGE_REPOSITORY }}:latest-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }},${{ env.BUNDLE_IMAGE_REPOSITORY }}:${{ env.BUNDLE_VERSION }}-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }}"

- name: Cosign login and initialize
env:
image_registry: ${{ env.BUNDLE_IMAGE_REGISTRY }}
run: |
echo "${{ secrets.REGISTRY_PASSWORD }}" | cosign login --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin ${image_registry%%/*}
echo "${{ secrets.REGISTRY_PASSWORD }}" | cosign login --username ${{ secrets.REGISTRY_USERNAME }} --password-stdin ${BUNDLE_IMAGE_REGISTRY%%/*}
cosign initialize
- name: Sign Bundle Image
id: sign_bundle
env:
IMAGE_URI: ${{ env.BUNDLE_IMAGE_REPOSITORY }}:latest-${{ steps.setup-build-step.outputs.platform_os }}-${{ steps.setup-build-step.outputs.platform_arch }}
IMAGE_URI: ${{ env.BUNDLE_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
run: |
signed_image_digest=$(cosign triangulate --type=digest ${{ env.IMAGE_URI }})
echo "signed_image_digest=${signed_image_digest}" >> $GITHUB_OUTPUT
cosign sign --yes ${signed_image_digest}
cosign sign --yes ${IMAGE_URI}
- name: Run Trivy vulnerability scanner
uses: aquasecurity/[email protected]
Expand All @@ -549,26 +545,27 @@ jobs:
TRIVY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
with:
scan-type: image
image-ref: ${{ steps.sign_bundle.outputs.signed_image_digest }}
image-ref: ${{ env.BUNDLE_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
format: "cosign-vuln"
output: "cosign-vuln.json"


- name: Run Trivy SBOM generator
uses: aquasecurity/[email protected]
env:
TRIVY_USERNAME: ${{ secrets.REGISTRY_USERNAME }}
TRIVY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }}
with:
scan-type: image
image-ref: ${{ steps.sign_bundle.outputs.signed_image_digest }}
image-ref: ${{ env.BUNDLE_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
format: "cyclonedx"
output: "cyclonedx-sbom.json"

- name: Attach attestations for Bundle Image
env:
IMAGE_URI: ${{ env.BUNDLE_IMAGE_REPOSITORY }}@${{ steps.build_push.outputs.digest }}
run: |
cosign attest --yes --type vuln --predicate cosign-vuln.json ${{ steps.sign_bundle.outputs.signed_image_digest }}
cosign attest --yes --type cyclonedx --predicate cyclonedx-sbom.json ${{ steps.sign_bundle.outputs.signed_image_digest }}
cosign attest --yes --type vuln --predicate cosign-vuln.json ${IMAGE_URI}
cosign attest --yes --type cyclonedx --predicate cyclonedx-sbom.json ${IMAGE_URI}
- name: Prepare Distribution Artifacts
shell: bash
Expand Down

0 comments on commit f5ed37a

Please sign in to comment.