-
Notifications
You must be signed in to change notification settings - Fork 1
134 lines (129 loc) · 3.9 KB
/
ci.yml
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
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: CI
on:
push:
branches:
- main
- "release-*"
pull_request:
branches:
- main
- "release-*"
concurrency:
group: Trustify-CI-${{ github.ref }}
cancel-in-progress: true
jobs:
rancher:
runs-on: ubuntu-latest
strategy:
matrix:
kubernetes_version:
[
latest,
v1.23.17-k3s1,
v1.24.17-k3s1,
v1.25.16-k3s4,
v1.26.15-k3s1,
v1.27.15-k3s2,
v1.28.11-k3s2,
]
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "maven"
- name: Test
env:
KUBERNETES_VERSION: ${{ matrix.kubernetes_version }}
run: mvn verify
crc-presets:
runs-on: ubuntu-latest
outputs:
presets: ${{ steps.presets.outputs.presets }}
steps:
- name: Define presets
id: presets
env:
PULL_SECRET: ${{ secrets.PULL_SECRET }}
run: |
if [[ -n "${PULL_SECRET}" ]];then
echo 'presets=["okd", "openshift", "microshift"]' >> "$GITHUB_OUTPUT"
else
echo 'presets=["okd"]' >> "$GITHUB_OUTPUT"
fi
crc:
runs-on: ubuntu-latest
needs: [ crc-presets ]
strategy:
matrix:
preset: ${{ fromJSON(needs.crc-presets.outputs.presets) }}
fail-fast: false
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v4
with:
distribution: "temurin"
java-version: "21"
cache: "maven"
- name: Install required virtualization software
run: |
sudo apt-get update
sudo apt install qemu-kvm libvirt-daemon libvirt-daemon-system
sudo usermod -a -G libvirt $USER
- name: Remove unwanted stuff to free up disk image
run: |
df -h
sudo rm -rf /usr/share/dotnet
sudo rm -rf /usr/local/lib/android
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /opt/hostedtoolcache/CodeQL
sudo docker image prune --all --force
sudo swapoff -a
sudo rm -f /mnt/swapfile
df -h
- name: Download crc
run: |
wget https://developers.redhat.com/content-gateway/file/pub/openshift-v4/clients/crc/2.40.0/crc-linux-amd64.tar.xz
mkdir -p bin/ && tar -xJf crc-linux-amd64.tar.xz --strip-components=1 -C bin/
sudo mv ./bin/crc /usr/local/bin/crc && rm -r bin/
- name: Set the crc config
run: |
crc config set consent-telemetry no
crc config set network-mode user
crc config set preset ${{ matrix.preset }}
- name: Setup the crc
run: sudo -su $USER crc setup
- name: Start the crc
env:
PULL_SECRET: ${{ secrets.PULL_SECRET }}
run: |
OPTS=""
if [[ -n "${PULL_SECRET}" ]];then
echo "${PULL_SECRET}" > pull-secret.txt
OPTS="-p pull-secret.txt"
fi
sudo -su $USER crc start ${OPTS}
- name: Test
run: |
export HOST_KUBERNETES_CONFIG_FILE=${HOME}/.kube/config
echo "Using ${HOST_KUBERNETES_CONFIG_FILE} as host k8s"
mvn verify
build-operator-bundle:
runs-on: ubuntu-latest
env:
IMG: ttl.sh/trustify-operator-${{ github.sha }}:2h
BUNDLE_IMG: ttl.sh/trustify-operator-bundle-${{ github.sha }}:2h
steps:
- uses: actions/checkout@v4
- name: Create operator
run: DOCKERFILE=Dockerfile.jvm make docker-build docker-push
- name: Create operator-bundle
run: make bundle-build bundle-push
run-ci:
needs: build-operator-bundle
uses: trustification/trustify-ci/.github/workflows/global-ci.yml@main
with:
operator_bundle: ttl.sh/trustify-operator-bundle-${{ github.sha }}:2h