chore: bump step-security/harden-runner from 2.5.1 to 2.6.1 #217
Workflow file for this run
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: e2e-test | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} | |
cancel-in-progress: true | |
on: | |
workflow_dispatch: {} | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
env: | |
GO_VERSION: "1.20" | |
permissions: | |
id-token: write # This is required for requesting the JWT | |
contents: read # This is required for actions/checkout | |
jobs: | |
e2e-tests: | |
env: | |
E2E_IMG_TAG: "e2e-gpu" | |
runs-on: ubuntu-latest | |
environment: e2e-test | |
steps: | |
- name: Set up Go ${{ env.GO_VERSION }} | |
uses: actions/setup-go@v4 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
fetch-depth: 0 | |
- name: Shorten SHA | |
id: vars | |
run: echo "::set-output name=pr_sha_short::$(git rev-parse --short ${{ github.event.pull_request.head.sha }} )" | |
- name: Set e2e Resource and Cluster Name | |
run: | | |
rand=${{ steps.vars.outputs.pr_sha_short }} | |
if [ "$rand" = "" ]; then | |
rand=$RANDOM | |
fi | |
echo "VERSION=${rand}" >> $GITHUB_ENV | |
echo "CLUSTER_NAME=gpuprov${rand}" >> $GITHUB_ENV | |
- name: Install Azure CLI latest | |
run: | | |
if ! which az > /dev/null; then | |
echo "Azure CLI not found. Installing..." | |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash | |
else | |
echo "Azure CLI already installed." | |
fi | |
- uses: azure/[email protected] | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
allow-no-subscriptions: true | |
- name: Set subscription | |
run: az account set --subscription ${{secrets.SUBSCRIPTION_ID}} | |
- name: Install Helm | |
uses: azure/setup-helm@v3 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
id: install | |
- name: Create ACR | |
shell: bash | |
run: | | |
make az-mkacr | |
env: | |
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | |
AZURE_ACR_NAME: ${{ env.CLUSTER_NAME }} | |
- name: Create Azure Identity | |
shell: bash | |
run: | | |
az identity create --name gpuIdentity --resource-group ${{ env.CLUSTER_NAME }} | |
- name: Build gpu-provisioner image | |
shell: bash | |
run: | | |
make docker-build | |
env: | |
REGISTRY: ${{ env.CLUSTER_NAME }}.azurecr.io | |
VERSION: ${{ env.VERSION }} | |
- name: Create cluster | |
shell: bash | |
run: | | |
make az-mkaks | |
env: | |
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | |
AZURE_ACR_NAME: ${{ env.CLUSTER_NAME }} | |
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | |
- name: Install GPU-Provisioner helm chart | |
shell: bash | |
run: | | |
echo "IDENTITY_CLIENT_ID=$(az identity show --name gpuIdentity -g "${{ env.CLUSTER_NAME }}" --query 'clientId' -otsv)" >> $GITHUB_ENV | |
make az-patch-helm | |
helm install gpu-provisioner ./charts/gpu-provisioner | |
kubectl wait --for=condition=available deploy "gpu-provisioner" -n gpu-provisioner --timeout=300s | |
env: | |
AZURE_RESOURCE_GROUP: ${{ env.CLUSTER_NAME }} | |
AZURE_ACR_NAME: ${{ env.CLUSTER_NAME }} | |
AZURE_CLUSTER_NAME: ${{ env.CLUSTER_NAME }} | |
REGISTRY: ${{ env.CLUSTER_NAME }}.azurecr.io | |
VERSION: ${{ env.VERSION }} | |
- uses: azure/[email protected] | |
with: | |
client-id: ${{ secrets.AZURE_CLIENT_ID }} | |
tenant-id: ${{ secrets.AZURE_TENANT_ID }} | |
subscription-id: ${{ secrets.SUBSCRIPTION_ID }} | |
- name: Create Role Assignment | |
shell: bash | |
run: | | |
IDENTITY_PRINCIPAL_ID="$(az identity show --name gpuIdentity --resource-group ${{ env.CLUSTER_NAME }} --query 'principalId' -otsv)" | |
az role assignment create --assignee ${IDENTITY_PRINCIPAL_ID} --scope "/subscriptions/${{ secrets.SUBSCRIPTION_ID }}/resourceGroups/${{ env.CLUSTER_NAME }}/providers/Microsoft.ContainerService/managedClusters/${{ env.CLUSTER_NAME }}" --role "Contributor" | |
- name: Create Azure Federated Identity | |
shell: bash | |
run: | | |
AKS_OIDC_ISSUER="$(az aks show -n "${{ env.CLUSTER_NAME }}" -g "${{ env.CLUSTER_NAME }}" --query 'oidcIssuerProfile.issuerUrl' -otsv)" | |
az identity federated-credential create --name gpu-fed-credential --identity-name gpuIdentity --resource-group "${{ env.CLUSTER_NAME }}" \ | |
--issuer "${AKS_OIDC_ISSUER}" --subject system:serviceaccount:"gpu-provisioner:gpu-provisioner" --audience api://AzureADTokenExchange | |
- name: Run e2e test | |
run: | | |
make e2etests | |
- name: Cleanup e2e resources | |
if: ${{ always() }} | |
run: | | |
set +e | |
az group delete --name "${{ env.CLUSTER_NAME }}" --yes --no-wait || true |