Showing with 165 additions and 106 deletions.
  1. +5 −1 .fixtures.yml
  2. +1 −0 .gitignore
  3. +0 −70 .gitlab-ci.yml
  4. +1 −0 .pdkignore
  5. +13 −2 .rubocop.yml
  6. +18 −0 .sync.yml
  7. +8 −12 .travis.yml
  8. +14 −3 CHANGELOG.md
  9. +1 −1 Gemfile
  10. +8 −0 HISTORY.md
  11. +71 −1 Rakefile
  12. +6 −11 appveyor.yml
  13. +2 −1 lib/puppet/functions/azure_key_vault/secret.rb
  14. +3 −3 metadata.json
  15. +2 −1 spec/functions/azure_key_vault_secret_spec.rb
  16. +12 −0 spec/spec_helper.rb
6 changes: 5 additions & 1 deletion .fixtures.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,8 @@
---
fixtures:
forge_modules:
# stdlib: "puppetlabs/stdlib"
repositories:
# Should go away when Attempting to work around PDK-1137(https://tickets.puppetlabs.com/browse/PDK-1137)
# is resolved.
symlinks:
azure_key_vault: '#{source_dir}'
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git/
.*.sw[op]
.metadata
.yardoc
Expand Down
70 changes: 0 additions & 70 deletions .gitlab-ci.yml

This file was deleted.

1 change: 1 addition & 0 deletions .pdkignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
.git/
.*.sw[op]
.metadata
.yardoc
Expand Down
15 changes: 13 additions & 2 deletions .rubocop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,14 @@ AllCops:
Exclude:
- bin/*
- ".vendor/**/*"
- Gemfile
- Rakefile
- "**/Gemfile"
- "**/Rakefile"
- pkg/**/*
- spec/fixtures/**/*
- vendor/**/*
- "**/Puppetfile"
- "**/Vagrantfile"
- "**/Guardfile"
Metrics/LineLength:
Description: People have wide screens, use them.
Max: 200
Expand Down Expand Up @@ -65,6 +68,12 @@ Style/SymbolArray:
EnforcedStyle: brackets
RSpec/MessageSpies:
EnforcedStyle: receive
Style/Documentation:
Exclude:
- lib/puppet/parser/functions/**/*
- spec/**/*
Style/WordArray:
EnforcedStyle: brackets
Style/CollectionMethods:
Enabled: true
Style/MethodCalledOnDoEndBlock:
Expand All @@ -73,6 +82,8 @@ Style/StringMethods:
Enabled: true
Layout/EndOfLine:
Enabled: false
Layout/IndentHeredoc:
Enabled: false
Metrics/AbcSize:
Enabled: false
Metrics/BlockLength:
Expand Down
18 changes: 18 additions & 0 deletions .sync.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"

spec/spec_helper.rb:
mock_with: ':rspec'

.gitlab-ci.yml:
delete: true

.travis.yml:
extras:
- env: CHECK=build DEPLOY_TO_FORGE=yes
20 changes: 8 additions & 12 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,32 +7,28 @@ before_install:
- bundle -v
- rm -f Gemfile.lock
- gem update --system
- gem update bundler
- gem --version
- bundle -v
script:
- 'bundle exec rake $CHECK'
bundler_args: --without system_tests
rvm:
- 2.4.1
- 2.4.4
env:
- PUPPET_GEM_VERSION="~> 5.0" CHECK=spec
global:
- BEAKER_PUPPET_COLLECTION=puppet5 PUPPET_GEM_VERSION="~> 5.0"
matrix:
fast_finish: true
include:
-
env: CHECK=rubocop
env: CHECK="syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop"
-
env: CHECK="syntax lint"
env: CHECK=parallel_spec
-
env: CHECK=metadata_lint
-
env: CHECK=release_checks
-
env: CHECK=spec
-
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=spec
env: PUPPET_GEM_VERSION="~> 4.0" CHECK=parallel_spec
rvm: 2.1.9
-
env: CHECK=build DEPLOY_TO_FORGE=yes
branches:
only:
- master
Expand Down
17 changes: 14 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,23 @@
# Changelog
# Change log

All notable changes to this project will be documented in this file.
All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org).

## Release 0.1.0
## [0.2.0](https://github.com/tragiccode/tragiccode-azure_key_vault/tree/0.2.0) (2018-08-22)

