forked from kubescape/kubescape
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request kubescape#877 from kubescape/dev
Enhance configuration usage
- Loading branch information
Showing
42 changed files
with
744 additions
and
1,734 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
name: build | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
client: | ||
description: 'client name' | ||
required: true | ||
type: string | ||
image_tag: | ||
description: 'image tag' | ||
required: true | ||
type: string | ||
image_name: | ||
description: 'image registry and name' | ||
required: true | ||
type: string | ||
cosign: | ||
required: false | ||
default: false | ||
type: boolean | ||
description: 'run cosign on released image' | ||
support_platforms: | ||
required: false | ||
default: true | ||
type: boolean | ||
description: 'support amd64/arm64' | ||
|
||
secrets: | ||
QUAYIO_REGISTRY_USERNAME: | ||
required: true | ||
QUAYIO_REGISTRY_PASSWORD: | ||
required: true | ||
|
||
jobs: | ||
build-image: | ||
name: Build image and upload to registry | ||
runs-on: ubuntu-latest | ||
permissions: | ||
id-token: write | ||
packages: write | ||
contents: read | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
|
||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
|
||
- name: Login to Quay.io | ||
env: | ||
QUAY_PASSWORD: ${{ secrets.QUAYIO_REGISTRY_PASSWORD }} | ||
QUAY_USERNAME: ${{ secrets.QUAYIO_REGISTRY_USERNAME }} | ||
run: docker login -u="${QUAY_USERNAME}" -p="${QUAY_PASSWORD}" quay.io | ||
|
||
- name: Build and push image | ||
if: ${{ inputs.support_platforms }} | ||
run: docker buildx build . --file build/Dockerfile --tag ${{ inputs.image_name }}:${{ inputs.image_tag }} --tag ${{ inputs.image_name }}:latest --build-arg image_version=${{ inputs.image_tag }} --build-arg client=${{ inputs.client }} --push --platform linux/amd64,linux/arm64 | ||
|
||
- name: Build and push image without amd64/arm64 support | ||
if: ${{ !inputs.support_platforms }} | ||
run: docker buildx build . --file build/Dockerfile --tag ${{ inputs.image_name }}:${{ inputs.image_tag }} --tag ${{ inputs.image_name }}:latest --build-arg image_version=${{ inputs.image_tag }} --build-arg client=${{ inputs.client }} --push | ||
|
||
- name: Install cosign | ||
uses: sigstore/cosign-installer@main | ||
with: | ||
cosign-release: 'v1.12.0' | ||
- name: sign kubescape container image | ||
if: ${{ inputs.cosign }} | ||
env: | ||
COSIGN_EXPERIMENTAL: "true" | ||
run: | | ||
cosign sign --force ${{ inputs.image_name }}:latest | ||
cosign sign --force ${{ inputs.image_name }}:${{ inputs.image_tag }} | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.