Skip to content

Commit

Permalink
Merge branch 'main' into error_details
Browse files Browse the repository at this point in the history
  • Loading branch information
upaul9705 committed Jun 7, 2023
2 parents ee3e15e + d860404 commit ded008d
Show file tree
Hide file tree
Showing 541 changed files with 18,094 additions and 6,782 deletions.
9 changes: 4 additions & 5 deletions .ci/RELEASE_NOTES_GUIDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -93,12 +93,11 @@ Notes SHOULD:
changes, deprecations, or new behavior.
- Impersonal third person (no “I”, “you”, etc.)
- Start with {{service}} if changing an existing resource (see below)
- List specific added or changed resources or fields

Notes, breaking changes, and features are exceptions. These are more free-form and left to
the discretion of the PR author and reviewer. The overarching goal should be a good user
experience when reading the changelog.

See examples below for good release notes.
Notes and breaking changes are exceptions, these are more free-form and left to
the discretion of the PR author and/or reviewer. The changelog should be clear,
and easy to understand for end users not familiar with provider internals.

### Examples:

Expand Down
1 change: 1 addition & 0 deletions .ci/containers/downstream-builder/generate_downstream.sh
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,7 @@ if [ "$REPO" == "terraform-google-conversion" ]; then
rm -rf ./tfplan2cai/testdata/templates/
rm -rf ./tfplan2cai/testdata/generatedconvert/
rm -rf ./tfplan2cai/converters/google/provider
rm -rf ./tfplan2cai/converters/google/resources
find ./tfplan2cai/test/** -type f -exec git rm {} \;
popd

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ if [[ -n $FAILED_TESTS_PATTERN ]]; then
export VCR_MODE=RECORDING
FAILED_TESTS=$(grep "^--- FAIL: TestAcc" replaying_test$test_suffix.log | awk '{print $3}')
# test_exit_code=0
parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -v -run="{}$" -timeout 120m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/recording_build/{}_recording_test.log ::: $FAILED_TESTS
parallel --jobs 16 TF_LOG=DEBUG TF_LOG_PATH_MASK=$local_path/testlog/recording/%s.log TF_ACC=1 TF_SCHEMA_PANIC_ON_ERROR=1 go test $GOOGLE_TEST_DIRECTORY -parallel 1 -v -run="{}$" -timeout 240m -ldflags="-X=github.com/hashicorp/terraform-provider-google-beta/version.ProviderVersion=acc" ">" testlog/recording_build/{}_recording_test.log ::: $FAILED_TESTS

test_exit_code=$?

Expand Down
41 changes: 18 additions & 23 deletions .ci/containers/pre-build-validator/validate.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,28 +3,23 @@
set -e

gh_repo=magic-modules
new_branch="auto-pr-$PR_NUMBER"

if [ $PR_NUMBER == 7874 ]; then
post_body=$(jq -n \
--arg owner "GoogleCloudPlatform" \
--arg repo "$gh_repo" \
--arg branch "$new_branch" \
--arg sha "$COMMIT_SHA" \
'{
ref: "main",
inputs: {
owner: $owner,
repo: $repo,
branch: $branch,
sha: $sha,
}
}')
post_body=$(jq -n \
--arg owner "GoogleCloudPlatform" \
--arg repo "$gh_repo" \
--arg sha "$COMMIT_SHA" \
'{
ref: "main",
inputs: {
owner: $owner,
repo: $repo,
sha: $sha,
}
}')

curl \
-X POST \
-u "modular-magician:$GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/actions/workflows/pre-build-validation.yml/dispatches" \
-d "$post_body"
fi
curl \
-X POST \
-u "modular-magician:$GITHUB_TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
"https://api.github.com/repos/GoogleCloudPlatform/magic-modules/actions/workflows/pre-build-validation.yml/dispatches" \
-d "$post_body"
1 change: 1 addition & 0 deletions .ci/infra/terraform/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -294,6 +294,7 @@ module "project-services" {
"testing.googleapis.com",
"tpu.googleapis.com",
"trafficdirector.googleapis.com",
"vmwareengine.googleapis.com",
"vpcaccess.googleapis.com",
"websecurityscanner.googleapis.com",
"workflowexecutions.googleapis.com",
Expand Down
8 changes: 3 additions & 5 deletions .github/workflows/pre-build-validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,11 +19,8 @@ on:
description: 'The Base Repository to pull from'
required: false
default: 'magic-modules'
branch:
description: 'The branch or sha to execute against'
required: true
sha:
description: "The commit SHA in magic-modules repository where the status result will be posted"
description: "The commit SHA in magic-modules repository to execute against and where the status result will be posted"
required: true

jobs:
Expand All @@ -34,13 +31,14 @@ jobs:
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.owner }}/${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
ref: ${{ github.event.inputs.sha }}
path: repo
fetch-depth: 0
- name: Check for mmv1 product file changes
id: pull_request
run: |
cd repo
git config user.name "modular-magician"
git merge --no-ff origin/main
yamlfiles=$(git diff --name-only origin/main -- mmv1/products)
if [ -z "$yamlfiles" ]; then
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/test-tgc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
name: TGC Build and Unit Test

permissions:
actions: read
contents: read
statuses: write

env:
status_suffix: "-build-and-unit-tests"

on:
workflow_dispatch:
inputs:
owner:
description: 'The owner of the fork'
required: false
default: 'modular-magician'
repo:
description: 'The Base Repository to pull from'
required: false
default: 'terraform-google-conversion'
branch:
description: 'The branch or sha of the tgc execute against'
required: true
sha:
description: "The commit SHA in magic-modules repository where the status result will be posted"
required: true

concurrency:
group: test-tgc-${{ github.event.inputs.owner }}-${{ github.event.inputs.repo }}-${{ github.event.inputs.branch }}
cancel-in-progress: true

jobs:
build-and-unit-test:
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
repository: ${{ github.event.inputs.owner }}/${{ github.event.inputs.repo }}
ref: ${{ github.event.inputs.branch }}
path: tgc
fetch-depth: 2
- name: Check for Code Changes
id: pull_request
run: |
cd tgc
gofiles=$(git diff --name-only HEAD~1 | { grep -e "\.go$" -e "go.mod$" -e "go.sum$" || test $? = 1; })
if [ -z "$gofiles" ]; then
echo "has_changes=false" >> $GITHUB_OUTPUT
else
echo "has_changes=true" >> $GITHUB_OUTPUT
fi
- name: Get Job URL
if: ${{ !cancelled() }}
id: get_job
run: |
response=$(curl --get -Ss -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" -H "Accept: application/vnd.github.v3+json" "https://api.github.com/repos/${{ github.repository }}/actions/runs/${{ github.run_id }}/attempts/${{ github.run_attempt }}/jobs")
html_url=$(echo "$response" | jq -r --arg job_name "${{ github.job }}" '.jobs | map(select(.name == $job_name)) | .[0].html_url')
echo "url=${html_url}" >> $GITHUB_OUTPUT
- name: Post Pending Status to Pull Request
if: ${{ !cancelled() }}
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}}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"state": "pending"
}'
- name: Set up Go
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
uses: actions/setup-go@v4
with:
go-version: '^1.19.9'
- name: Build Terraform Google Conversion
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd tgc
go build
- name: Run Unit Tests
if: ${{ !failure() && steps.pull_request.outputs.has_changes == 'true' }}
run: |
cd tgc
make test
- name: Post Result Status to Pull Request
if: ${{ !cancelled() }}
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}}" \
-d '{
"context": "${{ github.event.inputs.repo }}${{ env.status_suffix }}",
"target_url": "${{ steps.get_job.outputs.url }}",
"state": "${{ job.status }}"
}'
1 change: 1 addition & 0 deletions docs/config.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,4 @@ path = 'github.com/alex-shpak/hugo-book'
BookCommitPath = 'commit'
BookEditPath = 'edit/main/docs'
BookComments = false
BookSection = '*'
5 changes: 1 addition & 4 deletions docs/content/_index.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,5 @@
---
title: "Home"
weight: 0
type: "docs"
date: 2022-11-14T09:50:49-08:00
title: "Overview"
---


Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Best practices"
weight: 25
aliases:
- /docs/best-practices
---

# Best practices
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---
title: "Getting Started"
weight: 10
isSection: true
---
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Contributing"
weight: 50
aliases:
- /docs/getting-started/contributing
---

# General contributing steps
Expand All @@ -27,6 +29,7 @@ weight: 50
1. [Generate the providers](/magic-modules/docs/getting-started/generate-providers/) that include your change.
1. [Run provider tests locally](/magic-modules/docs/getting-started/run-provider-tests/) that are relevant to the change you made. (Testing the PR locally and pushing the commit to the PR only after the tests pass locally may significantly reduce back-and-forth in review.)
1. Push your changes to your `magic-modules` repo fork and send a pull request from that branch to the main branch on `magic-modules`. A reviewer will be assigned automatically to your PR.
1. Get approval to start Clould Builder jobs from the reviewer if you're an community contributor
1. Wait for the the modules magician to generate downstream diff (which should take about 15 mins after creating the PR) to make sure all changes are generated correctly in downstream repos.
1. Wait for the VCR test results.
{{< details "Get to know general workflow for VCR tests" >}}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Generate the providers
weight: 20
aliases:
- /docs/getting-started/generate-providers
---

# Generate the provider
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Provider documentation"
weight: 60
aliases:
- /docs/getting-started/provider-documentation
---

# Provider documentation
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "Run provider tests"
weight: 30
aliases:
- /docs/getting-started/run-provider-tests
---

# Run provider tests locally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Set up your environment
weight: 10
aliases:
- /docs/getting-started/setup
---

# Set up your environment
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: Use built provider
weight: 40
aliases:
- /docs/getting-started/use-built-provider
---

# Use built provider locally
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
---
title: "How To"
weight: 20
aliases:
- /docs/how-to
---

# How To
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Add documentation for a handwritten data source"
summary: "New handwritten datasources require new handwritten documentation to be created."
weight: 25
aliases:
- /docs/how-to/add-handwritten-datasource-documentation
---

# Add documentation for a handwritten data source
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Add a handwritten datasource"
summary: "Datasources are like terraform resources except they don't *create* anything."
weight: 22
aliases:
- /docs/how-to/add-handwritten-datasource
---

# Add a handwritten datasource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Add handwritten IAM resources"
summary: "Handwritten IAM support is only recommended for resources that cannot be managed
using [MMv1](/magic-modules/docs/how-to/add-mmv1-iam)."
weight: 23
aliases:
- /docs/how-to/add-handwritten-iam
---

# Add handwritten IAM resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Add a handwritten test"
summary: "For handwritten resources and generated resources that need to test update,
handwritten tests must be added."
weight: 21
aliases:
- /docs/how-to/add-handwritten-test
---


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: "Add MMv1 IAM resources"
summary: "For resources implemented through the MMv1 engine, the majority of configuration
for IAM support can be inferred based on the preexisting YAML specification file."
weight: 11
aliases:
- /docs/how-to/add-mmv1-iam
---

# Add MMv1 IAM resources
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@ configured by editing definition files under the
[`mmv1/products`](https://github.com/GoogleCloudPlatform/magic-modules/tree/master/mmv1/products)
path."
weight: 10
aliases:
- /docs/how-to/add-mmv1-resource
---

# Add an MMv1 resource
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Add an MMv1 test"
summary: "An example terraform configuration can be used to generate docs and tests for a resource."
weight: 12
aliases:
- /docs/how-to/add-mmv1-test
---

# Add an MMv1 test
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Add and update MMv1 resource documentation"
summary: "Generated resources have generated documentation. This page describes the generation process and what YAML inputs are used."
weight: 13
aliases:
- /docs/how-to/mmv1-resource-documentation
---

# MMv1 resource documentation
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
title: "Types of resources"
summary: "Check the header in the Go source to determine what type of resource it is. If there is no header, it is likely handwritten."
weight: 1
aliases:
- /docs/how-to/mmv1-resource-documentation
---

# Types of resources
Expand Down
Loading

0 comments on commit ded008d

Please sign in to comment.