From 30c1ed54dfcc6eeb1d70ad184527aa15160badf1 Mon Sep 17 00:00:00 2001 From: Timur_Akhmadiev Date: Thu, 10 Nov 2022 14:39:41 +0400 Subject: [PATCH] Fix azure PE cleaner --- .github/actions/cleanup-pe/cleanall.go | 6 +++--- .github/workflows/cleanup-all.yml | 16 ++++++++-------- 2 files changed, 11 insertions(+), 11 deletions(-) diff --git a/.github/actions/cleanup-pe/cleanall.go b/.github/actions/cleanup-pe/cleanall.go index 96c2f502bd..1f85c0e592 100644 --- a/.github/actions/cleanup-pe/cleanall.go +++ b/.github/actions/cleanup-pe/cleanall.go @@ -4,6 +4,7 @@ import ( "context" "fmt" "log" + "strings" "time" "github.com/Azure/azure-sdk-for-go/profiles/latest/network/mgmt/network" @@ -91,12 +92,11 @@ func cleanAllAzurePE(ctx context.Context, resourceGroupName, azureSubscriptionID } var endpointNames []string for _, endpoint := range peList.Values() { - if endpoint.Subnet.Name != nil { - if *endpoint.Subnet.Name == subnet { + if endpoint.Subnet.ID != nil { + if strings.HasSuffix(*endpoint.Subnet.ID, subnet) { endpointNames = append(endpointNames, *endpoint.Name) } } - } for _, peName := range endpointNames { diff --git a/.github/workflows/cleanup-all.yml b/.github/workflows/cleanup-all.yml index 7104db9648..642a9949ef 100644 --- a/.github/workflows/cleanup-all.yml +++ b/.github/workflows/cleanup-all.yml @@ -44,14 +44,6 @@ jobs: with: go-version: '1.19' - - name: Run atlas project cleaner - env: - MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_PUBLIC_KEY }} - MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_PRIVATE_KEY }} - CLEAN_ALL: ${{ github.event.inputs.clean }} - MAX_PROJECT_LIFETIME: ${{ github.event.inputs.timelife }} - run: (cd .github/actions/cleanup && go run .) - - name: Run cleanup VPC if: always() && github.event.inputs.cleanVPC == 'true' env: @@ -76,3 +68,11 @@ jobs: GCP_SA_CRED: ${{ secrets.GCP_SA_CRED }} CLEAN_TAGGED_PE: ${{ github.event.inputs.cleanTaggedPE || 'false'}} run: (cd .github/actions/cleanup-pe && go run .) + + - name: Run atlas project cleaner + env: + MCLI_PUBLIC_API_KEY: ${{ secrets.ATLAS_PUBLIC_KEY }} + MCLI_PRIVATE_API_KEY: ${{ secrets.ATLAS_PRIVATE_KEY }} + CLEAN_ALL: ${{ github.event.inputs.clean }} + MAX_PROJECT_LIFETIME: ${{ github.event.inputs.timelife }} + run: (cd .github/actions/cleanup && go run .)