Skip to content

Commit

Permalink
Release container images to ghcr.io (#28)
Browse files Browse the repository at this point in the history
  • Loading branch information
norbjd authored Mar 24, 2024
1 parent 8074b20 commit 7370b71
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 9 deletions.
15 changes: 10 additions & 5 deletions .github/workflows/kind-e2e.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,6 @@ jobs:
- ubuntu-22.04 # Ubuntu 22.04 uses cgroup v2
runs-on: ${{ matrix.os }}

env:
KO_DOCKER_REPO: kind.local

steps:
- name: Set up Go 1.21.x
uses: actions/setup-go@v4
Expand All @@ -55,9 +52,17 @@ jobs:
curl https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3 | bash
- name: Install k8s-pod-cpu-booster
env:
KO_DOCKER_REPO: kind.local
run: |
KO_DOCKER_REPO=kind.local ko build -P ./cmd/informer ./cmd/webhook
helm install k8s-pod-cpu-booster --namespace pod-cpu-booster --create-namespace ./helm
INFORMER_IMAGE=$(ko build ./cmd/informer)
WEBHOOK_IMAGE=$(ko build ./cmd/webhook)
helm install k8s-pod-cpu-booster --namespace pod-cpu-booster --create-namespace ./helm \
--set informer.image=$INFORMER_IMAGE \
--set informer.imagePullPolicy=Never \
--set webhook.image=$WEBHOOK_IMAGE \
--set webhook.imagePullPolicy=Never
- name: Wait for Ready
run: |
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: Release

on:
push:
branches:
- main

jobs:
release:
name: build and push to ghcr.io
runs-on: ubuntu-22.04
permissions:
packages: write

steps:
- uses: actions/setup-go@v4
with:
go-version: 1.21.x
- uses: ko-build/setup-ko@v0.6
- uses: actions/checkout@v4

- name: Build and push
env:
KO_DOCKER_REPO: ghcr.io/norbjd/k8s-pod-cpu-booster
run: |
# something like 202403241909-abcdef01 if we want to use a specific version
UNIQUE_TAG="$(TZ=UTC0 git log -1 --format=%cd --date=format-local:%Y%m%d%H%M)-$(git rev-parse --short HEAD)"
ko build ./cmd/informer ./cmd/webhook \
--base-import-paths \
--sbom=none \
--tags=$GITHUB_REF_NAME,$UNIQUE_TAG
8 changes: 4 additions & 4 deletions helm/values.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@ nameOverride: ""
fullnameOverride: ""

informer:
image: kind.local/github.com/norbjd/k8s-pod-cpu-booster/cmd/informer:latest
imagePullPolicy: Never
image: ghcr.io/norbjd/k8s-pod-cpu-booster/informer:main
imagePullPolicy: Always
resources: {}

webhook:
image: kind.local/github.com/norbjd/k8s-pod-cpu-booster/cmd/webhook:latest
imagePullPolicy: Never
image: ghcr.io/norbjd/k8s-pod-cpu-booster/webhook:main
imagePullPolicy: Always
replicaCount: 3
resources: {}

0 comments on commit 7370b71

Please sign in to comment.