Skip to content

Commit

Permalink
Fix e2e pipeline
Browse files Browse the repository at this point in the history
Signed-off-by: Heba Elayoty <[email protected]>
  • Loading branch information
helayoty committed Jan 18, 2024
1 parent 8db4813 commit f1773aa
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 69 deletions.
52 changes: 17 additions & 35 deletions .github/workflows/aks-addon-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,33 +12,19 @@ on:
branches: [master]
paths-ignore: ['docs/**', '**.md', '**.mdx', '**.png', '**.jpg']

permissions:
id-token: write
contents: read

env:
REGISTRY: ghcr.io
# Common versions
GO_VERSION: '1.20'
GO_VERSION: '1.20' # Common versions
E2E_IMG_TAG: 'e2e-ci'

jobs:
export-registry:
runs-on: ubuntu-20.04
outputs:
registry: ${{ steps.export.outputs.registry }}
steps:
- id: export
run: |
# registry must be in lowercase
echo "::set-output name=registry::$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])"
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout

jobs:
aks-addon-e2e-tests:
needs: export-registry
environment: test
env:
REGISTRY: ${{ needs.export-registry.outputs.registry }}
E2E_IMG_TAG: "e2e-ci"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
Expand All @@ -51,30 +37,26 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Shorten SHA
id: vars
run: echo "::set-output name=pr_sha_short::$(git rev-parse --short ${{ github.event.pull_request.head.sha }} )"
- name: Get Repo
run: |
echo "REGISTRY=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])" >> $GITHUB_ENV
- name: Set e2e Cluster Name
run: |
rand=${{ steps.vars.outputs.pr_sha_short }}
echo "pr_sha_short=$(git rev-parse --short ${{ github.event.pull_request.head.sha }} )" >> $GITHUB_ENV
rand=${{ env.pr_sha_short }}
if [ "$rand" = "" ]; then
rand=$RANDOM
fi
echo "CLUSTER_NAME=aks-addon-vk-test${rand}" >> $GITHUB_ENV
- name: Install Azure CLI latest
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az version
- uses: azure/[email protected]
with:
client-id: ${{ secrets.CLIENTID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTIONID }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Run e2e test
run: |
Expand All @@ -85,7 +67,7 @@ jobs:
CLUSTER_NAME: ${{ env.CLUSTER_NAME }}
VERSION: ${{ env.E2E_IMG_TAG}}
E2E_TARGET: "pr"
PR_COMMIT_SHA: ${{ steps.vars.outputs.pr_sha_short }}
PR_COMMIT_SHA: ${{ env.pr_sha_short }}

- name: Cleanup e2e resources
if: ${{ always() }}
Expand Down
49 changes: 15 additions & 34 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ concurrency:
cancel-in-progress: true

on:
workflow_dispatch:
pull_request_target:
branches:
- master
Expand All @@ -15,33 +14,19 @@ on:
- '.github/workflows/chart.yml'
- 'charts/**'

env:
REGISTRY: ghcr.io
GO_VERSION: '1.20' # Common versions
E2E_IMG_TAG: "e2e-ci"

permissions:
id-token: write
contents: read

env:
REGISTRY: ghcr.io
# Common versions
GO_VERSION: '1.20'

jobs:
export-registry:
runs-on: ubuntu-20.04
outputs:
registry: ${{ steps.export.outputs.registry }}
steps:
- id: export
run: |
# registry must be in lowercase
echo "::set-output name=registry::$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])"
e2e-tests:
needs: export-registry
environment: test
env:
REGISTRY: ${{ needs.export-registry.outputs.registry }}
E2E_IMG_TAG: "e2e-ci"
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Set up Go ${{ env.GO_VERSION }}
uses: actions/setup-go@v5
Expand All @@ -54,30 +39,26 @@ jobs:
ref: ${{ github.event.pull_request.head.ref }}
repository: ${{ github.event.pull_request.head.repo.full_name }}

- name: Shorten SHA
id: vars
run: echo "::set-output name=pr_sha_short::$(git rev-parse --short ${{ github.event.pull_request.head.sha }} )"
- name: Get Repo
run: |
echo "REGISTRY=$(echo "${{ env.REGISTRY }}/${{ github.repository }}" | tr [:upper:] [:lower:])" >> $GITHUB_ENV
- name: Set e2e Cluster Name
run: |
rand=${{ steps.vars.outputs.pr_sha_short }}
echo "pr_sha_short=$(git rev-parse --short ${{ github.event.pull_request.head.sha }} )" >> $GITHUB_ENV
rand=${{ env.pr_sha_short }}
if [ "$rand" = "" ]; then
rand=$RANDOM
fi
echo "CLUSTER_NAME=vk-aci-test${rand}" >> $GITHUB_ENV
- name: Install Azure CLI latest
run: |
curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash
az version
- uses: azure/[email protected]
with:
client-id: ${{ secrets.CLIENTID }}
tenant-id: ${{ secrets.TENANT_ID }}
subscription-id: ${{ secrets.SUBSCRIPTIONID }}
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}

- name: Run e2e test
run: |
Expand Down

0 comments on commit f1773aa

Please sign in to comment.