forked from kyma-project/lifecycle-manager
-
Notifications
You must be signed in to change notification settings - Fork 0
153 lines (149 loc) · 5.91 KB
/
test-smoke.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
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
name: TestSuite Smoke
on:
push:
branches: [ "main" ]
paths:
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '**.go'
- '**.ya?ml'
pull_request:
branches: [ "main" ]
paths:
- 'go.mod'
- 'go.sum'
- 'Makefile'
- '**.go'
- '**.ya?ml'
jobs:
wait-for-img:
name: "Wait for Image Build"
runs-on: ubuntu-latest
steps:
- uses: autotelic/action-wait-for-status-check@v1
id: wait-for-build
with:
token: ${{ secrets.GITHUB_TOKEN }}
# Context for which we should look for the matching status
statusName: ${{ (github.event_name == 'pull_request') && 'pull-lifecycle-mgr-build' || 'main-lifecycle-mgr-build' }}
timeoutSeconds: 600
intervalSeconds: 10
- name: Exit If Failing Build Requirement
if: steps.wait-for-build.outputs.state != 'success'
run: |
echo "Image build did not succeed, skipping Smoke Test!"
exit 1
kustomize:
strategy:
matrix:
flavor: ["", "-control-plane"]
name: "Kustomize (dry-run${{ matrix.flavor }})"
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: 'go.mod'
cache-dependency-path: 'go.sum'
- run: make dry-run${{ matrix.flavor }} IMG='*:latest'
- name: Archive Manifests
uses: actions/upload-artifact@v3
with:
retention-days: 5
name: dry-run${{ matrix.flavor }}
path: |
dry-run/*.yaml
cli-integration:
strategy:
matrix:
cli-stability: ["unstable"]
target: ["default", "control-plane"]
needs: [kustomize,wait-for-img]
name: "kyma (${{ matrix.cli-stability }}) alpha deploy -k config/${{ matrix.target }}"
runs-on: ubuntu-latest
env:
LIFECYCLE_MANAGER: ${{ github.repository }}
K3D_VERSION: v5.4.7
KUSTOMIZE_VERSION: 4.5.7
ISTIO_VERSION: 1.17.1
GOSUMDB: off
steps:
- name: Install prerequisites
run: |
curl -fsSL https://pkgs.k8s.io/core:/stable:/v1.28/deb/Release.key | sudo gpg --batch --yes --dearmor -o /etc/apt/keyrings/kubernetes-apt-keyring.gpg
echo 'deb [signed-by=/etc/apt/keyrings/kubernetes-apt-keyring.gpg] https://pkgs.k8s.io/core:/stable:/v1.28/deb/ /' | sudo tee /etc/apt/sources.list.d/kubernetes.list
sudo apt update -y
sudo apt install kubectl -y
- name: Checkout Lifecycle-Manager
uses: actions/checkout@v3
- name: Setup kustomize
run: |
wget --header="Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \
-qO - "https://raw.githubusercontent.com/kubernetes-sigs/kustomize/master/hack/install_kustomize.sh" | bash -s "$KUSTOMIZE_VERSION"
mv kustomize /usr/local/bin/
- name: Override Kustomize Controller Image TAG in Pull Request to PR Image
if: ${{ github.event_name == 'pull_request' }}
run: |
cd config/manager && kustomize edit set image controller="europe-docker.pkg.dev/kyma-project/dev/lifecycle-manager:PR-${{ github.event.pull_request.number }}"
- name: Set up k3d
run: wget -qO - https://raw.githubusercontent.com/k3d-io/k3d/main/install.sh | TAG=$K3D_VERSION bash
- id: kyma
run: |
wget -q https://storage.googleapis.com/kyma-cli-${{ matrix.cli-stability }}/kyma-linux
chmod +x kyma-linux && mv kyma-linux /usr/local/bin/kyma-${{ matrix.cli-stability }}
echo "PATH=/usr/local/bin/kyma-${{ matrix.cli-stability }}" >> $GITHUB_OUTPUT
- run: ln -s /usr/local/bin/kyma-${{ matrix.cli-stability }} /usr/local/bin/kyma
- name: Run Provision
run: |
kyma --ci provision k3d \
-p 8083:80@loadbalancer \
-p 8443:443@loadbalancer \
--timeout 1m \
--k3d-arg --no-rollback \
--name kyma
- name: Update Kubeconfigs
run: k3d kubeconfig merge -a -d
- name: Setup Control-Plane requirements
if: ${{ matrix.target == 'control-plane' }}
run: |
kubectl label node k3d-kyma-server-0 iam.gke.io/gke-metadata-server-enabled=true
curl -L https://istio.io/downloadIstio | TARGET_ARCH=x86_64 sh -
chmod +x istio-$ISTIO_VERSION/bin/istioctl
mv istio-$ISTIO_VERSION/bin/istioctl /usr/local/bin
istioctl install --set profile=demo -y
kubectl create namespace kyma-system
kubectl create namespace kcp-system
kubectl apply -f https://raw.githubusercontent.com/prometheus-community/helm-charts/kube-prometheus-stack-47.0.0/charts/kube-prometheus-stack/crds/crd-servicemonitors.yaml
- name: Deploy lifecycle manager with Kyma CLI
run: kyma --ci alpha deploy -k config/${{ matrix.target }}
- name: Deploy template operator module template and enable module
if: ${{ matrix.target == 'default' }}
run: |
cat << EOF | kubectl apply -f -
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRole
metadata:
name: kyma-cli-provisioned-wildcard
rules:
- apiGroups: ["*"]
resources: ["*"]
verbs: ["*"]
---
apiVersion: rbac.authorization.k8s.io/v1
kind: ClusterRoleBinding
metadata:
name: lifecycle-manager-wildcard
roleRef:
apiGroup: rbac.authorization.k8s.io
kind: ClusterRole
name: kyma-cli-provisioned-wildcard
subjects:
- kind: ServiceAccount
name: lifecycle-manager-controller-manager
namespace: kcp-system
EOF
kubectl apply -f tests/moduletemplates/moduletemplate_template_operator_regular.yaml
kyma alpha enable module template-operator -c regular -n kyma-system -k default-kyma