-
Notifications
You must be signed in to change notification settings - Fork 9
154 lines (137 loc) · 4.87 KB
/
ci.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
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
---
name: ci
on:
pull_request:
push:
branches:
- 'release/**'
concurrency:
group: '${{ github.ref_name }}'
cancel-in-progress: true
jobs:
yamllint:
uses: networkservicemesh/.github/.github/workflows/yamllint.yaml@main
shellcheck:
uses: networkservicemesh/.github/.github/workflows/shellcheck.yaml@main
golangci-lint:
uses: networkservicemesh/.github/.github/workflows/golangci-lint.yaml@main
exclude-fmt-errorf:
uses: networkservicemesh/.github/.github/workflows/exclude-fmt-errorf.yaml@main
checkgomod:
uses: networkservicemesh/.github/.github/workflows/checkgomod.yaml@main
packet:
name: packet (CNI ${{ matrix.CNI }})
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
CNI: ["default", "calico-vpp"]
steps:
- name: Set up /bin permissions
run: |
sudo chmod -R 777 /bin
- name: Set envs
run: |
id=${{ matrix.CNI }}-${{ github.run_number }}
echo METRO=ny >> $GITHUB_ENV
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then
id=calico-${{ github.run_number }}
echo METRO=at >> $GITHUB_ENV
fi
echo CLUSTER_NAME=nsm-ci-${id} >> $GITHUB_ENV
echo SSH_KEY=nsm-ssh-${id} >> $GITHUB_ENV
- name: Set up go
uses: actions/setup-go@v1
with:
go-version: 1.20.5
- name: Checkout files
uses: actions/checkout@v2
with:
path: ${{ github.repository }}
- name: Install kind
uses: engineerd/[email protected]
with:
config: ${{ github.repository }}/kind-cluster-config.yaml
version: v0.20.0
image: kindest/node:v1.28.0
- name: Check kind
run: |
kubectl version
kubectl get pods -n kube-system
- name: Install clusterctl
run: |
curl -L https://github.com/kubernetes-sigs/cluster-api/releases/download/v1.5.2/clusterctl-linux-amd64 -o clusterctl
chmod +x ./clusterctl
mv ./clusterctl /usr/local/bin/clusterctl
clusterctl version
- name: Install metal CLI
run: |
curl -L https://github.com/equinix/metal-cli/releases/download/v0.16.0/metal-linux-amd64 -o metal
chmod +x ./metal
mv ./metal /usr/local/bin/metal
metal -v
- name: Checkout deployments
uses: actions/checkout@v2
with:
repository: networkservicemesh/deployments-k8s
path: networkservicemesh/deployments-k8s
- name: Setup ssh
working-directory: ${{ github.repository }}
id: setup_ssh
run: |
ssh-keygen -t rsa -f /tmp/sshkey -q -N ""
eval `ssh-agent -s`
ssh-add /tmp/sshkey
ssh_id=$(metal ssh-key create --key "$(cat /tmp/sshkey.pub)" --label ${SSH_KEY} -o json | jq -r '.id')
echo ssh_id=${ssh_id} >> $GITHUB_OUTPUT
env:
METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
- name: Setup cluster
uses: nick-fields/[email protected]
with:
timeout_minutes: 50
max_attempts: 3
command: |
cd ${{ github.repository }}
scripts/setup-cluster.sh "/tmp/sshkey"
on_retry_command: |
cd ${{ github.repository }}
scripts/cleanup-cluster.sh
env:
# METRO env was set above
PACKET_API_KEY: ${{ secrets.PACKET_AUTH_TOKEN }}
METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18
NODE_OS: ubuntu_20_04
KUBERNETES_VERSION: "v1.27.1"
CNI: ${{ matrix.CNI }}
CONTROLPLANE_NODE_TYPE: "n3.xlarge.x86"
WORKER_NODE_TYPE: "n3.xlarge.x86"
- name: Integration tests
run: |
export KUBECONFIG=$HOME/.kube/config_packet
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then
go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4 || true
else
go test -count 1 -timeout 1h50m -race -v ./tests_${{ matrix.CNI }} -parallel 4
fi
env:
ARTIFACTS_DIR: logs
working-directory: ${{ github.repository }}
- name: Upload logs
uses: actions/upload-artifact@v2
if: ${{ always() }}
with:
name: ${{ matrix.CNI }}-logs
path: ${{ github.repository }}/tests_${{ matrix.CNI }}/logs
- name: Cleanup
if: ${{ always() }}
working-directory: ${{ github.repository }}
run: |
export KUBECONFIG=$HOME/.kube/config
yes | metal ssh-key delete --id "${{ steps.setup_ssh.outputs.ssh_id }}"
scripts/cleanup-cluster.sh
env:
PROJECT_ID: 383890d0-f5d1-4de1-881a-4d1ede549d18
METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }}