Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 3 additions & 2 deletions .github/actions/build-downstream/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ runs:
env:
BASE_BRANCH: ${{ github.event.pull_request.base.ref || github.ref_name }}
GITHUB_TOKEN: ${{ inputs.token }}
INPUTS_REPO: ${{ inputs.repo }}
run: |
set -e
set -x
Expand All @@ -51,7 +52,7 @@ runs:
git clone $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH
}

GH_REPO="${{ inputs.repo }}"
GH_REPO="${INPUTS_REPO}"
if [ "$GH_REPO" == "docs-examples" ] && [ "$BASE_BRANCH" == "main" ]; then
BASE_BRANCH="master"
fi
Expand Down Expand Up @@ -82,4 +83,4 @@ runs:
exit 1
fi

(current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .)
(current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .)
4 changes: 3 additions & 1 deletion .github/workflows/build-downstream.yml
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ jobs:
git clone $GITHUB_PATH $OUTPUT_PATH --branch $BASE_BRANCH
}

GH_REPO="${{ inputs.repo }}"
GH_REPO="${INPUTS_REPO}"
if [ "$GH_REPO" == "docs-examples" ] && [ "$BASE_BRANCH" == "main" ]; then
BASE_BRANCH="master"
fi
Expand Down Expand Up @@ -88,6 +88,8 @@ jobs:
fi

(current_dir=$(pwd) && cd $OUTPUT_PATH && zip -r "$current_dir/output.zip" .)
env:
INPUTS_REPO: ${{ inputs.repo }}

- name: Upload built artifacts
uses: actions/upload-artifact@65c4c4a1ddee5b72f698fdd19549f0f0fb45cf08 # v4.6.0
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/gofmt.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ jobs:
run: |
git config user.name "modular-magician"
git config user.email "magic-modules@google.com"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch
git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch
- name: Set up Go
uses: actions/setup-go@0a12ed9d6a96ab950c8f026ed9f722fe0da7ef32 # v5.0.2
with:
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/mmv1-check-templates.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
cd repo
git config user.name "modular-magician"
git config user.email "magic-modules@google.com"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch
git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch
- name: Check for invalid version guards
run: |
cd repo/tools/template-check
git diff --name-only --diff-filter=d origin/${{ github.base_ref }} ../../*.tmpl | sed 's=^=../../=g' | go run main.go
git diff --name-only --diff-filter=d origin/${GITHUB_BASE_REF} ../../*.tmpl | sed 's=^=../../=g' | go run main.go
10 changes: 6 additions & 4 deletions .github/workflows/mmv1-lint-product-yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
cd repo
git config user.name "modular-magician"
git config user.email "magic-modules@google.com"
git fetch origin ${{ github.base_ref }} # Fetch the base branch
git merge --no-ff origin/${{ github.base_ref }} # Merge with the base branch
yamlfiles=$(git diff --name-only origin/${{ github.base_ref }} -- mmv1/products) # Compare with the base branch
git fetch origin ${GITHUB_BASE_REF} # Fetch the base branch
git merge --no-ff origin/${GITHUB_BASE_REF} # Merge with the base branch
yamlfiles=$(git diff --name-only origin/${GITHUB_BASE_REF} -- mmv1/products) # Compare with the base branch
if [ ! -z "$yamlfiles" ]; then
echo "yamlfiles=repo/${yamlfiles//$'\n'/ repo/}" >> $GITHUB_OUTPUT
fi
Expand All @@ -33,4 +33,6 @@ jobs:
run: pip install yamllint==1.32.0 pyyaml==6.0.1 pathspec==0.12.1 --no-deps
- name: Lint YAML files
if: ${{ !failure() && steps.pull_request.outputs.yamlfiles != '' }}
run: yamllint -c repo/.yamllint ${{steps.pull_request.outputs.yamlfiles}}
run: yamllint -c repo/.yamllint ${STEPS_PULL_REQUEST_OUTPUTS_YAMLFILES}
env:
STEPS_PULL_REQUEST_OUTPUTS_YAMLFILES: ${{steps.pull_request.outputs.yamlfiles}}
5 changes: 4 additions & 1 deletion .github/workflows/reassign-reviewer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,7 @@ jobs:
go build .
- name: Run command
if: steps.read-comment.outputs.match != ''
run: .ci/magician/magician reassign-reviewer ${{ github.event.issue.number }} ${{ github.event.comment.user.login }} ${{ steps.read-comment.outputs.group1 }}
run: .ci/magician/magician reassign-reviewer ${{ github.event.issue.number }} ${GITHUB_EVENT_COMMENT_USER_LOGIN} ${STEPS_READ_COMMENT_OUTPUTS_GROUP1}
env:
GITHUB_EVENT_COMMENT_USER_LOGIN: ${{ github.event.comment.user.login }}
STEPS_READ_COMMENT_OUTPUTS_GROUP1: ${{ steps.read-comment.outputs.group1 }}
12 changes: 6 additions & 6 deletions .github/workflows/teamcity-services-diff-check-weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,21 +28,21 @@ jobs:
# export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
# OUTPUT_PATH changes after each generate (GA/beta)
- name: Set GOOGLE_REPO_PATH to path where GA provider was generated
run: echo "GOOGLE_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
run: echo "GOOGLE_REPO_PATH=${OUTPUT_PATH}" >> $GITHUB_ENV
- name: TeamCity Google Beta Provider Generate
uses: ./.github/actions/build-downstream
with:
repo: 'terraform-provider-google-beta'
token: '$GITHUB_TOKEN'
- name: Set GOOGLE_BETA_REPO_PATH to path where beta provider was generated
run: echo "GOOGLE_BETA_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
run: echo "GOOGLE_BETA_REPO_PATH=${OUTPUT_PATH}" >> $GITHUB_ENV
- name: Check that new services have been added to the TeamCity configuration code
run: |
# Create lists of service packages in providers. Need to cd into repos where go.mod is to do this command.
cd ${{env.GOOGLE_REPO_PATH}}
go list -f '{{.Name}}' ${{env.GOOGLE_REPO_PATH}}/google/services/... > $GITHUB_WORKSPACE/provider_services_ga.txt
cd ${{env.GOOGLE_BETA_REPO_PATH}}
go list -f '{{.Name}}' ${{env.GOOGLE_BETA_REPO_PATH}}/google-beta/services/... > $GITHUB_WORKSPACE/provider_services_beta.txt
cd ${GOOGLE_REPO_PATH}
go list -f '{{.Name}}' ${GOOGLE_REPO_PATH}/google/services/... > $GITHUB_WORKSPACE/provider_services_ga.txt
cd ${GOOGLE_BETA_REPO_PATH}
go list -f '{{.Name}}' ${GOOGLE_BETA_REPO_PATH}/google-beta/services/... > $GITHUB_WORKSPACE/provider_services_beta.txt

# Run tool to compare service packages in the providers vs those listed in TeamCity config files
cd $GITHUB_WORKSPACE
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/teamcity-services-diff-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,26 +37,26 @@ jobs:
# export OUTPUT_PATH=$GOPATH/src/github.com/$UPSTREAM_OWNER/$GH_REPO
# OUTPUT_PATH changes after each generate (GA/beta)
- name: Set GOOGLE_REPO_PATH to path where GA provider was generated
run: echo "GOOGLE_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
run: echo "GOOGLE_REPO_PATH=${OUTPUT_PATH}" >> $GITHUB_ENV
- name: TeamCity Google Beta Provider Generate
if: steps.generate.outcome == 'success'
uses: ./.github/actions/build-downstream
with:
repo: 'terraform-provider-google-beta'
token: '$GITHUB_TOKEN'
- name: Set GOOGLE_BETA_REPO_PATH to path where beta provider was generated
run: echo "GOOGLE_BETA_REPO_PATH=${{ env.OUTPUT_PATH}}" >> $GITHUB_ENV
run: echo "GOOGLE_BETA_REPO_PATH=${OUTPUT_PATH}" >> $GITHUB_ENV
- name: Checkout Repository
if: steps.generate.outcome == 'success'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
- name: Check that new services have been added to the TeamCity configuration code
if: steps.generate.outcome == 'success'
run: |
# Create lists of service packages in providers. Need to cd into repos where go.mod is to do this command.
cd ${{env.GOOGLE_REPO_PATH}}
go list -f '{{.Name}}' ${{env.GOOGLE_REPO_PATH}}/google/services/... > $GITHUB_WORKSPACE/provider_services_ga.txt
cd ${{env.GOOGLE_BETA_REPO_PATH}}
go list -f '{{.Name}}' ${{env.GOOGLE_BETA_REPO_PATH}}/google-beta/services/... > $GITHUB_WORKSPACE/provider_services_beta.txt
cd ${GOOGLE_REPO_PATH}
go list -f '{{.Name}}' ${GOOGLE_REPO_PATH}/google/services/... > $GITHUB_WORKSPACE/provider_services_ga.txt
cd ${GOOGLE_BETA_REPO_PATH}
go list -f '{{.Name}}' ${GOOGLE_BETA_REPO_PATH}/google-beta/services/... > $GITHUB_WORKSPACE/provider_services_beta.txt

# Run tool to compare service packages in the providers vs those listed in TeamCity config files
cd $GITHUB_WORKSPACE
Expand Down
28 changes: 20 additions & 8 deletions .github/workflows/test-tgc.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,12 +52,16 @@ jobs:
run: |
curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}",
"target_url": "${STEPS_GET_JOB_OUTPUTS_URL}",
"state": "pending"
}'
env:
GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}}
GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }}
STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }}
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
Expand All @@ -81,9 +85,12 @@ jobs:
- name: Build Terraform Google Conversion
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
go mod edit -replace github.com/hashicorp/terraform-provider-google-beta=github.com/${{ github.event.inputs.owner }}/terraform-provider-google-beta@${{ github.event.inputs.tpgb-branch }}
go mod edit -replace github.com/hashicorp/terraform-provider-google-beta=github.com/${GITHUB_EVENT_INPUTS_OWNER}/terraform-provider-google-beta@${GITHUB_EVENT_INPUTS_TPGB_BRANCH}
go mod tidy
make build
env:
GITHUB_EVENT_INPUTS_OWNER: ${{ github.event.inputs.owner }}
GITHUB_EVENT_INPUTS_TPGB_BRANCH: ${{ github.event.inputs.tpgb-branch }}
- name: Run Unit Tests
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
Expand All @@ -93,9 +100,14 @@ jobs:
run: |
curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"state": "${{ job.status }}"
"context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}",
"target_url": "${STEPS_GET_JOB_OUTPUTS_URL}",
"state": "${JOB_STATUS}"
}'
env:
GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}}
GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }}
STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }}
JOB_STATUS: ${{ job.status }}
23 changes: 16 additions & 7 deletions .github/workflows/test-tpg.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,12 +48,16 @@ jobs:
run: |
curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}",
"target_url": "${STEPS_GET_JOB_OUTPUTS_URL}",
"state": "pending"
}'
env:
GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}}
GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }}
STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }}
- name: Checkout Repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.2
with:
Expand Down Expand Up @@ -95,9 +99,14 @@ jobs:
run: |
curl -X POST -H "Authorization: token ${{secrets.GITHUB_TOKEN}}" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${{github.event.inputs.sha}}" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/statuses/${GITHUB_EVENT_INPUTS_SHA}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"state": "${{ job.status }}"
"context": "${GITHUB_EVENT_INPUTS_REPO}${{ env.status_suffix }}",
"target_url": "${STEPS_GET_JOB_OUTPUTS_URL}",
"state": "${JOB_STATUS}"
}'
env:
GITHUB_EVENT_INPUTS_SHA: ${{github.event.inputs.sha}}
GITHUB_EVENT_INPUTS_REPO: ${{ github.event.inputs.repo }}
STEPS_GET_JOB_OUTPUTS_URL: ${{ steps.get_job.outputs.url }}
JOB_STATUS: ${{ job.status }}
Loading