Skip to content

add write permission to build image workflow #2

add write permission to build image workflow

add write permission to build image workflow #2

name: Build Test Image
on:
schedule:
- cron: "0 03 * * *" # run every day at 03:00 UTC
workflow_dispatch:
inputs:
force:
description: "Force rebuild of test image"
required: false
default: "false"
push:
branches:
- mount-test-dir-on-smoke-tests
defaults:
run:
shell: bash
concurrency:
group: ${{ github.ref_name }}-ci
cancel-in-progress: true
permissions:
contents: read
id-token: write
jobs:
build:
name: Build test image
runs-on: ubuntu-22.04
steps:
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Docker Buildx
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@f6de81663f7788d05bd15bcce18f0e57f23f0846 # v2.0.1
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCR_WORKLOAD_IDENTITY }}
service_account: ${{ secrets.GCR_SERVICE_ACCOUNT }}
- name: Login to GCR
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0
with:
registry: gcr.io
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
- name: Build Test-Runner Container
uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0
with:
file: tests/Dockerfile
context: "."
cache-from: type=gha,scope=test-runner
tags: |
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:${{ hashFiles('./tests/requirements.txt') }}
gcr.io/f5-gcs-7899-ptg-ingrss-ctlr/dev/test-runner:latest
load: true
pull: true
push: true