2023-01-13 10:38:31 -05:00
|
|
|
name: Build micro service (KO)
|
|
|
|
description: Build and upload a container image for a Constellation micro-service
|
|
|
|
inputs:
|
|
|
|
name:
|
|
|
|
description: "Name of the micro-service"
|
|
|
|
required: true
|
|
|
|
koConfig:
|
|
|
|
description: "Path to the .ko.yaml config file"
|
|
|
|
default: ".ko.yaml"
|
|
|
|
required: false
|
|
|
|
koTarget:
|
|
|
|
description: "Go package to build with ko"
|
|
|
|
required: true
|
|
|
|
pushTag:
|
|
|
|
description: "Use this image tag"
|
|
|
|
required: false
|
|
|
|
githubToken:
|
|
|
|
description: "GitHub authorization token"
|
|
|
|
required: true
|
|
|
|
generateKoSBOM:
|
|
|
|
description: "Generate unsigned ko SBOM"
|
|
|
|
required: false
|
|
|
|
default: "false"
|
|
|
|
cosignPublicKey:
|
|
|
|
description: "Cosign public key"
|
2023-01-30 10:58:49 -05:00
|
|
|
required: true
|
2023-01-13 10:38:31 -05:00
|
|
|
cosignPrivateKey:
|
|
|
|
description: "Cosign private key"
|
2023-01-30 10:58:49 -05:00
|
|
|
required: true
|
2023-01-13 10:38:31 -05:00
|
|
|
cosignPassword:
|
|
|
|
description: "Password for Cosign private key"
|
|
|
|
required: false
|
|
|
|
|
|
|
|
# Linux runner only
|
|
|
|
runs:
|
|
|
|
using: "composite"
|
|
|
|
steps:
|
|
|
|
- name: Build and upload container image
|
|
|
|
id: build-and-upload
|
|
|
|
uses: ./.github/actions/build_ko
|
|
|
|
with:
|
|
|
|
name: ${{ inputs.name }}
|
2023-01-30 10:58:49 -05:00
|
|
|
koConfig: ${{ inputs.koConfig }}
|
2023-01-13 10:38:31 -05:00
|
|
|
koTarget: ${{ inputs.koTarget }}
|
2023-01-30 10:58:49 -05:00
|
|
|
pushTag: ${{ inputs.pushTag }}
|
2023-01-13 10:38:31 -05:00
|
|
|
githubToken: ${{ inputs.GITHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Download ko Container Data
|
|
|
|
id: download_container_data
|
2023-01-18 11:04:46 -05:00
|
|
|
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
|
2023-01-13 10:38:31 -05:00
|
|
|
with:
|
|
|
|
name: container_data_ko
|
|
|
|
path: CONTAINER_DATA_KO
|
|
|
|
|
|
|
|
- name: Set container url to Github Env
|
|
|
|
shell: bash
|
|
|
|
run: |
|
|
|
|
container_full=$(jq -r .container_full < container_data_ko.json)
|
|
|
|
echo CONTAINER_FULL=$container_full >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Generate SBOM
|
2023-01-18 04:15:58 -05:00
|
|
|
if: inputs.cosignPublicKey != '' && inputs.cosignPrivateKey != '' && inputs.cosignPassword != '' && inputs.generateKoSBOM == 'false'
|
2023-01-13 10:38:31 -05:00
|
|
|
uses: ./.github/actions/container_sbom
|
|
|
|
with:
|
|
|
|
containerReference: ${{ env.CONTAINER_FULL }}
|
|
|
|
cosignPublicKey: ${{ inputs.cosignPublicKey }}
|
|
|
|
cosignPrivateKey: ${{ inputs.cosignPrivateKey }}
|
|
|
|
cosignPassword: ${{ inputs.cosignPassword }}
|