-
Notifications
You must be signed in to change notification settings - Fork 1.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add terraform-provider-google-beta to ci #502
Merged
Merged
Changes from all commits
Commits
Show all changes
63 commits
Select commit
Hold shift + click to select a range
6f36892
add terraform-provider-google-beta to ci
danawillow 3ccf867
properly add beta submodule
danawillow 73048eb
add forgotten yml file
danawillow f4c8a5c
remove bad submodule
danawillow eca1e52
actually add submodule
danawillow 0223d22
remove it again
danawillow ff18984
actually actually add submodule
danawillow 0439c11
update submodule dir based on version
danawillow f971c11
quote version
danawillow 39fbaec
use other way of specifying submodule url
danawillow 248a4e3
skip generation if product doesn't exist at specified version
danawillow 1cc61a6
generate tf at ga first, then at beta
danawillow fff3560
Merge branch 'master' into tfbeta
danawillow 3da348f
copy git dir correctly
danawillow c0bbeb9
maybe actually set the right version to generate, who really knows ba…
danawillow 0fde8ad
try to run beta provider tests as part of terraform test job
danawillow 80dc82f
add beta provider in a few more places
danawillow ca035fb
make arrays correctly
danawillow e178fe8
fix issue with empty string becoming the word null
danawillow 3d616b9
more loops
danawillow 47aada0
add terraform-beta-generated output back
danawillow 8275eec
Merge branch 'master' into tfbeta
danawillow 78d03a5
put all files in google-beta if the version is beta
danawillow 627bd3f
add common files
danawillow 3bce028
fix test target dir
danawillow cfdbee6
mark labelfingerprint beta for globaladdress
danawillow 2e54ebb
stop explicitly generating some beta apis
danawillow 7ef2ac5
generate at lower version if product not at version
danawillow a68e462
remove deprecation messages
danawillow 98b8eb4
return true if no versions for _bundles
danawillow 1ec9255
rubocop
danawillow 078fb25
another exists if there are no versions
danawillow 9e953ce
auth api name should be ga
danawillow 26691c9
Merge branch 'master' into tfbeta
danawillow 313af83
add 2.0.0 branch to beta submodule and extra newline back to tf docs
danawillow 98ad75d
Merge branch 'master' into tfbeta
danawillow 62b6eb9
Merge branch 'master' into tfbeta
danawillow a39616c
add another loop
danawillow 678361d
update submodule to track 2.0.0 branch
danawillow 5663803
Merge branch 'master' into tfbeta
danawillow 8a7321f
convert files that need to be different between versions to erb
danawillow 15760e2
rubocop
danawillow efb2d8e
fix args to compile_files
danawillow fcd7777
Basic structure for singular InSpec resources (#573)
slevenick 2923c48
move puppet logging to debug instead of info (#574)
chrisst 9533dd9
small changes noticed when inspecting generated code
danawillow 33a4c2a
Terraform: Add project, organization, folder, service account tests t…
rileykarson e077beb
Terraform: Add import tests for CloudIoTRegistry (#576)
rileykarson b80f580
add version var to all examples
danawillow 70d8f28
fix indentation
danawillow 8c280d1
more indentation fixes
danawillow 84e25bd
Add Storage ObjectAccessControl to Terraform (#562)
rileykarson 62afbbb
fix expand for machine type in composer environment (#571)
emilymye 19ace70
Terraform: Add storage, missing project resource test files to MM. (#…
rileykarson 1f6c48c
nested exclude for versioned properties (#575)
emilymye abe3d0c
maps and variables in ci
danawillow ff19553
fix point-to-submodules
danawillow be6dd56
fix create-pr
danawillow 91291cc
add missing -v
danawillow 234e48c
small changes the magician tried to overwrite
danawillow b6e66c2
Add OiCS link generation to the Terraform docs. (#572)
rileykarson 1934858
Merge 234e48cc3b3cafb835ac22ee37607b1fa2313aca into b6e66c2de271a510e…
danawillow c9daa49
Update tracked submodules -> HEAD on Fri Oct 19 17:55:09 UTC 2018
modular-magician File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,13 @@ resources: | |
authorship_restriction: true | ||
no_label: automerged | ||
|
||
- name: terraform-intermediate | ||
{% for v in vars.terraform_v.itervalues() %} | ||
- name: {{ v.short_name }}-intermediate | ||
type: git-branch | ||
source: | ||
uri: [email protected]:((github-account.username))/terraform-provider-google.git | ||
uri: [email protected]:((github-account.username))/{{ v.provider_name }}.git | ||
private_key: ((repo-key.private_key)) | ||
{% endfor %} | ||
|
||
- name: ansible-intermediate | ||
type: git-branch | ||
|
@@ -136,18 +138,25 @@ jobs: | |
status: pending | ||
path: magic-modules | ||
- aggregate: | ||
{% for k, v in vars.terraform_v.iteritems() %} | ||
- do: | ||
# consumes: magic-modules-branched | ||
# produces: terraform-generated | ||
- task: generate-terraform | ||
- task: generate-{{v.short_name}} | ||
file: magic-modules-branched/.ci/magic-modules/generate-terraform.yml | ||
# Puts 'terraform-generated' into the robot's fork. | ||
- put: terraform-intermediate | ||
params: | ||
repository: terraform-generated | ||
branch_file: magic-modules-branched/branchname | ||
only_if_diff: true | ||
force: true | ||
VERSION: {{k}} | ||
PROVIDER_NAME: {{v.provider_name}} | ||
SHORT_NAME: {{v.short_name}} | ||
# Puts 'terraform-generated' into the robot's fork. | ||
- aggregate: | ||
- put: {{v.short_name}}-intermediate | ||
params: | ||
repository: terraform-generated/{{k}} | ||
branch_file: magic-modules-branched/branchname | ||
only_if_diff: true | ||
force: true | ||
{% endfor %} | ||
- do: | ||
# consumes: magic-modules-branched | ||
# produces: ansible-generated | ||
|
@@ -226,6 +235,7 @@ jobs: | |
CREDS: ((repo-key.private_key)) | ||
PUPPET_MODULES: {{','.join(vars.puppet_modules)}} | ||
CHEF_MODULES: {{','.join(vars.chef_modules)}} | ||
TERRAFORM_VERSIONS: "{{','.join(vars.terraform_properties_serialized)}}" | ||
TERRAFORM_ENABLED: true | ||
ANSIBLE_ENABLED: true | ||
INSPEC_ENABLED: true | ||
|
@@ -243,11 +253,18 @@ jobs: | |
version: every | ||
trigger: true | ||
params: | ||
submodules: [build/terraform] | ||
submodules: [{{','.join(vars.terraform_submodules)}}] | ||
passed: [mm-generate] | ||
- task: test | ||
file: magic-modules/.ci/unit-tests/task.yml | ||
timeout: 30m | ||
- aggregate: | ||
{% for v in vars.terraform_v.itervalues() %} | ||
- task: test-{{v.short_name}} | ||
file: magic-modules/.ci/unit-tests/task.yml | ||
timeout: 30m | ||
params: | ||
PROVIDER_NAME: {{v.provider_name}} | ||
SHORT_NAME: {{v.short_name}} | ||
TEST_DIR: {{v.test_dir}} | ||
{% endfor %} | ||
on_failure: | ||
do: | ||
- get: magic-modules-new-prs | ||
|
@@ -407,6 +424,7 @@ jobs: | |
CHEF_REPO_USER: GoogleCloudPlatform | ||
CHEF_MODULES: {{','.join(vars.chef_modules)}} | ||
{%- endif %} | ||
TERRAFORM_VERSIONS: "{{','.join(vars.terraform_properties_serialized)}}" | ||
on_failure: | ||
put: magic-modules-new-prs | ||
params: | ||
|
@@ -420,9 +438,10 @@ jobs: | |
# the pipeline (when a PR needs to be updated), this does that updating by pushing | ||
# the new code to the repository/branch from which a pull request is already open. | ||
- aggregate: | ||
- put: terraform-intermediate | ||
{% for v in vars.terraform_v.itervalues() %} | ||
- put: {{v.short_name}}-intermediate | ||
params: | ||
repository: magic-modules-with-comment/build/terraform | ||
repository: magic-modules-with-comment/build/{{ v.short_name }} | ||
branch_file: magic-modules-with-comment/original_pr_branch_name | ||
# Every time a change runs through this pipeline, it will generate a commit with | ||
# a different hash - the hash includes timestamps. Therefore, even if there's no | ||
|
@@ -432,6 +451,7 @@ jobs: | |
# not push the update even though the commit hashes are different. | ||
only_if_diff: true | ||
force: true | ||
{% endfor %} | ||
- put: ansible-intermediate | ||
params: | ||
repository: magic-modules-with-comment/build/ansible | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,3 +29,4 @@ params: | |
PUPPET_MODULES: "" | ||
CHEF_REPO_USER: "" | ||
CHEF_MODULES: "" | ||
TERRAFORM_VERSIONS: "" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,10 +15,10 @@ export GOPATH="${PWD}/go" | |
mkdir -p "${GOPATH}/src/github.com/terraform-providers" | ||
|
||
pushd magic-modules-branched | ||
ln -s "${PWD}/build/terraform/" "${GOPATH}/src/github.com/terraform-providers/terraform-provider-google" | ||
ln -s "${PWD}/build/$SHORT_NAME/" "${GOPATH}/src/github.com/terraform-providers/$PROVIDER_NAME" | ||
popd | ||
|
||
pushd "${GOPATH}/src/github.com/terraform-providers/terraform-provider-google" | ||
pushd "${GOPATH}/src/github.com/terraform-providers/$PROVIDER_NAME" | ||
go get | ||
popd | ||
|
||
|
@@ -27,17 +27,17 @@ LAST_COMMIT_AUTHOR="$(git log --pretty="%an <%ae>" -n1 HEAD)" | |
bundle install | ||
|
||
# Build all terraform products | ||
bundle exec compiler -a -e terraform -o "${GOPATH}/src/github.com/terraform-providers/terraform-provider-google/" | ||
bundle exec compiler -a -e terraform -o "${GOPATH}/src/github.com/terraform-providers/$PROVIDER_NAME/" -v $VERSION | ||
|
||
# This command can crash - if that happens, the script should not fail. | ||
set +e | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is where you'll need to add |
||
TERRAFORM_COMMIT_MSG="$(python .ci/magic-modules/extract_from_pr_description.py --tag terraform < .git/body)" | ||
TERRAFORM_COMMIT_MSG="$(python .ci/magic-modules/extract_from_pr_description.py --tag $SHORT_NAME < .git/body)" | ||
set -e | ||
if [ -z "$TERRAFORM_COMMIT_MSG" ]; then | ||
TERRAFORM_COMMIT_MSG="Magic Modules changes." | ||
fi | ||
|
||
pushd "build/terraform" | ||
pushd "build/$SHORT_NAME" | ||
# These config entries will set the "committer". | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "Modular Magician" | ||
|
@@ -47,9 +47,9 @@ git add -A | |
git commit -m "$TERRAFORM_COMMIT_MSG" --author="$LAST_COMMIT_AUTHOR" || true # don't crash if no changes | ||
git checkout -B "$(cat ../../branchname)" | ||
|
||
apply_patches "$PATCH_DIR/terraform-providers/terraform-provider-google" "$TERRAFORM_COMMIT_MSG" "$LAST_COMMIT_AUTHOR" "2.0.0" | ||
apply_patches "$PATCH_DIR/terraform-providers/$PROVIDER_NAME" "$TERRAFORM_COMMIT_MSG" "$LAST_COMMIT_AUTHOR" "2.0.0" | ||
|
||
popd | ||
popd | ||
|
||
git clone magic-modules-branched/build/terraform ./terraform-generated | ||
git clone magic-modules-branched/build/$SHORT_NAME ./terraform-generated/$VERSION |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -44,11 +44,18 @@ for PRD in "${PRODUCT_ARRAY[@]}"; do | |
done | ||
|
||
if [ "$TERRAFORM_ENABLED" = "true" ]; then | ||
git config -f .gitmodules submodule.build/terraform.branch "$BRANCH" | ||
git config -f .gitmodules submodule.build/terraform.url "[email protected]:$GH_USERNAME/terraform-provider-google.git" | ||
git submodule sync build/terraform | ||
ssh-agent bash -c "ssh-add ~/github_private_key; git submodule update --remote --init build/terraform" | ||
git add build/terraform | ||
IFS="," read -ra TERRAFORM_VERSIONS <<< "$TERRAFORM_VERSIONS" | ||
for VERSION in "${TERRAFORM_VERSIONS[@]}"; do | ||
IFS=":" read -ra TERRAFORM_DATA <<< "$VERSION" | ||
PROVIDER_NAME="${TERRAFORM_DATA[0]}" | ||
SUBMODULE_DIR="${TERRAFORM_DATA[1]}" | ||
|
||
git config -f .gitmodules "submodule.build/$SUBMODULE_DIR.branch" "$BRANCH" | ||
git config -f .gitmodules "submodule.build/$SUBMODULE_DIR.url" "[email protected]:$GH_USERNAME/$PROVIDER_NAME.git" | ||
git submodule sync "build/$SUBMODULE_DIR" | ||
ssh-agent bash -c "ssh-add ~/github_private_key; git submodule update --remote --init build/$SUBMODULE_DIR" | ||
git add "build/$SUBMODULE_DIR" | ||
done | ||
fi | ||
|
||
if [ "$ANSIBLE_ENABLED" = "true" ]; then | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -81,6 +81,10 @@ | |
[submodule "build/chef/iam"] | ||
path = build/chef/iam | ||
url = [email protected]:GoogleCloudPlatform/chef-google-iam.git | ||
[submodule "build/terraform-beta"] | ||
path = build/terraform-beta | ||
url = [email protected]:terraform-providers/terraform-provider-google-beta.git | ||
branch = 2.0.0 | ||
[submodule "build/inspec"] | ||
path = build/inspec | ||
url = [email protected]:modular-magician/inspec-gcp.git |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I still kind of think this is a sort of false generality - the best version of generality would be a lookup from version string to provider name. I also kind of think that it's odd to special-case one out of two values here.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
just to confirm what this would mean in practice- having a map variable that we can do the PROVIDER_NAME/SUBMODULE_DIR/etc lookups in?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's the best implementation I can imagine, yeah. As-is, I argue we're very likely to need to change it up if we ever add an tpg-alpha, and a lookup gives us flexibility.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is great!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks!