Skip to content

Commit

Permalink
Upload Plus Docker images to GAR
Browse files Browse the repository at this point in the history
  • Loading branch information
lucacome committed Jul 3, 2024
1 parent 7bc0b6e commit 1f6030a
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 46 deletions.
18 changes: 18 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,23 @@ jobs:
password: ${{ github.actor }}
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}

- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
with:
token_format: access_token
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }}
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
# if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}

- name: Login to GAR
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
with:
registry: us-docker.pkg.dev
username: oauth2accesstoken
password: ${{ steps.auth.outputs.access_token }}
# if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}

- name: Docker meta
id: meta
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
Expand All @@ -88,6 +105,7 @@ jobs:
name=ghcr.io/nginxinc/nginx-gateway-fabric,enable=${{ inputs.image == 'ngf' && github.event_name != 'pull_request' }}
name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx,enable=${{ inputs.image == 'nginx' && github.event_name != 'pull_request' }}
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
name=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' }} # && github.event_name != 'pull_request' }}
name=localhost:5000/nginx-gateway-fabric/${{ inputs.image }}
flavor: |
latest=${{ (inputs.tag != '' && 'true') || 'auto' }}
Expand Down
47 changes: 1 addition & 46 deletions .github/workflows/nfr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,28 +47,6 @@ jobs:
- name: Checkout Repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Setup Golang Environment
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version: stable

- name: Set GOPATH
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV

- name: Docker Buildx
if: ${{ inputs.nginx_plus == true }}
uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0

- name: NGINX Docker meta
id: nginx-meta
if: ${{ inputs.nginx_plus == true }}
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
with:
images: |
name=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus
tags: |
type=raw,value=${{ inputs.image_tag }}
- name: Authenticate to Google Cloud
id: auth
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
Expand All @@ -83,37 +61,14 @@ jobs:
project_id: ${{ secrets.GCP_PROJECT_ID }}
install_components: kubectl

- name: Login to GCR
if: ${{ inputs.nginx_plus == true }}
run: gcloud auth configure-docker gcr.io -q

- name: Build NGINX Plus Docker Image
if: ${{ inputs.nginx_plus == true }}
uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0
with:
file: build/Dockerfile.nginxplus
tags: ${{ steps.nginx-meta.outputs.tags }}
context: "."
platforms: linux/amd64
provenance: false
pull: true
push: true
build-args: |
NJS_DIR=internal/mode/static/nginx/modules/src
NGINX_CONF_DIR=internal/mode/static/nginx/conf
BUILD_AGENT=gha
secrets: |
${{ format('"nginx-repo.crt={0}"', secrets.NGINX_CRT) }}
${{ format('"nginx-repo.key={0}"', secrets.NGINX_KEY) }}
- name: Setup dotenv file
working-directory: ./tests/scripts
run: |
echo "RESOURCE_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
echo "TAG=${{ inputs.image_tag }}" >> vars.env
echo "PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric" >> vars.env
echo "NGINX_PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric/nginx" >> vars.env
echo "NGINX_PLUS_PREFIX=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus" >> vars.env
echo "NGINX_PLUS_PREFIX=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus" >> vars.env
echo "GKE_CLUSTER_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
echo "GKE_CLUSTER_ZONE=us-east1-b" >> vars.env
echo "GKE_CLUSTER_REGION=us-east1" >> vars.env
Expand Down

0 comments on commit 1f6030a

Please sign in to comment.