From 624ac7eab2f36386f7d37bbe18fd7f846d2ada8b Mon Sep 17 00:00:00 2001 From: hezijie Date: Tue, 24 Sep 2024 11:16:55 +0800 Subject: [PATCH] prepare for oidc --- .github/workflows/acc-test.yaml | 39 ++++++++++++++----------------- .github/workflows/weekly-e2e.yaml | 30 ------------------------ .gitignore | 4 +++- GNUmakefile | 9 ++----- 4 files changed, 22 insertions(+), 60 deletions(-) delete mode 100644 .github/workflows/weekly-e2e.yaml diff --git a/.github/workflows/acc-test.yaml b/.github/workflows/acc-test.yaml index a47afa8..89a0f16 100644 --- a/.github/workflows/acc-test.yaml +++ b/.github/workflows/acc-test.yaml @@ -11,27 +11,22 @@ on: - '**/go.mod' jobs: - acc-tests: - runs-on: [self-hosted, 1ES.Pool=terraform-azurerm-vnet] - environment: - name: acctests + check: + runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - name: init + - name: Checking for Fork + shell: pwsh run: | - docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform:latest make generate - - name: e2e test - run: | - sh scripts/ci-e2e.sh - - name: upload test version snapshots - uses: actions/upload-artifact@v3 - with: - name: TestRecord-${{ github.event.number }} - retention-days: 60 - path: | - examples/**/TestRecord.md.tmp - - name: version-upgrade test - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - run: | - sh scripts/ci-version-upgrade.sh + $isFork = "${{ github.event.pull_request.head.repo.fork }}" + if($isFork -eq "true") { + echo "### WARNING: This workflow is disabled for forked repositories. Please follow the [release branch process](https://azure.github.io/Azure-Verified-Modules/contributing/terraform/terraform-contribution-flow/#5-create-a-pull-request-to-the-upstream-repository) if end to end tests are required." >> $env:GITHUB_STEP_SUMMARY + } + + run-e2e-tests: + if: github.event.pull_request.head.repo.fork == false + uses: Azure/tfmod-scaffold/.github/workflows/tfvm_e2e.yaml@main + name: end to end + secrets: inherit + permissions: + id-token: write + contents: read \ No newline at end of file diff --git a/.github/workflows/weekly-e2e.yaml b/.github/workflows/weekly-e2e.yaml deleted file mode 100644 index f588999..0000000 --- a/.github/workflows/weekly-e2e.yaml +++ /dev/null @@ -1,30 +0,0 @@ -name: Weekly E2E Test Check -on: - workflow_dispatch: - schedule: - - cron: '0 0 * * 0' - -jobs: - full-e2e-check: - runs-on: [self-hosted, 1ES.Pool=terraform-azurerm-vnet] - environment: - name: crontests - steps: - - name: checkout - uses: actions/checkout@v3 - - name: init - run: | - docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform:latest make generate - - name: e2e test - continue-on-error: true - run: | - sh scripts/ci-e2e.sh - - name: Update - run: | - sh scripts/ci-update-test-record.sh - - name: Commit & Push changes - uses: actions-js/push@master - with: - github_token: ${{ secrets.GITHUB_TOKEN }} - message: 'Update TestVersionSnapshot' - branch: ${{ github.event.repository.default_branch }} \ No newline at end of file diff --git a/.gitignore b/.gitignore index 7e8ef0b..1590bb1 100644 --- a/.gitignore +++ b/.gitignore @@ -67,4 +67,6 @@ scripts test/go.sum /TestRecord -**/TestRecord.md.tmp \ No newline at end of file +**/TestRecord.md.tmp + +tfvmmakefile \ No newline at end of file diff --git a/GNUmakefile b/GNUmakefile index 8e9f0bf..3db7ccd 100644 --- a/GNUmakefile +++ b/GNUmakefile @@ -1,9 +1,4 @@ SHELL := /bin/bash --include $(shell curl -sSL "https://raw.githubusercontent.com/Azure/tfmod-scaffold/main/scripts/install.sh" | bash -s > /dev/null ; echo tfmod-scaffold/GNUmakefile) - -init: - @sh "$(CURDIR)/scripts/init.sh" - -cleanup: - @sh "$(CURDIR)/scripts/cleanup.sh" \ No newline at end of file +$(shell curl -H 'Cache-Control: no-cache, no-store' -sSL "https://raw.githubusercontent.com/Azure/tfmod-scaffold/refs/heads/main/GNUmakefile" -o tfvmmakefile) +-include tfvmmakefile \ No newline at end of file