Skip to content

Commit 39f407d

Browse files
committed
Upload Plus Docker images to GAR (nginx#2192)
Problem: We want to be able to use NGINX Plus images built from edge and release branches in the NFR workflow Solution: Start pushing Plus images to GAR so they're available to other workflows
1 parent 0aa5c99 commit 39f407d

File tree

2 files changed

+20
-47
lines changed

2 files changed

+20
-47
lines changed

.github/workflows/build.yml

+18
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,23 @@ jobs:
8080
password: ${{ github.actor }}
8181
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}
8282

83+
- name: Authenticate to Google Cloud
84+
id: auth
85+
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
86+
with:
87+
token_format: access_token
88+
workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY }}
89+
service_account: ${{ secrets.GCP_SERVICE_ACCOUNT }}
90+
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}
91+
92+
- name: Login to GAR
93+
uses: docker/login-action@0d4c9c5ea7693da7b068278f7b52bda2a190a446 # v3.2.0
94+
with:
95+
registry: us-docker.pkg.dev
96+
username: oauth2accesstoken
97+
password: ${{ steps.auth.outputs.access_token }}
98+
if: ${{ github.event_name != 'pull_request' && contains(inputs.image, 'plus') }}
99+
83100
- name: Docker meta
84101
id: meta
85102
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
@@ -88,6 +105,7 @@ jobs:
88105
name=ghcr.io/nginxinc/nginx-gateway-fabric,enable=${{ inputs.image == 'ngf' && github.event_name != 'pull_request' }}
89106
name=ghcr.io/nginxinc/nginx-gateway-fabric/nginx,enable=${{ inputs.image == 'nginx' && github.event_name != 'pull_request' }}
90107
name=docker-mgmt.nginx.com/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
108+
name=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus,enable=${{ inputs.image == 'plus' && github.event_name != 'pull_request' }}
91109
name=localhost:5000/nginx-gateway-fabric/${{ inputs.image }}
92110
flavor: |
93111
latest=${{ (inputs.tag != '' && 'true') || 'auto' }}

.github/workflows/nfr.yml

+2-47
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ on:
44
workflow_dispatch:
55
inputs:
66
test_label:
7-
description: NFR test to run. Choose between performance, upgrade, or all
7+
description: NFR test to run. Choose between performance, upgrade, scale, or all
88
required: true
99
default: all
1010
type: choice
@@ -47,28 +47,6 @@ jobs:
4747
- name: Checkout Repository
4848
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
4949

50-
- name: Setup Golang Environment
51-
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
52-
with:
53-
go-version: stable
54-
55-
- name: Set GOPATH
56-
run: echo "GOPATH=$(go env GOPATH)" >> $GITHUB_ENV
57-
58-
- name: Docker Buildx
59-
if: ${{ inputs.nginx_plus == true }}
60-
uses: docker/setup-buildx-action@4fd812986e6c8c2a69e18311145f9371337f27d4 # v3.4.0
61-
62-
- name: NGINX Docker meta
63-
id: nginx-meta
64-
if: ${{ inputs.nginx_plus == true }}
65-
uses: docker/metadata-action@8e5442c4ef9f78752691e2d8f8d19755c6f78e81 # v5.5.1
66-
with:
67-
images: |
68-
name=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus
69-
tags: |
70-
type=raw,value=${{ inputs.image_tag }}
71-
7250
- name: Authenticate to Google Cloud
7351
id: auth
7452
uses: google-github-actions/auth@71fee32a0bb7e97b4d33d548e7d957010649d8fa # v2.1.3
@@ -83,37 +61,14 @@ jobs:
8361
project_id: ${{ secrets.GCP_PROJECT_ID }}
8462
install_components: kubectl
8563

86-
- name: Login to GCR
87-
if: ${{ inputs.nginx_plus == true }}
88-
run: gcloud auth configure-docker gcr.io -q
89-
90-
- name: Build NGINX Plus Docker Image
91-
if: ${{ inputs.nginx_plus == true }}
92-
uses: docker/build-push-action@1a162644f9a7e87d8f4b053101d1d9a712edc18c # v6.3.0
93-
with:
94-
file: build/Dockerfile.nginxplus
95-
tags: ${{ steps.nginx-meta.outputs.tags }}
96-
context: "."
97-
platforms: linux/amd64
98-
provenance: false
99-
pull: true
100-
push: true
101-
build-args: |
102-
NJS_DIR=internal/mode/static/nginx/modules/src
103-
NGINX_CONF_DIR=internal/mode/static/nginx/conf
104-
BUILD_AGENT=gha
105-
secrets: |
106-
${{ format('"nginx-repo.crt={0}"', secrets.NGINX_CRT) }}
107-
${{ format('"nginx-repo.key={0}"', secrets.NGINX_KEY) }}
108-
10964
- name: Setup dotenv file
11065
working-directory: ./tests/scripts
11166
run: |
11267
echo "RESOURCE_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
11368
echo "TAG=${{ inputs.image_tag }}" >> vars.env
11469
echo "PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric" >> vars.env
11570
echo "NGINX_PREFIX=ghcr.io/nginxinc/nginx-gateway-fabric/nginx" >> vars.env
116-
echo "NGINX_PLUS_PREFIX=gcr.io/${{ secrets.GCP_PROJECT_ID }}/ngf-nfr/nginx-gateway-fabric/nginx-plus" >> vars.env
71+
echo "NGINX_PLUS_PREFIX=us-docker.pkg.dev/${{ secrets.GCP_PROJECT_ID }}/nginx-gateway-fabric/nginx-plus" >> vars.env
11772
echo "GKE_CLUSTER_NAME=nfr-tests-${{ github.run_id }}" >> vars.env
11873
echo "GKE_CLUSTER_ZONE=us-east1-b" >> vars.env
11974
echo "GKE_CLUSTER_REGION=us-east1" >> vars.env

0 commit comments

Comments
 (0)