-
Notifications
You must be signed in to change notification settings - Fork 1
106 lines (88 loc) · 2.34 KB
/
operator_build.yml
File metadata and controls
106 lines (88 loc) · 2.34 KB
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
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
name: Operator Build
on:
workflow_dispatch:
push:
branches:
- main
paths-ignore:
- '.github/**'
- 'hack/**'
- '*.md'
- 'MAKEFILE'
pull_request:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
binary:
runs-on: ubuntu-latest
name: Build Operator Binary
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache tools
uses: actions/cache@v4
with:
path: ./bin
key: ${{ runner.os }}-bin-${{ hashFiles('Makefile') }}
- name: Install go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'
- name: Verify tidy
run: |
go mod tidy
git diff -s --exit-code
- name: Lint codebase
run: make lint
- name: Run unit tests
run: make test
- name: Build the operator
run: make build
generation:
runs-on: ubuntu-latest
name: Generate Operator Manifests
needs: binary
steps:
- name: Checkout sources
uses: actions/checkout@v4
- name: Cache tools
uses: actions/cache@v4
with:
path: ./bin
key: ${{ runner.os }}-bin-${{ hashFiles('Makefile') }}
- name: Generate RBAC manifests
# tidy and restore are a patch required only for ci runner
run: |
go mod tidy
make generate manifests
git restore go.mod go.sum
- name: Fail if generated diff
run: git diff -s --exit-code
image:
runs-on: ubuntu-latest
name: Build Operator Image
needs: binary
steps:
- name: Checkout sources
uses: actions/checkout@v4
# required for caching podman images
- name: Tar as root
run: |
sudo mv -fv /usr/bin/tar /usr/bin/tar.orig
echo -e '#!/bin/sh\n\nsudo /usr/bin/tar.orig "$@"' | sudo tee -a /usr/bin/tar
sudo chmod +x /usr/bin/tar
- name: Cache podman images
uses: actions/cache@v4
with:
path: |
~/.local/share/containers
~/.config/containers
key: ${{ runner.os }}-operator-image-${{ hashFiles('Containerfile') }}
- name: Build container image
run: make container-build