-
Notifications
You must be signed in to change notification settings - Fork 1.5k
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
Support unordered lists in Terraform. #351
Merged
Merged
Changes from all commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0beafb3
Support unordered lists in Terraform.
nat-henderson 025460c
A Concourse Resource for puppet forge. (#326)
nat-henderson 76056c4
Use schema.Set instead of equality comparisons.
nat-henderson 617ed27
Reorganize customize diff to be its own function for better functiona…
nat-henderson 67b8bf1
Travis maintainers recommend dropping this workaround.
nat-henderson 06937fd
Travis maintainers recommend dropping this workaround. (#357)
nat-henderson 3b8431d
Reduce nesting.
nat-henderson a85cfc0
Merge 3b8431dcc5760e1bdf833534ea3cf449917c6824 into 06937fd5a89b34ba0…
nat-henderson 7099834
Update tracked submodules -> HEAD on Tue Jul 17 22:21:13 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 |
---|---|---|
@@ -0,0 +1,64 @@ | ||
from alpine:latest as resource | ||
|
||
# Install Ruby from source. | ||
RUN apk update | ||
RUN apk add --no-cache --virtual .ruby-builddeps \ | ||
autoconf \ | ||
bash \ | ||
bison \ | ||
bzip2 \ | ||
bzip2-dev \ | ||
ca-certificates \ | ||
coreutils \ | ||
dpkg-dev dpkg \ | ||
gcc \ | ||
g++ \ | ||
gdbm-dev \ | ||
git \ | ||
glib-dev \ | ||
libc-dev \ | ||
libffi-dev \ | ||
libressl \ | ||
libressl-dev \ | ||
libxml2-dev \ | ||
libxslt-dev \ | ||
linux-headers \ | ||
make \ | ||
ncurses-dev \ | ||
openssh-client \ | ||
procps \ | ||
readline-dev \ | ||
ruby \ | ||
tar \ | ||
xz \ | ||
yaml-dev \ | ||
zlib-dev | ||
ENV RUBY_VERSION 2.5.0 | ||
ENV RUBYGEMS_VERSION 2.7.4 | ||
ENV BUNDLER_VERSION 1.16.1 | ||
|
||
# Set up Github SSH cloning. | ||
RUN ssh-keyscan github.com >> /known_hosts | ||
RUN echo "UserKnownHostsFile /known_hosts" >> /etc/ssh/ssh_config | ||
|
||
RUN git clone https://github.com/rbenv/ruby-build.git | ||
RUN PREFIX=/usr/local ./ruby-build/install.sh | ||
ENV RUBY_CONFIGURE_OPTS="ac_cv_func_isnan=yes ac_cv_func_isinf=yes" | ||
RUN ruby-build "$RUBY_VERSION" /usr/ | ||
|
||
RUN gem update --system "$RUBYGEMS_VERSION" | ||
RUN gem install bundler --version "$BUNDLER_VERSION" --force | ||
|
||
ENV GEM_HOME /usr/local/bundle | ||
ENV BUNDLE_PATH="$GEM_HOME" \ | ||
BUNDLE_BIN="$GEM_HOME/bin" \ | ||
BUNDLE_SILENCE_ROOT_WARNING=1 \ | ||
BUNDLE_APP_CONFIG="$GEM_HOME" | ||
ENV PATH $BUNDLE_BIN:$PATH | ||
RUN mkdir -p "$GEM_HOME" "$BUNDLE_BIN" \ | ||
&& chmod 777 "$GEM_HOME" "$BUNDLE_BIN" | ||
COPY in.rb /opt/resource/in | ||
COPY check.rb /opt/resource/check | ||
COPY out.rb /opt/resource/out | ||
COPY Gemfile /opt/resource/Gemfile | ||
RUN cd /opt/resource/ && bundle install |
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,4 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'puppet_forge' | ||
gem 'puppet-blacksmith' |
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,27 @@ | ||
#! /usr/bin/env ruby | ||
# 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. | ||
|
||
require 'puppet_forge' | ||
require 'json' | ||
|
||
config = JSON.parse(STDIN.read) | ||
raise 'You need to define `module_name`' unless config['source'].key? 'module_name' | ||
m = PuppetForge::Module.find(config['source']['module_name']) | ||
releases = m.releases.map! { |r| { 'release' => r.version } } | ||
|
||
if config.key? 'version' | ||
releases = releases[0..releases.index(config['version'])] | ||
end | ||
|
||
puts JSON.dump(releases) |
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,32 @@ | ||
#! /usr/bin/env ruby | ||
# 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. | ||
|
||
require 'puppet_forge' | ||
require 'json' | ||
|
||
config = JSON.parse(STDIN.read) | ||
unless config['source'].key? 'module_name' | ||
raise 'You need to define `module_name`' | ||
end | ||
raise 'Surprised by lack of directory.' if ARGV.empty? | ||
|
||
release_slug = "#{config['source']['module_name']}-" \ | ||
"#{config['version']['release']}" | ||
release = PuppetForge::Release.find(release_slug) | ||
release_tarball = release_slug + '.tar.gz' | ||
release.download(Pathname(release_tarball)) | ||
release.verify(Pathname(release_tarball)) | ||
PuppetForge::Unpacker.unpack(release_tarball, ARGV[0], '/tmp/resource_download') | ||
|
||
puts JSON.dump('version' => { 'release' => release.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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
#! /usr/bin/env ruby | ||
# 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. | ||
|
||
require 'puppet_forge' | ||
require 'puppet_blacksmith' | ||
require 'json' | ||
|
||
config = JSON.parse(STDIN.read) | ||
unless config['source'].key? 'module_name' | ||
raise 'You need to define `module_name`' | ||
end | ||
raise 'This is being called without an output directory.' if ARGV.empty? | ||
|
||
module_name = config['source']['module_name'] | ||
release = PuppetForge::Module.find(module_name).releases.first.version | ||
major, minor, patch = release.split('.') | ||
|
||
if major.nil? || minor.nil? || patch.nil? | ||
raise "Cowardly refusing to work with non-semver release ID #{release}" | ||
end | ||
|
||
if config['params']['patch_bump'] == true | ||
patch += 1 | ||
else | ||
patch = 0 | ||
minor += 1 | ||
end | ||
|
||
output_folder = ARGV[0] | ||
metadata = JSON.parse(File.open(File.join(output_folder, 'metadata.json')).read) | ||
unless metadata['name'] == module_name | ||
raise "Cowardly refusing to push #{metadata['name']} to #{module_name}" | ||
end | ||
metadata['version'] = "#{major}.#{minor}.#{patch}" | ||
File.write(File.join(output_folder, 'metadata.json'), JSON.dump(metadata)) | ||
|
||
Dir.chdir(output_folder) { %x(puppet module build) } | ||
|
||
Blacksmith::Forge.initialize(config['source']['username'], | ||
config['source']['password']) | ||
Blacksmith::Forge.push!(metadata['name'].split('-').last, | ||
File.join(output_folder, | ||
'pkg', | ||
"#{metadata['name']}-#{metadata['version']}" \ | ||
'.tar.gz')) | ||
puts JSON.dump('version' => { 'release' => metadata['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
Submodule terraform
updated
from ba2ea6 to aa20a0
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 |
---|---|---|
@@ -1,3 +1,4 @@ | ||
CustomizeDiff: customdiff.All( | ||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr), | ||
customdiff.ForceNewIfChange("ip_cidr_range", isShrinkageIpCidr), | ||
resourceComputeSubnetworkSecondaryIpRangeSetStyleDiff, | ||
), |
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,39 @@ | ||
keys := diff.GetChangedKeysPrefix(<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>) | ||
if len(keys) == 0 { | ||
return nil | ||
} | ||
oldCount, newCount := diff.GetChange("<%= Google::StringUtils.underscore(prop.name) -%>.#") | ||
var count int | ||
// There could be duplicates - worth continuing even if the counts are unequal. | ||
if oldCount.(int) < newCount.(int) { | ||
count = newCount.(int) | ||
} else { | ||
count = oldCount.(int) | ||
} | ||
|
||
if count < 1 { | ||
return nil | ||
} | ||
old := make([]interface{}, count) | ||
new := make([]interface{}, count) | ||
for i := 0; i < count; i++ { | ||
o, n := diff.GetChange(fmt.Sprintf("<%= Google::StringUtils.underscore(prop.name) -%>.%d", i)) | ||
|
||
if o != nil { | ||
old = append(old, o) | ||
} | ||
if n != nil { | ||
new = append(new, n) | ||
} | ||
} | ||
|
||
oldSet := schema.NewSet(schema.HashResource(resource<%= resource_name -%>().Schema[<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>].Elem.(*schema.Resource)), old) | ||
newSet := schema.NewSet(schema.HashResource(resource<%= resource_name -%>().Schema[<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>].Elem.(*schema.Resource)), new) | ||
|
||
if oldSet.Equal(newSet) { | ||
if err := diff.Clear(<%= go_literal(Google::StringUtils.underscore(prop.name)) -%>); err != nil { | ||
return err | ||
} | ||
} | ||
|
||
return nil |
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.
why this change?
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.
The problem comes from the fact that we're implicitly comparing against the returned value from the API - we wouldn't have any diff problems otherwise.