-
Notifications
You must be signed in to change notification settings - Fork 28
129 lines (113 loc) · 4.55 KB
/
ci-e2e-checks.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
name: e2e-checks
on:
pull_request:
branches:
- master
- release-*
push:
branches:
- master
- release-*
jobs:
e2e-tests:
runs-on: ubuntu-latest
strategy:
matrix:
k8s-version:
- v1.19
- v1.18
- v1.17
- v1.16
include:
- k8s-version: v1.19
kind-node-image: kindest/node:v1.19.1@sha256:98cf5288864662e37115e362b23e4369c8c4a408f99cbc06e58ac30ddc721600
- k8s-version: v1.18
kind-node-image: kindest/node:v1.18.8@sha256:f4bcc97a0ad6e7abaf3f643d890add7efe6ee4ab90baeb374b4f41a4c95567eb
- k8s-version: v1.17
kind-node-image: kindest/node:v1.17.11@sha256:5240a7a2c34bf241afb54ac05669f8a46661912eab05705d660971eeb12f6555
- k8s-version: v1.16
kind-node-image: kindest/node:v1.16.15@sha256:a89c771f7de234e6547d43695c7ab047809ffc71a0c3b65aa54eda051c45ed20
name: e2e-tests for K8s ${{ matrix.k8s-version }}
steps:
- name: Check out the repo
uses: actions/checkout@v2
# Collect Release SHA Tag is used to to collect information needed later in the action and expose it so it can be referenced
- name: Collect Release SHA Tag
id: prep
run: |
echo ::set-output name=releasetag::sha-${GITHUB_SHA::7}
# Part of docker/build-push-action@v2; setting up the build system
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
with:
driver: docker-container
driver-opts: image=moby/buildkit:buildx-stable-1
use: true
- name: Build magtape-init Container Image
timeout-minutes: 10
uses: docker/build-push-action@v2
with:
context: ./app/magtape-init/
# file should be specified relative to the repo root rather than relative to the context
file: ./app/magtape-init/Dockerfile
# Don't push the image to a registry
push: false
# Load image into local docker default context
outputs: type=docker
# Uses the releasetag output exposed by the Collect Release SHA Tag step to set the tag under v2
tags: tmobile/magtape-init:${{ steps.prep.outputs.releasetag }}
- name: Build magtape Container Image
timeout-minutes: 10
uses: docker/build-push-action@v2
with:
context: ./app/magtape/
# file should be specified relative to the repo root rather than relative to the context
file: ./app/magtape/Dockerfile
# Don't push the image to a registry
push: false
# Load image into local docker default context
outputs: type=docker
# Uses the releasetag output exposed by the Collect Release SHA Tag step to set the tag under v2
tags: tmobile/magtape:${{ steps.prep.outputs.releasetag }}
- name: Setup KinD Cluster
timeout-minutes: 10
uses: engineerd/setup-kind@v0.4.0
with:
version: "v0.9.0"
image: ${{ matrix.kind-node-image }}
- name: Install MagTape
timeout-minutes: 10
# kind load docker-image: loads image from docker default context into kind node image cache
run: |
echo "Loading MagTape images to KinD nodes"
GIT_SHA=${{github.sha}}
kind load docker-image tmobile/magtape-init:sha-${GIT_SHA::7}
kind load docker-image tmobile/magtape:sha-${GIT_SHA::7}
echo "Updating target image to use local ref"
sed -i='' -E "s/(MAGTAPE_VERSION := )(.*$)/\1sha-${GIT_SHA::7}/" Makefile
sed -i='' -E 's/(imagePullPolicy:) Always/\1 IfNotPresent/' deploy/manifests/magtape-deploy.yaml
make set-release-version
make build-single-manifest
echo "Install MagTape"
make install
EXPECTED_REPLICAS=$(kubectl get deploy -n magtape-system magtape -o jsonpath='{.status.replicas}')
READY_REPLICAS=$(kubectl get deploy -n magtape-system magtape -o jsonpath='{.status.readyReplicas}')
while [ "${READY_REPLICAS}" != "${EXPECTED_REPLICAS}" ]; do
READY_REPLICAS=$(kubectl get deploy -n magtape-system magtape -o jsonpath='{.status.readyReplicas}')
echo "Replicas aren't all ready yet: ${READY_REPLICAS:=0}/${EXPECTED_REPLICAS}"
sleep 2
done
- name: Configure Test Namespace
timeout-minutes: 5
run: |
make ns-create-test
- name: Install Tools
timeout-minutes: 5
run: |
sudo add-apt-repository ppa:rmescandon/yq
sudo apt update
sudo apt install yq -y
- name: Execute Functional Tests
timeout-minutes: 5
run: |
make test-functional