Skip to content

Commit 8b65ecf

Browse files
committed
ko build of populator image
Signed-off-by: aavarghese <avarghese@us.ibm.com>
1 parent 0758462 commit 8b65ecf

3 files changed

Lines changed: 104 additions & 0 deletions

File tree

Lines changed: 88 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,88 @@
1+
name: Build Populator Image
2+
3+
on:
4+
push:
5+
paths:
6+
- ".github/workflows/build-populator-image.yml"
7+
- Makefile
8+
- cmd/launcher-populator/**
9+
- pkg/**
10+
pull_request:
11+
branches:
12+
- main
13+
14+
permissions:
15+
contents: read
16+
packages: write
17+
attestations: write
18+
id-token: write
19+
20+
jobs:
21+
debug:
22+
name: print relevant info
23+
runs-on: ubuntu-latest
24+
steps:
25+
- run: |
26+
echo "github.actor=${{ github.actor }}"
27+
echo "github.action_ref=${{ github.action_ref }}"
28+
echo "github.event_name=${{ github.event_name }}"
29+
echo "github.head_ref=$GITHUB_HEAD_REF"
30+
echo "github.ref=${{ github.ref }}"
31+
echo "github.ref_name=${{ github.ref_name }}"
32+
echo "github.repository=${{ github.repository }}"
33+
echo "github.repository_owner=${{ github.repository_owner }}"
34+
echo "github.triggering_actor=${{ github.triggering_actor }}"
35+
echo "GITHUB_ACTION_REF=$GITHUB_ACTION_REF"
36+
37+
build-and-push:
38+
if: "${{ github.repository_owner == github.actor }}"
39+
strategy:
40+
fail-fast: false
41+
runs-on: ubuntu-latest
42+
steps:
43+
- name: Install ko
44+
uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d
45+
46+
- name: Checkout code
47+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
48+
49+
- name: Log in to Container Registry
50+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5
51+
with:
52+
registry: ghcr.io
53+
username: ${{ github.actor }}
54+
password: ${{ secrets.GITHUB_TOKEN }}
55+
56+
- name: Set up Docker Buildx
57+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
58+
59+
- name: Doit
60+
run: |
61+
reg=${{ github.repository }}
62+
make build-populator CONTAINER_IMG_REG=ghcr.io/${reg@L}
63+
64+
build-only:
65+
if: "${{ github.repository_owner != github.actor }}"
66+
strategy:
67+
fail-fast: false
68+
runs-on: ubuntu-latest
69+
steps:
70+
- name: Install ko
71+
uses: ko-build/setup-ko@d006021bd0c28d1ce33a07e7943d48b079944c8d
72+
73+
- name: Checkout code
74+
uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 # v5.0.0
75+
76+
- name: Log in to Container Registry
77+
uses: docker/login-action@184bdaa0721073962dff0199f1fb9940f07167d1 # v3.5
78+
with:
79+
registry: ghcr.io
80+
username: ${{ github.actor }}
81+
password: ${{ secrets.GITHUB_TOKEN }}
82+
83+
- name: Set up Docker Buildx
84+
uses: docker/setup-buildx-action@e468171a9de216ec08956ac3ada2f0791b6bd435 # v3.11.1
85+
86+
- name: Doit
87+
run: |
88+
make build-populator-local

Makefile

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ TEST_REQUESTER_IMG_TAG ?= $(shell git rev-parse --short HEAD)
1313
TEST_REQUESTER_IMG ?= $(CONTAINER_IMG_REG)/test-requester:$(TEST_REQUESTER_IMG_TAG)
1414
TEST_SERVER_IMG_TAG ?= $(shell git rev-parse --short HEAD)
1515
TEST_SERVER_IMG ?= $(CONTAINER_IMG_REG)/test-server:$(TEST_SERVER_IMG_TAG)
16+
POPULATOR_IMG_TAG ?= $(shell git rev-parse --short HEAD)
17+
POPULATOR_IMG ?= $(CONTAINER_IMG_REG)/launcher-populator:$(POPULATOR_IMG_TAG)
1618

1719
TARGETARCH ?= $(shell go env GOARCH)
1820

@@ -73,6 +75,19 @@ build-test-server-local:
7375
load-test-server-local:
7476
kind load docker-image ${TEST_SERVER_IMG} --name ${CLUSTER_NAME}
7577

78+
.PHONY: build-populator-local
79+
build-populator-local:
80+
KO_DOCKER_REPO=ko.local ko build -B ./cmd/launcher-populator -t ${POPULATOR_IMG_TAG} --platform linux/$(shell go env GOARCH)
81+
docker tag ko.local/launcher-populator:${POPULATOR_IMG_TAG} ${POPULATOR_IMG}
82+
83+
.PHONY: load-populator-local
84+
load-populator-local:
85+
kind load docker-image ${POPULATOR_IMG} --name ${CLUSTER_NAME}
86+
87+
.PHONY: build-populator
88+
build-populator:
89+
KO_DOCKER_REPO=$(CONTAINER_IMG_REG) ko build -B ./cmd/launcher-populator -t ${POPULATOR_IMG_TAG} --platform all
90+
7691
.PHONY: echo-var
7792
echo-var:
7893
@echo "$($(VAR))"

docs/README.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,4 +16,5 @@
1616
- [Test build of dual-pods controller image](../.github/workflows/build-controller-image.yml)
1717
- [Test build of launcher image](../.github/workflows/build-launcher-image.yml)
1818
- [Test build of requester image](../.github/workflows/build-requester-image.yml)
19+
- [Test build of launcher populator image](../.github/workflows/build-populator-image.yml)
1920
- [End-to-end testing in CI using a `kind` cluster](../.github/workflows/pr-test-in-kind.yml)

0 commit comments

Comments
 (0)