Update deprecated github actions #1568
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: Install metal CLI | |
run: | | |
curl -L https://github.com/equinix/metal-cli/releases/download/v0.22.0/metal-linux-amd64 -o metal | |
chmod +x ./metal | |
mv ./metal /usr/local/bin/metal | |
metal -v | |
- name: Set envs | |
run: | | |
id=${{ matrix.CNI }}-${{ github.run_number }} | |
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then | |
id=calico-${{ github.run_number }} | |
fi | |
echo CLUSTER_NAME=nsm-ci-${id} >> $GITHUB_ENV | |
echo SSH_KEY=nsm-ssh-${id} >> $GITHUB_ENV | |
- name: Find metro | |
run: | | |
metros_to_check=da,ny | |
if [[ "${{ matrix.CNI }}" == "calico-vpp" ]]; then | |
metros_to_check=at,ch | |
fi | |
METRO=$(metal capacity check -m ${metros_to_check} -P n3.xlarge.x86 -q 2 -o json | jq -r '[.[] | select( .available == true ) | .metro][0]') | |
if [ ${METRO} == "null" ]; then | |
exit 1; | |
fi | |
echo METRO=${METRO} >> $GITHUB_ENV | |
env: | |
METAL_AUTH_TOKEN: ${{ secrets.PACKET_AUTH_TOKEN }} | |
- name: Set up go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: 1.20.11 | |
- name: Checkout files | |
uses: actions/checkout@v4 | |
with: | |
path: ${{ github.repository }} | |
- name: Install kind | |
uses: helm/kind-action@v1 | |
with: | |
config: ${{ github.repository }}/kind-cluster-config.yaml | |
version: v0.20.0 | |
node_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.6.2/clusterctl-linux-amd64 -o clusterctl | |
chmod +x ./clusterctl | |
mv ./clusterctl /usr/local/bin/clusterctl | |
clusterctl version | |
- 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/retry@v3 | |
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@v3 | |
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 }} |