Update from update/networkservicemesh/integration-k8s-kind #1484
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
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 }} |