gha: k8s-on-aks: {create,delete} AKS must be a coded-in step

I should have seen this coming, but currently the "create" and "delete"
AKS workflows cannot be imported and uses as a job's step, resulting on
an error trying to find the correspondent action.yaml file for those.

Fixes: #6630

Signed-off-by: Fabiano Fidêncio <fabiano.fidencio@intel.com>
This commit is contained in:
Fabiano Fidêncio 2023-04-06 22:34:33 +02:00
parent ee5dda012b
commit 79f3047f06
3 changed files with 27 additions and 79 deletions

View File

@ -1,32 +0,0 @@
name: CI | Create AKS cluster
on:
workflow_call:
inputs:
name:
required: true
type: string
jobs:
create-aks:
runs-on: ubuntu-latest
steps:
- name: Download Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Log into the Azure account
run: |
az login \
--service-principal \
-u "${{ secrets.AZ_APPID }}" \
-p "${{ secrets.AZ_PASSWORD }}" \
--tenant "${{ secrets.AZ_TENANT_ID }}"
- name: Create AKS cluster
run: |
az aks create \
-g "kataCI" \
-n "${{ inputs.name }}" \
-s "Standard_D4s_v5" \
--node-count 1 \
--generate-ssh-keys

View File

@ -1,31 +0,0 @@
name: CI | Delete AKS cluster
on:
workflow_call:
inputs:
name:
required: true
type: string
jobs:
delete-aks:
runs-on: ubuntu-latest
steps:
- name: Download Azure CLI
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Log into the Azure account
run: |
az login \
--service-principal \
-u "${{ secrets.AZ_APPID }}" \
-p "${{ secrets.AZ_PASSWORD }}" \
--tenant "${{ secrets.AZ_TENANT_ID }}"
- name: Delete AKS cluster
run: |
az aks delete \
-g "kataCI" \
-n "${{ inputs.name }}" \
--yes \
--no-wait

View File

@ -23,22 +23,13 @@ jobs:
- qemu - qemu
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Create AKS cluster to test ${{ matrix.vmm }}
uses: ./.github/workflows-create-aks.yaml
with:
name: ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64
- uses: actions/checkout@v3 - uses: actions/checkout@v3
with: with:
ref: ${{ github.event.pull_request.head.sha }} ref: ${{ github.event.pull_request.head.sha }}
- name: Install `bats`
run: |
sudo apt-get update
sudo apt-get -y install bats
- name: Install `kubectl` - name: Download Azure CLI
run: | run: |
sudo az aks install-cli curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
- name: Log into the Azure account - name: Log into the Azure account
run: | run: |
@ -48,6 +39,24 @@ jobs:
-p "${{ secrets.AZ_PASSWORD }}" \ -p "${{ secrets.AZ_PASSWORD }}" \
--tenant "${{ secrets.AZ_TENANT_ID }}" --tenant "${{ secrets.AZ_TENANT_ID }}"
- name: Create AKS cluster
run: |
az aks create \
-g "kataCI" \
-n "${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64" \
-s "Standard_D4s_v5" \
--node-count 1 \
--generate-ssh-keys
- name: Install `bats`
run: |
sudo apt-get update
sudo apt-get -y install bats
- name: Install `kubectl`
run: |
sudo az aks install-cli
- name: Download credentials for the Kubernetes CLI to use them - name: Download credentials for the Kubernetes CLI to use them
run: | run: |
az aks get-credentials -g "kataCI" -n ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64 az aks get-credentials -g "kataCI" -n ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64
@ -73,8 +82,10 @@ jobs:
env: env:
KATA_HYPERVISOR: ${{ matrix.vmm }} KATA_HYPERVISOR: ${{ matrix.vmm }}
- name: Delete AKS cluster used to test ${{ matrix.vmm }} - name: Delete AKS cluster
if: always() run: |
uses: ./.github/workflows/delete-aks.yaml az aks delete \
with: -g "kataCI" \
name: ${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64 -n "${{ github.event.pull_request.number }}-${{ github.event.pull_request.head.sha }}-${{ matrix.vmm }}-amd64" \
--yes \
--no-wait