-
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.
Add InSpec support for source repositories (#1411)
Merged PR #1411.
- Loading branch information
1 parent
f396a11
commit abf1d64
Showing
10 changed files
with
79 additions
and
24 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
Submodule inspec
updated
62 files
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,19 @@ | ||
# Copyright 2017 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. | ||
|
||
--- !ruby/object:Provider::Inspec::Config | ||
manifest: !ruby/object:Provider::Inspec::Manifest | ||
summary: 'InSpec resources for verifying GCP infrastructure' | ||
description: | | ||
InSpec resources for verifying GCP infrastructure | ||
overrides: !ruby/object:Overrides::ResourceOverrides |
10 changes: 10 additions & 0 deletions
10
templates/inspec/examples/google_sourcerepo_repository/google_sourcerepo_repositories.erb
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,10 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% repository = grab_attributes['repository'] -%> | ||
repo_name = <%= doc_generation ? "'#{repository['name']}'" : "repository['name']" %> | ||
describe.one do | ||
google_sourcerepo_repositories(project: <%= gcp_project_id -%>).names.each do |name| | ||
describe name do | ||
it { should match /\/repos\/#{repo_name}$/ } | ||
end | ||
end | ||
end |
9 changes: 9 additions & 0 deletions
9
templates/inspec/examples/google_sourcerepo_repository/google_sourcerepo_repository.erb
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,9 @@ | ||
<% gcp_project_id = "#{external_attribute('gcp_project_id', doc_generation)}" -%> | ||
<% repository = grab_attributes['repository'] -%> | ||
describe google_sourcerepo_repository(project: <%= gcp_project_id -%>, name: <%= doc_generation ? "'#{repository['name']}'" : "repository['name']" -%>) do | ||
it { should exist } | ||
end | ||
|
||
describe google_sourcerepo_repository(project: <%= gcp_project_id -%>, name: 'nonexistent') do | ||
it { should_not exist } | ||
end |
2 changes: 2 additions & 0 deletions
2
.../inspec/examples/google_sourcerepo_repository/google_sourcerepo_repository_attributes.erb
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,2 @@ | ||
gcp_project_id = attribute(:gcp_project_id, default: '<%= external_attribute('gcp_project_id') -%>', description: 'The GCP project identifier.') | ||
repository = attribute('repository', default: <%= JSON.pretty_generate(grab_attributes['repository']) -%>, description: 'Source Repository definition') |
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