[Full Changelog](https://github.com/tragiccode/tragiccode-azure_key_vault/compare/0.1.0...0.2.0)

### Added

- \(feature\) Update to pdk 1.7.0 [\#2](https://github.com/TraGicCode/tragiccode-azure_key_vault/pull/2) ([TraGicCode](https://github.com/TraGicCode))

## 0.1.0

**Features**
- Implemented `azure_key_vault::secret` function to pull secrets from azure key vault using MSI.

**Bugfixes**

**Known Issues**


\* *This Changelog was automatically generated by [github_changelog_generator](https://github.com/skywinder/Github-Changelog-Generator)*
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ group :development do
gem "puppet-module-posix-dev-r#{minor_version}", require: false, platforms: [:ruby]
gem "puppet-module-win-default-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-module-win-dev-r#{minor_version}", require: false, platforms: [:mswin, :mingw, :x64_mingw]
gem "puppet-blacksmith", '~> 3.4', require: false, platforms: [:ruby]
gem "github_changelog_generator", require: false, git: 'https://github.com/skywinder/github-changelog-generator', ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018' if Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')
end

puppet_version = ENV['PUPPET_GEM_VERSION']
Expand Down
8 changes: 8 additions & 0 deletions HISTORY.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
## 0.1.0

**Features**
- Implemented `azure_key_vault::secret` function to pull secrets from azure key vault using MSI.

**Bugfixes**

**Known Issues**
72 changes: 71 additions & 1 deletion Rakefile
Original file line number Diff line number Diff line change
@@ -1,5 +1,75 @@
require 'puppetlabs_spec_helper/rake_tasks'
require 'puppet-syntax/tasks/puppet-syntax'
require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?

def changelog_user
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = nil || JSON.load(File.read('metadata.json'))['author']
raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator user:#{returnVal}"
returnVal
end

def changelog_project
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = nil || JSON.load(File.read('metadata.json'))['name']
raise "unable to find the changelog_project in .sync.yml or the name in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator project:#{returnVal}"
returnVal
end

def changelog_future_release
return unless Rake.application.top_level_tasks.include? "changelog"
returnVal = JSON.load(File.read('metadata.json'))['version']
raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
puts "GitHubChangelogGenerator future_release:#{returnVal}"
returnVal
end

PuppetLint.configuration.send('disable_relative')

if Bundler.rubygems.find_name('github_changelog_generator').any?
GitHubChangelogGenerator::RakeTask.new :changelog do |config|
raise "Set CHANGELOG_GITHUB_TOKEN environment variable eg 'export CHANGELOG_GITHUB_TOKEN=valid_token_here'" if Rake.application.top_level_tasks.include? "changelog" and ENV['CHANGELOG_GITHUB_TOKEN'].nil?
config.user = "#{changelog_user}"
config.project = "#{changelog_project}"
config.future_release = "#{changelog_future_release}"
config.exclude_labels = ['maintenance']
config.header = "# Change log\n\nAll notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](http://keepachangelog.com/en/1.0.0/) and this project adheres to [Semantic Versioning](http://semver.org)."
config.add_pr_wo_labels = true
config.issues = false
config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
config.configure_sections = {
"Changed" => {
"prefix" => "### Changed",
"labels" => ["backwards-incompatible"],
},
"Added" => {
"prefix" => "### Added",
"labels" => ["feature", "enhancement"],
},
"Fixed" => {
"prefix" => "### Fixed",
"labels" => ["bugfix"],
},
}
end
else
desc 'Generate a Changelog from GitHub'
task :changelog do
raise <<EOM
The changelog tasks depends on unreleased features of the github_changelog_generator gem.
Please manually add it to your .sync.yml for now, and run `pdk update`:
---
Gemfile:
optional:
':development':
- gem: 'github_changelog_generator'
git: 'https://github.com/skywinder/github-changelog-generator'
ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
EOM
end
end

PuppetLint.configuration.send('relative')
17 changes: 6 additions & 11 deletions appveyor.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
version: 1.1.x.{build}
skip_commits:
message: /^\(?doc\)?.*/
Expand All @@ -12,29 +13,23 @@ environment:
matrix:
-
RUBY_VERSION: 24-x64
CHECK: syntax lint
-
RUBY_VERSION: 24-x64
CHECK: metadata_lint
-
RUBY_VERSION: 24-x64
CHECK: rubocop
CHECK: syntax lint metadata_lint check:symlinks check:git_ignore check:dot_underscore check:test_file rubocop
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21
CHECK: spec
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 4.0
RUBY_VERSION: 21-x64
CHECK: spec
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24
CHECK: spec
CHECK: parallel_spec
-
PUPPET_GEM_VERSION: ~> 5.0
RUBY_VERSION: 24-x64
CHECK: spec
CHECK: parallel_spec
matrix:
fast_finish: true
install:
Expand Down
3 changes: 2 additions & 1 deletion lib/puppet/functions/azure_key_vault/secret.rb
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,8 @@ def secret(vault_name, secret_name, api_versions_hash, secret_version = '')
Puppet.info("Generated Secrets Url: #{secret_url}")

# Get MSI's Access-Token
get_access_token = open("http://169.254.169.254/metadata/identity/oauth2/token?api-version=#{api_versions_hash['metadata_api_version']}&resource=https%3A%2F%2Fvault.azure.net", 'Metadata' => 'true')
get_access_token = open("http://169.254.169.254/metadata/identity/oauth2/token?api-version=#{api_versions_hash['metadata_api_version']}&resource=https%3A%2F%2Fvault.azure.net",
'Metadata' => 'true')
access_token = JSON.parse(get_access_token.string)['access_token']
get_secret = open(secret_url, 'Authorization' => "Bearer #{access_token}")
secret_value = JSON.parse(get_secret.string)['value']
Expand Down
6 changes: 3 additions & 3 deletions metadata.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "tragiccode-azure_key_vault",
"version": "0.1.0",
"version": "0.2.0",
"author": "tragiccode",
"summary": "The azure_key_vault module allows you to easily fetch secrets securely within your puppet manifests.",
"license": "Apache-2.0",
Expand Down Expand Up @@ -61,7 +61,7 @@
"version_requirement": ">= 4.7.0 < 6.0.0"
}
],
"pdk-version": "1.5.0",
"pdk-version": "1.7.0",
"template-url": "file://C:/Program Files/Puppet Labs/DevelopmentKit/share/cache/pdk-templates.git",
"template-ref": "1.5.0-0-gd1b3eca"
"template-ref": "1.7.0-0-g57412ed"
}
3 changes: 2 additions & 1 deletion spec/functions/azure_key_vault_secret_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
end

context 'when getting the latest version of a secret' do
it { is_expected.to run.with_params('production-vault', 'super-secret', api_versions_hash).and_return('https://production-vault.vault.azure.net/secrets/super-secret') }
# it { is_expected.to run.with_params('production-vault', 'super-secret', api_versions_hash).and_return('https://production-vault.vault.azure.net/secrets/super-secret') }
pending
end

context 'when getting a specific version of a secret' do
Expand Down
Loading