From 559b45a51073e8b60ad4d8977fee4ee172eec608 Mon Sep 17 00:00:00 2001 From: Drew Wells Date: Wed, 23 Aug 2023 16:49:58 -0500 Subject: [PATCH] ghcr.io/ and auth --- .github/workflows/pr.yaml | 21 +++++++++++++++++++-- test/apiserver/makefile | 2 +- 2 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pr.yaml b/.github/workflows/pr.yaml index 2cee1f47..c4e861ae 100644 --- a/.github/workflows/pr.yaml +++ b/.github/workflows/pr.yaml @@ -1,8 +1,7 @@ name: PR on: pull_request jobs: - buildapiserver: - name: Build API Server + build-and-push-image: runs-on: ubuntu-latest strategy: fail-fast: false @@ -10,6 +9,11 @@ jobs: defaults: run: shell: bash -ex -o pipefail {0} + env: + REGISTRY: ghcr.io/ + permissions: + contents: read + packages: write steps: - name: Checkout code uses: actions/checkout@v3 @@ -22,6 +26,12 @@ jobs: go-version: 1.21.x cache-dependency-path: test/contact/go.sum go-version-file: 'test/contact/go.mod' + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Build Extension APIServer timeout-minutes: 10 run: | @@ -55,6 +65,7 @@ jobs: shell: bash -ex -o pipefail {0} working-directory: ./src/github.com/${{ github.repository }} env: + REGISTRY: ghcr.io/ GOPATH: ${{ github.workspace }} KONK_NAMESPACE: baz steps: @@ -129,6 +140,12 @@ jobs: done make test-konk KONK_NAMESPACE=$KONK_NAMESPACE make test-konk-local + - name: Log in to the Container registry + uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Deploy Extension APIServer timeout-minutes: 4 run: | diff --git a/test/apiserver/makefile b/test/apiserver/makefile index 54cdfdf5..21bc5bae 100644 --- a/test/apiserver/makefile +++ b/test/apiserver/makefile @@ -1,5 +1,5 @@ IMAGE_TAG ?= $(shell git describe --tags --always) -IMAGE_REPO ?= infoblox/konk-apiserver-example +IMAGE_REPO ?= ${REGISTRY}infoblox/konk-apiserver-example IMAGE := $(IMAGE_REPO):$(IMAGE_TAG) TEST_ENV := GO111MODULE=off BUILD_FLAGS ?=