-
Notifications
You must be signed in to change notification settings - Fork 4
83 lines (75 loc) · 2.3 KB
/
controller-sharding.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
name: controller-sharding
on:
push:
branches:
- main
tags:
- v*
paths-ignore:
- "webhosting-operator/**"
- "**.md"
pull_request:
paths-ignore:
- "webhosting-operator/**"
- "**.md"
jobs:
verify:
runs-on: ubuntu-latest
# update-codegen requires the workspace to be placed in GOPATH.
# Set up env var, working directory, and check out at the correct path in GOPATH.
env:
GOPATH: /home/runner/work/kubernetes-controller-sharding/kubernetes-controller-sharding/go
defaults:
run:
working-directory: go/src/github.com/timebertt/kubernetes-controller-sharding
steps:
- uses: actions/checkout@v4
with:
path: go/src/github.com/timebertt/kubernetes-controller-sharding
- uses: actions/setup-go@v4
with:
go-version-file: go/src/github.com/timebertt/kubernetes-controller-sharding/go.mod
cache-dependency-path: go/src/github.com/timebertt/kubernetes-controller-sharding/go.sum
- name: Verify
run: make verify
images:
runs-on: ubuntu-latest
env:
# renovate: datasource=github-tags depName=ko-build/ko
KO_VERSION: v0.15.1
steps:
- uses: actions/checkout@v4
with:
# fetch all history so that git describe works (needed by hack/prepare-image-metadata.sh)
fetch-depth: 0
- uses: actions/setup-go@v4
with:
go-version-file: go.mod
- uses: ko-build/[email protected]
with:
version: ${{ env.KO_VERSION }}
- name: Prepare image metadata
id: meta
run: ./hack/prepare-image-metadata.sh
- name: ko build
run: |
set -ex
# prepare .ko.yaml to inject build settings into all images
entrypoints=(
./cmd/sharder
./cmd/shard
./hack/cmd/janitor
)
echo builds: > .ko.yaml
for entrypoint in "${entrypoints[@]}" ; do
cat >> .ko.yaml <<EOF
- main: $entrypoint
ldflags:
- |
{{.Env.LDFLAGS}}
EOF
done
ko build --push=${{ github.event_name != 'pull_request' }} --sbom none --base-import-paths \
--tags "${{ steps.meta.outputs.tags }}" --image-label "${{ steps.meta.outputs.labels }}" \
--platform linux/amd64,linux/arm64 \
"${entrypoints[@]}"