Skip to content

Commit

Permalink
fix: remove push images (#84)
Browse files Browse the repository at this point in the history
Forked PRs can't push to upstream GHCR, remove push steps (and default
to `--load`).

Signed-off-by: Evan Baker <[email protected]>
  • Loading branch information
rbtr authored Mar 20, 2024
1 parent ac26b1d commit 078d15b
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 60 deletions.
53 changes: 5 additions & 48 deletions .github/workflows/images.yaml
Original file line number Diff line number Diff line change
@@ -1,15 +1,11 @@
name: Build and Publish Retina Container Images
name: Build Retina Container Images

on:
push:
branches: [ main ]
tags: [ "v*" ]
pull_request:
branches: [ main ]

permissions:
contents: read
packages: write

jobs:
retina-images:
Expand All @@ -33,10 +29,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build/Push Images
- name: Build Images
shell: bash
run: |
set -euo pipefail
Expand Down Expand Up @@ -66,10 +59,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build/Push Images
- name: Build Images
shell: bash
run: |
set -euo pipefail
Expand Down Expand Up @@ -99,10 +89,7 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build/Push Images
- name: Build Images
shell: bash
run: |
set -euo pipefail
Expand Down Expand Up @@ -132,41 +119,11 @@ jobs:
- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Build/Push Images
- name: Build Images
shell: bash
run: |
set -euo pipefail
echo "TAG=$(make version)" >> $GITHUB_ENV
make kubectl-retina-image \
IMAGE_NAMESPACE=${{ github.repository }} \
PLATFORM=${{ matrix.platform }}/${{ matrix.arch }}
manifests:
name: Generate Manifests
runs-on: ubuntu-latest
needs: [retina-images, retina-win-images, operator-images, kubectl-retina-images]

strategy:
matrix:
component: ["retina", "operator", "kubectl-retina"]

steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin

- name: Generate Manifests
shell: bash
run: |
set -euo pipefail
make manifest \
IMAGE_NAMESPACE=${{ github.repository }} \
COMPONENT=${{ matrix.component }}
19 changes: 7 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -188,7 +188,7 @@ retina-capture-workload: ## build the Retina capture workload
##@ Containers

IMAGE_REGISTRY ?= ghcr.io
IMAGE_NAMESPACE ?= $(shell git config --get remote.origin.url | sed -E 's/.*github\.com[\/:]([^\/]+)\/([^\/.]+).git/\1\/\2/' | tr '[:upper:]' '[:lower:]')
IMAGE_NAMESPACE ?= $(shell git config --get remote.origin.url | sed -E 's/.*github\.com[\/:]([^\/]+)\/([^\/.]+)(.git)?/\1\/\2/' | tr '[:upper:]' '[:lower:]')

RETINA_BUILDER_IMAGE = $(IMAGE_NAMESPACE)/retina-builder
RETINA_TOOLS_IMAGE = $(IMAGE_NAMESPACE)/retina-tools
Expand Down Expand Up @@ -236,7 +236,7 @@ container-docker: buildx # util target to build container images using docker bu
arch=$$(echo $(PLATFORM) | cut -d'/' -f2); \
echo "Building for $$os/$$arch"; \
docker buildx build \
$(ACTION) \
$(BUILDX_ACTION) \
--platform $(PLATFORM) \
-f $(DOCKERFILE) \
--build-arg VERSION=$(VERSION) $(EXTRA_BUILD_ARGS) \
Expand Down Expand Up @@ -265,8 +265,7 @@ retina-image: ## build the retina linux container image.
TAG=$(RETINA_PLATFORM_TAG) \
APP_INSIGHTS_ID=$(APP_INSIGHTS_ID) \
CONTEXT_DIR=$(REPO_ROOT) \
TARGET=$$target \
ACTION=--push; \
TARGET=$$target; \
done

retina-image-win: ## build the retina Windows container image.
Expand All @@ -280,8 +279,7 @@ retina-image-win: ## build the retina Windows container image.
IMAGE=$(RETINA_IMAGE) \
VERSION=$(TAG) \
TAG=$$tag \
CONTEXT_DIR=$(REPO_ROOT) \
ACTION=--push; \
CONTEXT_DIR=$(REPO_ROOT); \
done

retina-operator-image: ## build the retina linux operator image.
Expand All @@ -294,8 +292,7 @@ retina-operator-image: ## build the retina linux operator image.
VERSION=$(TAG) \
TAG=$(RETINA_PLATFORM_TAG) \
APP_INSIGHTS_ID=$(APP_INSIGHTS_ID) \
CONTEXT_DIR=$(REPO_ROOT) \
ACTION=--push
CONTEXT_DIR=$(REPO_ROOT)

kubectl-retina-image: ## build the kubectl-retina image.
echo "Building for $(PLATFORM)"
Expand All @@ -307,8 +304,7 @@ kubectl-retina-image: ## build the kubectl-retina image.
VERSION=$(TAG) \
TAG=$(RETINA_PLATFORM_TAG) \
APP_INSIGHTS_ID=$(APP_INSIGHTS_ID) \
CONTEXT_DIR=$(REPO_ROOT) \
ACTION=--push
CONTEXT_DIR=$(REPO_ROOT)

proto-gen: ## generate protobuf code
docker build --platform=linux/amd64 \
Expand Down Expand Up @@ -366,8 +362,7 @@ test-image: ## build the retina container image for testing.
REGISTRY=$(IMAGE_REGISTRY) \
IMAGE=$(RETINA_IMAGE) \
CONTEXT_DIR=$(REPO_ROOT) \
TAG=$(RETINA_PLATFORM_TAG) \
ACTION=--load
TAG=$(RETINA_PLATFORM_TAG)

COVER_PKG ?= .

Expand Down

0 comments on commit 078d15b

Please sign in to comment.