-
Notifications
You must be signed in to change notification settings - Fork 1.7k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into compute-typo
- Loading branch information
Showing
54 changed files
with
1,159 additions
and
277 deletions.
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 |
---|---|---|
@@ -0,0 +1,73 @@ | ||
#!/bin/bash | ||
|
||
set -e | ||
set -x | ||
|
||
function cleanup { | ||
cd $TF_PATH | ||
./terraform destroy -auto-approve | ||
} | ||
|
||
# Service account credentials for GCP to allow terraform to work | ||
export GOOGLE_CLOUD_KEYFILE_JSON="/tmp/google-account.json" | ||
# Setup GOPATH | ||
export GOPATH=${PWD}/go | ||
|
||
# CI sets the contents of our json account secret in our environment; dump it | ||
# to disk for use in tests. | ||
echo "${TERRAFORM_KEY}" > /tmp/google-account.json | ||
|
||
git clone https://github.com/slevenick/inspec-gcp.git | ||
|
||
# new train plugin not published yet, install locally for now | ||
pushd inspec-gcp | ||
bundle | ||
inspec plugin install train-gcp2/lib/train-gcp2.rb | ||
|
||
popd | ||
|
||
pushd inspec-gcp/test/integration | ||
|
||
# Generate tfvars | ||
pushd attributes | ||
ruby compile_vars.rb > terraform.tfvars | ||
mv terraform.tfvars ../terraform | ||
popd | ||
|
||
# Run terraform | ||
pushd terraform | ||
wget https://releases.hashicorp.com/terraform/0.11.10/terraform_0.11.10_linux_amd64.zip | ||
apt-get install unzip | ||
unzip terraform_0.11.10_linux_amd64.zip | ||
./terraform init | ||
./terraform plan | ||
|
||
export TF_PATH=${PWD} | ||
trap cleanup EXIT | ||
./terraform apply -auto-approve | ||
export GOOGLE_APPLICATION_CREDENTIALS="${PWD}/inspec.json" | ||
inspec detect -t gcp2:// | ||
popd | ||
|
||
# Copy inspec resources | ||
pushd inspec-mm | ||
cp -r ../../../libraries libraries | ||
popd | ||
|
||
# Run inspec | ||
bundle | ||
|
||
# Service accounts take several minutes to be authorized everywhere | ||
set +e | ||
|
||
for i in {1..50} | ||
do | ||
inspec exec inspec-mm --attrs=attributes/attributes.yaml -t gcp2:// | ||
if [ "$?" -eq "0" ]; then | ||
exit 0 | ||
fi | ||
done | ||
set -e | ||
|
||
popd | ||
exit 100 |
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 |
---|---|---|
@@ -0,0 +1,13 @@ | ||
platform: linux | ||
|
||
inputs: | ||
- name: magic-modules-new-prs | ||
|
||
image_resource: | ||
type: docker-image | ||
source: | ||
repository: nmckinley/go-ruby-python | ||
tag: '1.11-2.5.1-2.7' | ||
|
||
run: | ||
path: magic-modules-new-prs/.ci/acceptance-tests/inspec-integration.sh |
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
Submodule inspec
updated
26 files
Submodule terraform
updated
from 0142f2 to 6f8458
Submodule terraform-beta
updated
from e225e9 to 572788
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
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 |
---|---|---|
@@ -0,0 +1,90 @@ | ||
# Copyright 2018 Google Inc. | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
|
||
require 'google/yaml_validator' | ||
|
||
module Provider | ||
module Overrides | ||
# All overrides act as a Hash under-the-hood. | ||
# This class allows them to get access to | ||
# Hash functions + lets the YAML parser import them. | ||
class OverrideResource < Google::YamlValidator | ||
# Used for testing. | ||
def initialize(hash = {}) | ||
hash.each { |k, v| instance_variable_set("@#{k}", v) } | ||
end | ||
|
||
# All keys in this "hash" are actually instance_variables with | ||
# the @name notation. | ||
# We're abstracting away the @name notation and allowing | ||
# for @name or `name` to be valid. | ||
def [](key) | ||
if key.to_s[0] == '@' | ||
instance_variable_get(key.to_sym) | ||
else | ||
instance_variable_get("@#{key}") | ||
end | ||
end | ||
|
||
def empty? | ||
instance_variables.empty? | ||
end | ||
|
||
# This allows OverrideResource to take advantage of | ||
# the YAMLValidator's validation without being tied down | ||
# to it. | ||
def validate | ||
instance_variables.each do |var_name| | ||
var = instance_variable_get(var_name) | ||
var.validate if var.respond_to?(:validate) | ||
end | ||
end | ||
end | ||
|
||
# A hash of Provider::ResourceOverride objects where the key is the api name | ||
# for that object. | ||
# | ||
# Example usage in a provider.yaml file where you want to extend a resource | ||
# description: | ||
# | ||
# overrides: !ruby/object:Provider::ResourceOverrides | ||
# SomeResource: !ruby/object:Provider::MyProvider::ResourceOverride | ||
# description: '{{description}} A tool-specific description complement' | ||
# parameters: | ||
# someParameter: !ruby/object:Provider::MyProvider::PropertyOverride | ||
# description: 'foobar' # replaces description | ||
# properties: | ||
# someProperty: !ruby/object:Provider::MyProvider::PropertyOverride | ||
# description: 'foobar' # replaces description | ||
# anotherProperty.someNestedProperty: | ||
# !ruby/object:Provider::MyProvider::PropertyOverride | ||
# description: 'baz' | ||
# ... | ||
class ResourceOverrides < OverrideResource | ||
end | ||
|
||
# Override to an Api::Resource in api.yaml | ||
class ResourceOverride < OverrideResource | ||
def apply(_resource) | ||
self | ||
end | ||
end | ||
|
||
# Override to a Api::Type in api.yaml | ||
class PropertyOverride < OverrideResource | ||
def apply(_resource) | ||
self | ||
end | ||
end | ||
end | ||
end |
Oops, something went wrong.