correct url in environment with quotes #9
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
--- | ||
name: 'Run Container Workflow' | ||
on: | ||
workflow_call: | ||
inputs: | ||
workload-id-provider: | ||
required: true | ||
type: string | ||
service-account: | ||
required: true | ||
type: string | ||
access-token-lifetime: | ||
description: "GCP token expiration timeout" | ||
required: false | ||
type: string | ||
default: "20m" | ||
artifact-registry: | ||
required: true | ||
type: string | ||
tags: | ||
required: true | ||
type: string | ||
platforms: | ||
type: string | ||
default: "linux/amd64" | ||
context: | ||
required: true | ||
type: string | ||
file: | ||
required: false | ||
type: string | ||
build-args: | ||
required: false | ||
type: string | ||
provenance: | ||
required: false | ||
type: boolean | ||
default: true | ||
runs_on: | ||
default: "['ubuntu-latest']" | ||
type: string | ||
timeout-minutes: | ||
default: 30 | ||
type: number | ||
environment: | ||
default: '' | ||
type: string | ||
debug_enabled: | ||
default: false | ||
required: false | ||
type: boolean | ||
description: "run tmate for troubleshooting" | ||
jobs: | ||
auth-build-push-scan-container: | ||
runs-on: ${{ fromJson(inputs.runs_on) }} | ||
timeout-minutes: ${{ inputs.timeout-minutes }} | ||
environment: ${{ inputs.environment }} | ||
url: "${{ inputs.artifact-registry }}:${{inputs.tags}}" | ||
permissions: # Required for workload identity auth and push the trivy results to GitHub | ||
contents: read | ||
id-token: write | ||
security-events: write | ||
steps: | ||
- name: Harden Runner | ||
if: runner.environment == 'github-hosted' | ||
uses: step-security/harden-runner@v2 | ||
with: | ||
egress-policy: audit | ||
- name: Setup tmate session | ||
uses: mxschmitt/action-tmate@e5c7151931ca95bad1c6f4190c730ecf8c7dde48 | ||
if: inputs.debug_enabled == true | ||
with: | ||
detached: true | ||
- name: 'Checkout' | ||
uses: actions/checkout@v4 | ||
- name: Split location and app names | ||
id: split | ||
env: | ||
REGISTRY: ${{ inputs.artifact-registry }} | ||
shell: bash | ||
run: | | ||
location=${REGISTRY%%/*} | ||
app_name=${REGISTRY##*/} | ||
echo "::debug::location=$location" | ||
echo "::debug::app_name=$app_name" | ||
echo "location=$location" >> $GITHUB_OUTPUT | ||
echo "app_name=$app_name" >> $GITHUB_OUTPUT | ||
- name: Authenticate to Google Cloud | ||
uses: celo-org/reusable-workflows/.github/actions/auth-gcp-artifact-registry@main | ||
with: | ||
workload-id-provider: ${{ inputs.workload-id-provider }} | ||
service-account: ${{ inputs.service-account }} | ||
access-token-lifetime: ${{ inputs.access-token-lifetime }} | ||
docker-gcp-registries: ${{ steps.split.outputs.location }} | ||
- name: Build, push and scan the container | ||
uses: celo-org/[email protected] | ||
with: | ||
platforms: ${{ inputs.platforms }} | ||
registry: ${{ inputs.artifact-registry }} | ||
tags: ${{ inputs.tags }} | ||
context: ${{ inputs.context }} | ||
dockerfile: ${{ inputs.file }} | ||
build-args: ${{ inputs.build-args }} | ||
push: ${{ fromJSON(true) }} |