Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Release container images to ghcr.io #28

Merged
merged 15 commits into from
Mar 24, 2024
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/[email protected]
- 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: {}
Loading