-
Notifications
You must be signed in to change notification settings - Fork 1
132 lines (121 loc) · 4.95 KB
/
remote-controller.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
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
name: Lagoon Remote Controller Test
on:
push:
branches:
- main
- re-namespace
pull_request:
branches:
- main
jobs:
test-suite:
runs-on: ubuntu-latest
continue-on-error: ${{ matrix.experimental }}
strategy:
fail-fast: false
matrix:
kindest_node_version: [v1.21.12, v1.22.9]
harbor: ["1.9.0","1.12.2"]
lagoon_build_image: ["uselagoon/build-deploy-image:main"]
experimental: [false]
include:
- kindest_node_version: v1.23.6
harbor: "1.12.2"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: true
- kindest_node_version: v1.24.7
harbor: "1.12.2"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: true
- kindest_node_version: v1.25.3
harbor: "1.12.2"
lagoon_build_image: "uselagoon/build-deploy-image:main"
experimental: true
steps:
- name: Setup tmate session
uses: mxschmitt/action-tmate@v3
timeout-minutes: 1
continue-on-error: true
- name: Checkout
uses: actions/checkout@v2
with:
fetch-depth: "0"
- name: Set up testing dependencies
run: sudo apt-get update && sudo apt-get -y install build-essential && sudo apt-get clean
- name: Setup correct Go version
uses: actions/setup-go@v2
with:
go-version: '1.17'
- name: Install kubebuilder
run: |
#kubebuilder
curl -sL https://github.com/kubernetes-sigs/kubebuilder/releases/download/v2.3.2/kubebuilder_2.3.2_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mkdir -p /usr/local/kubebuilder/bin
sudo mv /tmp/kubebuilder_2.3.2_linux_amd64/bin/* /usr/local/kubebuilder/bin
chmod +x /usr/local/kubebuilder/bin/*
echo "/usr/local/kubebuilder/bin" >> $GITHUB_PATH
curl -sL https://github.com/itaysk/kubectl-neat/releases/download/v2.0.3/kubectl-neat_linux_amd64.tar.gz | tar -xz -C /tmp/
sudo mkdir -p /usr/local/kubectl-neat/bin
sudo mv /tmp/kubectl-neat /usr/local/kubectl-neat/bin
chmod +x /usr/local/kubectl-neat/bin/*
echo "/usr/local/kubectl-neat/bin" >> $GITHUB_PATH
- name: Check go, kustomize, kubebuilder, helm, kind versions
run: |
go version
kustomize version
helm version
kubebuilder version
kind version
- name: Add dependency chart repos
run: |
helm repo add ingress-nginx https://kubernetes.github.io/ingress-nginx
helm repo add harbor https://helm.goharbor.io
helm repo add lagoon https://uselagoon.github.io/lagoon-charts/
- name: Install gojq
if: |
(steps.list-changed.outputs.changed == 'true') ||
(contains(github.event.pull_request.labels.*.name, 'needs-testing'))
run: |
cd /tmp
curl -sSLO https://github.com/itchyny/gojq/releases/download/v0.11.1/gojq_v0.11.1_linux_amd64.tar.gz
tar -xf ./gojq_v0.11.1_linux_amd64.tar.gz
sudo cp /tmp/gojq_v0.11.1_linux_amd64/gojq /usr/local/bin/jq
- name: Configure node IP in kind-config.yaml
run: |
docker network create kind
export KIND_NODE_IP=$(docker run --network kind --rm alpine ip -o addr show eth0 | sed -nE 's/.* ([0-9.]{7,})\/.*/\1/p')
envsubst < test-resources/kind-config.yaml.tpl > test-resources/kind-config.yaml
cat test-resources/kind-config.yaml
- name: Create kind cluster
uses: helm/[email protected]
with:
version: v0.14.0
node_image: kindest/node:${{ matrix.kindest_node_version }}
config: test-resources/kind-config.yaml
- name: Check node IP matches kind configuration
run: |
NODE_IP="$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}')"
echo Checking for NODE_IP "$NODE_IP"
grep $NODE_IP test-resources/kind-config.yaml
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
- name: Build
uses: docker/build-push-action@v2
with:
context: .
load: true
tags: uselagoon/remote-controller:test-tag
- name: Install prerequisites
run: make -j8 -O install-lagoon-remote HARBOR_VERSION=${{matrix.harbor}}
- name: Run Tests
run: |
export PATH=$PATH:/usr/local/kubebuilder/bin
export PATH=$PATH:/usr/local/go/bin
export GOPATH=$HOME/go
export OVERRIDE_BUILD_DEPLOY_DIND_IMAGE="${{matrix.lagoon_build_image}}"
export HARBOR_URL="http://harbor.$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080"
export HARBOR_API="http://harbor.$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}').nip.io:32080/api"
export KIND_NODE_IP="$(kubectl get nodes -o jsonpath='{.items[0].status.addresses[0].address}')"
export HARBOR_VERSION=${{matrix.harbor}}
# export GO111MODULE=on
make controller-test