-
Notifications
You must be signed in to change notification settings - Fork 1
107 lines (107 loc) · 4.25 KB
/
e2e.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
name: e2e
on:
pull_request:
push:
branches:
- master
env:
KUBECONFIG: k3s.yaml
jobs:
test:
name: test
runs-on: ubuntu-latest
strategy:
max-parallel: 2
matrix:
target: [ci_all]
steps:
- name: Set up go
uses: actions/setup-go@v2
with:
go-version: '1.15'
- name: checkout code
uses: actions/checkout@master
- name: build mainnet-observer image
run: docker build -t localhost/mainnet-observer:local .
- name: spin up k3s
uses: insolar/[email protected]
with:
kubectl_version: "v1.18.2"
k3s_tag: "v1.17.4-k3s1"
custom_registry: true
registries_yaml_path: "deploy/registries.yaml"
- name: set PAT for github http auth
run: |
git config --global url."https://${{secrets.INS_SERVICE_PAT}}@github.com/".insteadOf "https://github.com/"
kubectl create ns insolar && kubectl -n insolar create secret generic ins-service-pat --from-literal=INS_SERVICE_PAT=${{secrets.INS_SERVICE_PAT}}
- name: set up local registry
run: kubectl apply -k https://github.com/insolar/gitops/k3s-registry
- name: wait for registry to be up and running
run: kubectl -n registry rollout status deploy/registry --timeout=80s
- name: push mainnet-observer image to local registry
run: docker push localhost/mainnet-observer:local
- name: deploy insolar-mainnet
run: kubectl apply -k deploy/mainnet
- name: wait for bootstrap completion
run: |
echo "waiting for bootstrap completion…"
for attempt in {1..120}; do
STATUS=$(kubectl -n insolar get po bootstrap -o jsonpath='{.status.phase}')
[[ "${STATUS}" == "Succeeded" ]] && exit 0 || sleep 1
done
exit 1
- name: wait for insolar network initialization
run: |
echo "waiting for insolar network initialization…"
for try in {0..180}; do
if kubectl -n insolar exec -i deploy/pulsewatcher -- bash -c 'pulsewatcher -c /etc/pulsewatcher/pulsewatcher.yaml -s' | grep 'READY' | grep -v 'NOT'; then
exit 0
else
sleep 1
fi
done
exit 1
- name: wait for observer-replicator pod to be up and running
run: kubectl -n insolar rollout status sts/observer-replicator -w --timeout=60s
- name: spawn autotests pod
run: |
# create secret
kubectl -n insolar create secret docker-registry ins-registry \
--docker-server=${{ secrets.REGISTRY_URL }} \
--docker-username=${{ secrets.REGISTRY_USERNAME }} \
--docker-password=${{ secrets.REGISTRY_PASSWORD }}
# patch sa
kubectl -n insolar patch sa default -p '{"imagePullSecrets":[{"name":"ins-registry"}]}'
kubectl -n insolar apply -k deploy/autotests-pod
- name: wait for pod initialization
run: |
for attempt in {1..10}; do
STATUS=$(kubectl -n insolar get po go-autotests -o jsonpath='{.status.phase}')
[[ "${STATUS}" == "Running" ]] && exit 0 || sleep $attempt
done
- name: run autotests
run: |
kubectl -n insolar get po
kubectl -n insolar exec go-autotests -- /bin/sh -c 'git config --global url."https://${INS_SERVICE_PAT}@github.com".insteadOf "https://github.com"'
kubectl -n insolar exec go-autotests -- make ${{matrix.target}} > logs.log
- name: display logs
if: always()
run: cat logs.log
- name: Download go-test-parser
if: failure()
run: |
mkdir -p $GITHUB_WORKSPACE/bin
curl -L -s "https://github.com/Tsovak/go-test-parser/releases/download/v1.0.2/go-test-parser_v1.0.2_Linux_x86_64.tar.gz" -o go-test-parser.tar.gz
tar -xf go-test-parser.tar.gz -C $GITHUB_WORKSPACE/bin/
chmod +x bin/go-test-parser
echo "::add-path::$GITHUB_WORKSPACE/bin"
- name: Create tests report
if: failure()
run: |
go-test-parser logs.log -o report
- name: Upload report to artifacts
if: failure()
uses: actions/upload-artifact@v2
with:
name: ${{matrix.target}}
path: "report"