Revert "remove all TestRecord related tasks since we have no write permission anymore"

This reverts commit ecea4eb4c46be42e08ed647ef24078edbde472ca.
This commit is contained in:
hezijie 2024-08-01 08:29:35 +08:00
parent e98d6e9583
commit 55688a5012
3 changed files with 57 additions and 0 deletions

View File

@ -35,3 +35,9 @@ jobs:
ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId') ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId')
export CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}" export CHANGED_FOLDERS="${{ steps.changed-files.outputs.all_changed_files }}"
docker run --rm -v $(pwd):/src -w /src/test --network=host -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform:latest sh -c "pkenv install 1.10.2 && go mod tidy && go test -timeout=360m -v ./e2e" docker run --rm -v $(pwd):/src -w /src/test --network=host -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_TENANT_ID -e ARM_CLIENT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform:latest sh -c "pkenv install 1.10.2 && go mod tidy && go test -timeout=360m -v ./e2e"
- uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 #v3.1.3
with:
name: TestRecord-${{ github.event.number }}
retention-days: 60
path: |
quickstart/**/TestRecord.md.tmp

39
.github/workflows/pr-merged.yaml vendored Normal file
View File

@ -0,0 +1,39 @@
name: Main Branch Push
on:
push:
branches:
- main
- master
paths:
- 'quickstart/**'
jobs:
main-branch-push:
runs-on: ubuntu-latest
steps:
- name: get-default-branch
run: |
branch=$(curl -s "https://api.github.com/repos/$GITHUB_REPOSITORY" | jq -r '.default_branch')
echo "default_branch=$branch" >> $GITHUB_ENV
- name: checkout
uses: actions/checkout@f43a0e5ff2bd294095638e18286ca9a3d1956744 #v3.6.0
- uses: 8BitJonny/gh-get-current-pr@2215326c76d51bfa3f2af0a470f32677f6c0cae9 #2.1.0
id: PR
- name: Download artifact
id: download-artifact
uses: dawidd6/action-download-artifact@268677152d06ba59fcec7a7f0b5d961b6ccd7e1e #v2.28.0
with:
github_token: ${{secrets.GITHUB_TOKEN}}
workflow: e2e.yaml
pr: ${{ steps.PR.outputs.number }}
name: TestRecord-${{ steps.PR.outputs.number }}
path: TestRecord
if_no_artifact_found: ignore
- name: Update
run: |
sh scripts/update-test-record.sh
- name: Commit & Push changes
uses: actions-js/push@156f2b10c3aa000c44dbe75ea7018f32ae999772 #v1.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'Update TestRecord'
branch: ${{ env.default_branch }}

View File

@ -23,3 +23,15 @@ jobs:
export ARM_TENANT_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .tenantId') export ARM_TENANT_ID=$(az login --identity --username $MSI_ID | jq -r '.[0] | .tenantId')
ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId') ARM_CLIENT_ID=$(az identity list | jq -r --arg MSI_ID "$MSI_ID" '.[] | select(.principalId == $MSI_ID) | .clientId')
docker run --rm -v $(pwd):/src -w /src/test -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform sh -c "go mod tidy && go test -timeout=1440m -parallel 10 -v ./e2e" docker run --rm -v $(pwd):/src -w /src/test -e MSI_ID -e ARM_SUBSCRIPTION_ID -e ARM_CLIENT_ID -e ARM_TENANT_ID -e ARM_USE_MSI=true -e CHANGED_FOLDERS mcr.microsoft.com/azterraform sh -c "go mod tidy && go test -timeout=1440m -parallel 10 -v ./e2e"
- name: Update
run: |
docker run --rm -v $(pwd):/src -w /src mcr.microsoft.com/azterraform sh scripts/update-test-record.sh
cd .git
sudo chmod -R a+rwX .
sudo find . -type d -exec chmod g+s '{}' +
- name: Commit & Push changes
uses: actions-js/push@156f2b10c3aa000c44dbe75ea7018f32ae999772 #v1.4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
message: 'Update TestRecord'
branch: ${{ env.default_branch }}