annotate modules/mysql/Rakefile @ 293:55762b436f89

Add more blacklisted SSH usernames
author IBBoard <dev@ibboard.co.uk>
date Sun, 19 Jan 2020 15:57:43 +0000
parents 48d3a1948e4d
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
1 require 'puppet_litmus/rake_tasks' if Bundler.rubygems.find_name('puppet_litmus').any?
0
956e484adc12 Initial public release of Puppet configs
IBBoard <dev@ibboard.co.uk>
parents:
diff changeset
2 require 'puppetlabs_spec_helper/rake_tasks'
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
3 require 'puppet-syntax/tasks/puppet-syntax'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
4 require 'puppet_blacksmith/rake_tasks' if Bundler.rubygems.find_name('puppet-blacksmith').any?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
5 require 'github_changelog_generator/task' if Bundler.rubygems.find_name('github_changelog_generator').any?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
6 require 'puppet-strings/tasks' if Bundler.rubygems.find_name('puppet-strings').any?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
7 require 'puppet_pot_generator/rake_tasks'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
8
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
9 def changelog_user
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
10 return unless Rake.application.top_level_tasks.include? "changelog"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
11 returnVal = nil || JSON.load(File.read('metadata.json'))['author']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
12 raise "unable to find the changelog_user in .sync.yml, or the author in metadata.json" if returnVal.nil?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
13 puts "GitHubChangelogGenerator user:#{returnVal}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
14 returnVal
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
15 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
16
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
17 def changelog_project
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
18 return unless Rake.application.top_level_tasks.include? "changelog"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
19
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
20 returnVal = nil
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
21 returnVal ||= begin
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
22 metadata_source = JSON.load(File.read('metadata.json'))['source']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
23 metadata_source_match = metadata_source && metadata_source.match(%r{.*\/([^\/]*?)(?:\.git)?\Z})
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
24
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
25 metadata_source_match && metadata_source_match[1]
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
26 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
27
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
28 raise "unable to find the changelog_project in .sync.yml or calculate it from the source in metadata.json" if returnVal.nil?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
29
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
30 puts "GitHubChangelogGenerator project:#{returnVal}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
31 returnVal
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
32 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
33
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
34 def changelog_future_release
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
35 return unless Rake.application.top_level_tasks.include? "changelog"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
36 returnVal = "v%s" % JSON.load(File.read('metadata.json'))['version']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
37 raise "unable to find the future_release (version) in metadata.json" if returnVal.nil?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
38 puts "GitHubChangelogGenerator future_release:#{returnVal}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
39 returnVal
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
40 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
41
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
42 PuppetLint.configuration.send('disable_relative')
26
58d1818c2ded Update MySQL module (which adds "staging" module)
IBBoard <dev@ibboard.co.uk>
parents: 0
diff changeset
43
244
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
44 if Bundler.rubygems.find_name('github_changelog_generator').any?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
45 GitHubChangelogGenerator::RakeTask.new :changelog do |config|
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
46 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?
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
47 config.user = "#{changelog_user}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
48 config.project = "#{changelog_project}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
49 config.future_release = "#{changelog_future_release}"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
50 config.exclude_labels = ['maintenance']
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
51 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)."
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
52 config.add_pr_wo_labels = true
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
53 config.issues = false
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
54 config.merge_prefix = "### UNCATEGORIZED PRS; GO LABEL THEM"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
55 config.configure_sections = {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
56 "Changed" => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
57 "prefix" => "### Changed",
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
58 "labels" => ["backwards-incompatible"],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
59 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
60 "Added" => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
61 "prefix" => "### Added",
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
62 "labels" => ["feature", "enhancement"],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
63 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
64 "Fixed" => {
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
65 "prefix" => "### Fixed",
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
66 "labels" => ["bugfix"],
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
67 },
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
68 }
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
69 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
70 else
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
71 desc 'Generate a Changelog from GitHub'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
72 task :changelog do
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
73 raise <<EOM
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
74 The changelog tasks depends on unreleased features of the github_changelog_generator gem.
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
75 Please manually add it to your .sync.yml for now, and run `pdk update`:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
76 ---
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
77 Gemfile:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
78 optional:
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
79 ':development':
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
80 - gem: 'github_changelog_generator'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
81 git: 'https://github.com/skywinder/github-changelog-generator'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
82 ref: '20ee04ba1234e9e83eb2ffb5056e23d641c7a018'
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
83 condition: "Gem::Version.new(RUBY_VERSION.dup) >= Gem::Version.new('2.2.2')"
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
84 EOM
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
85 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
86 end
48d3a1948e4d Update MySQL module
IBBoard <dev@ibboard.co.uk>
parents: 26
diff changeset
87