onceover 3.12.4 → 3.12.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.gitignore +1 -0
- data/Gemfile +6 -0
- data/appveyor.yml +38 -0
- data/lib/onceover/deploy.rb +40 -61
- data/onceover.gemspec +1 -1
- data/spec/fixtures/controlrepos/caching/Puppetfile +17 -17
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 457f570eb2550258473e9dca14eaecb7e317b88e39268472433b70dda6f69b75
|
4
|
+
data.tar.gz: 9ca15f1a931075c8cbcdd5268bebd5ec37fbf7b07faf382a1f9fb3dc226f5bb3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4e1e6713d8a54660aad1128d7f1e8ea920d59c5b77f72e37b508a8f203a6ecdcbe00043ddc5455e52fc0f81c7de984509793f0ed3ba468b6102e4d0c72eced48
|
7
|
+
data.tar.gz: 699733093cabc26131eccacb05e91a5a068b0266255d769c13f479bb28740f850608337d49ee1160f96d08334a785221be79549da071c8ad67b847f327e3f094
|
data/.gitignore
CHANGED
data/Gemfile
CHANGED
@@ -17,3 +17,9 @@ end
|
|
17
17
|
if File.exists?(File.join(Dir.home, '.gemfile'))
|
18
18
|
eval(File.read(File.join(Dir.home, '.gemfile')), binding)
|
19
19
|
end
|
20
|
+
|
21
|
+
if ENV['APPVEYOR'] == 'True'
|
22
|
+
# R10k needs to be pinned to this until the next release after 3.1.1
|
23
|
+
# in order to not have symlinks and therefor work on windows
|
24
|
+
gem 'r10k', git: 'https://github.com/puppetlabs/r10k.git'
|
25
|
+
end
|
data/appveyor.yml
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
---
|
2
|
+
image: Visual Studio 2017
|
3
|
+
|
4
|
+
cache:
|
5
|
+
- vendor/bundle
|
6
|
+
|
7
|
+
branches:
|
8
|
+
only:
|
9
|
+
- master
|
10
|
+
|
11
|
+
environment:
|
12
|
+
matrix:
|
13
|
+
- RUBY_VERSION: "24"
|
14
|
+
- RUBY_VERSION: "24-x64"
|
15
|
+
- RUBY_VERSION: "25"
|
16
|
+
- RUBY_VERSION: "25-x64"
|
17
|
+
|
18
|
+
# scripts that are called at very beginning, before repo cloning
|
19
|
+
init:
|
20
|
+
- ps: Set-ItemProperty -Path HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem -Name LongPathsEnabled -Value 1 -Type DWord
|
21
|
+
|
22
|
+
matrix:
|
23
|
+
fast_finish: false
|
24
|
+
|
25
|
+
install:
|
26
|
+
- set PATH=C:\Ruby%RUBY_VERSION%\bin;%PATH%
|
27
|
+
- bundle config --local path vendor/bundle
|
28
|
+
- bundle install
|
29
|
+
|
30
|
+
build: "off"
|
31
|
+
|
32
|
+
before_test:
|
33
|
+
- ruby -v
|
34
|
+
- gem -v
|
35
|
+
- bundle -v
|
36
|
+
|
37
|
+
test_script:
|
38
|
+
- bundle exec rake full_tests
|
data/lib/onceover/deploy.rb
CHANGED
@@ -4,6 +4,8 @@ class Onceover
|
|
4
4
|
def deploy_local(repo = Onceover::Controlrepo.new, opts = {})
|
5
5
|
require 'onceover/controlrepo'
|
6
6
|
require 'pathname'
|
7
|
+
require 'fileutils'
|
8
|
+
require 'json'
|
7
9
|
|
8
10
|
logger.debug 'Deploying locally (R10K)...'
|
9
11
|
|
@@ -17,70 +19,61 @@ class Onceover
|
|
17
19
|
FileUtils.mkdir_p(repo.tempdir)
|
18
20
|
end
|
19
21
|
|
20
|
-
#
|
22
|
+
# Overall plan: Copy everything in control repo to a tempdir then move the tempdir to the
|
21
23
|
# destination, just in case we get a recursive copy
|
22
|
-
|
23
|
-
|
24
|
-
#
|
25
|
-
#
|
26
|
-
#
|
27
|
-
#
|
28
|
-
#
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
24
|
+
|
25
|
+
# We need to exclude some files:
|
26
|
+
# * our own cache
|
27
|
+
# * stuff from git
|
28
|
+
# * stale puppet modules
|
29
|
+
# * random ruby gems (bundler/rvm?)
|
30
|
+
# * ...etc
|
31
|
+
excluded_dirs = [
|
32
|
+
File.join(repo.root, ".onceover"),
|
33
|
+
File.join(repo.root, ".git"),
|
34
|
+
File.join(repo.root, ".modules"),
|
35
|
+
]
|
36
|
+
excluded_dirs << ENV['GEM_HOME'] if ENV['GEM_HOME']
|
37
|
+
|
36
38
|
# A Local modules directory likely means that the user installed r10k folders into their local control repo
|
37
39
|
# This conflicts with the step where onceover installs r10k after copying the control repo to the temporary
|
38
40
|
# .onceover directory. The following skips copying the modules folder, to not later cause an error.
|
39
|
-
|
40
|
-
if File.directory?("#{repo.root}/modules")
|
41
|
+
if File.directory?("modules")
|
41
42
|
logger.warn "Found modules directory in your controlrepo, skipping the copy of this directory. If you installed modules locally using r10k, this warning is normal, if you have created modules in a local modules directory, onceover does not support testing these files, please rename this directory to conform with Puppet best practices, as this folder will conflict with Puppet's native installation of modules."
|
42
43
|
end
|
43
|
-
excluded_dirs << Pathname.new("#{repo.root}/modules")
|
44
44
|
|
45
|
-
|
45
|
+
logger.debug "Creating temp dir as a staging directory for copying the controlrepo to #{repo.tempdir}"
|
46
|
+
temp_controlrepo = Dir.mktmpdir('controlrepo')
|
46
47
|
|
47
|
-
#
|
48
|
-
|
49
|
-
parents = [path]
|
50
|
-
path.ascend do |parent|
|
51
|
-
parents << parent
|
52
|
-
end
|
53
|
-
parents.any? { |x| excluded_dirs.include?(x) }
|
54
|
-
end
|
48
|
+
# onceover stores a big list of all the relative paths it places within its cache directory
|
49
|
+
onceover_manifest = []
|
55
50
|
|
56
|
-
|
57
|
-
|
51
|
+
Find.find repo.root do |source|
|
52
|
+
# work out a relative path to this source, eg:
|
53
|
+
# /home/geoff/control-repo/foo/bar -> foo/bar
|
54
|
+
relative_source = Pathname.new(source).relative_path_from(Pathname.new(repo.root)).to_s
|
58
55
|
|
59
|
-
|
60
|
-
temp_controlrepo = Dir.mktmpdir('controlrepo')
|
56
|
+
target = File.join(temp_controlrepo, relative_source)
|
61
57
|
|
62
|
-
|
63
|
-
|
58
|
+
# ignore the path "." which represents the root of our control repo
|
59
|
+
if relative_source != "."
|
60
|
+
# add to list of files copied to cache by onceover
|
61
|
+
onceover_manifest << relative_source
|
64
62
|
|
65
|
-
|
66
|
-
|
67
|
-
|
63
|
+
if File.directory? source
|
64
|
+
Find.prune if excluded_dirs.include? source
|
65
|
+
FileUtils.mkdir target
|
66
|
+
else
|
67
|
+
FileUtils.copy source, target
|
68
|
+
end
|
69
|
+
end
|
68
70
|
end
|
69
|
-
|
70
71
|
logger.debug "Writing manifest of copied controlrepo files"
|
71
|
-
|
72
|
-
# Create a manifest of all files that were in the original repo
|
73
|
-
manifest = controlrepo_files.map do |file|
|
74
|
-
# Make sure the paths are relative so they remain relevant when used later
|
75
|
-
file.relative_path_from(Pathname(repo.root)).to_s
|
76
|
-
end
|
77
|
-
# Write all but the first as this is the root and we don't care about that
|
78
|
-
File.write("#{temp_controlrepo}/.onceover_manifest.json",manifest[1..-1].to_json)
|
72
|
+
File.write("#{temp_controlrepo}/.onceover_manifest.json", onceover_manifest.to_json)
|
79
73
|
|
80
74
|
# When using puppetfile vs deploy with r10k, we want to respect the :control_branch
|
81
75
|
# located in the Puppetfile. To accomplish that, we use git and find the current
|
82
76
|
# branch name, then replace strings within the staged puppetfile, prior to copying.
|
83
|
-
|
84
77
|
logger.debug "Checking current working branch"
|
85
78
|
git_branch = `git rev-parse --abbrev-ref HEAD`.chomp
|
86
79
|
|
@@ -91,7 +84,7 @@ class Onceover
|
|
91
84
|
new_puppetfile_contents = puppetfile_contents.gsub(/:control_branch/, "'#{git_branch}'")
|
92
85
|
File.write("#{temp_controlrepo}/Puppetfile", new_puppetfile_contents)
|
93
86
|
|
94
|
-
# Remove all files written by the
|
87
|
+
# Remove all files written by the last onceover run, but not the ones
|
95
88
|
# added by r10k, because that's what we are trying to cache but we don't
|
96
89
|
# know what they are
|
97
90
|
old_manifest_path = "#{repo.tempdir}/#{repo.environmentpath}/production/.onceover_manifest.json"
|
@@ -134,19 +127,5 @@ class Onceover
|
|
134
127
|
# Return repo.tempdir for use
|
135
128
|
repo.tempdir
|
136
129
|
end
|
137
|
-
|
138
|
-
private
|
139
|
-
|
140
|
-
def get_children_recursive(pathname)
|
141
|
-
results = []
|
142
|
-
results << pathname
|
143
|
-
pathname.each_child do |child|
|
144
|
-
results << child
|
145
|
-
if child.directory?
|
146
|
-
results << get_children_recursive(child)
|
147
|
-
end
|
148
|
-
end
|
149
|
-
results.flatten
|
150
|
-
end
|
151
130
|
end
|
152
131
|
end
|
data/onceover.gemspec
CHANGED
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift File.expand_path("../lib", __FILE__)
|
|
4
4
|
|
5
5
|
Gem::Specification.new do |s|
|
6
6
|
s.name = "onceover"
|
7
|
-
s.version = "3.12.
|
7
|
+
s.version = "3.12.5"
|
8
8
|
s.authors = ["Dylan Ratcliffe"]
|
9
9
|
s.email = ["dylan.ratcliffe@puppet.com"]
|
10
10
|
s.homepage = "https://github.com/dylanratcliffe/onceover"
|
@@ -1,17 +1,17 @@
|
|
1
|
-
forge "http://forge.puppetlabs.com"
|
2
|
-
#
|
3
|
-
# I want to download some modules to check if r10k feature in Onceover works correctly.
|
4
|
-
#
|
5
|
-
|
6
|
-
# Versions should be updated to be the latest at the time you start
|
7
|
-
mod "puppetlabs/stdlib", '4.11.0'
|
8
|
-
|
9
|
-
# Modules from Git
|
10
|
-
# Examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples
|
11
|
-
mod 'apache',
|
12
|
-
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
13
|
-
:commit => '83401079053dca11d61945bd9beef9ecf7576cbf'
|
14
|
-
|
15
|
-
#mod 'apache',
|
16
|
-
# :git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
17
|
-
# :branch => 'docs_experiment'
|
1
|
+
forge "http://forge.puppetlabs.com"
|
2
|
+
#
|
3
|
+
# I want to download some modules to check if r10k feature in Onceover works correctly.
|
4
|
+
#
|
5
|
+
|
6
|
+
# Versions should be updated to be the latest at the time you start
|
7
|
+
mod "puppetlabs/stdlib", '4.11.0'
|
8
|
+
|
9
|
+
# Modules from Git
|
10
|
+
# Examples: https://github.com/puppetlabs/r10k/blob/master/doc/puppetfile.mkd#examples
|
11
|
+
mod 'apache',
|
12
|
+
:git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
13
|
+
:commit => '83401079053dca11d61945bd9beef9ecf7576cbf'
|
14
|
+
|
15
|
+
#mod 'apache',
|
16
|
+
# :git => 'https://github.com/puppetlabs/puppetlabs-apache',
|
17
|
+
# :branch => 'docs_experiment'
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: onceover
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 3.12.
|
4
|
+
version: 3.12.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Dylan Ratcliffe
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2019-04-
|
11
|
+
date: 2019-04-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|
@@ -319,6 +319,7 @@ files:
|
|
319
319
|
- Gemfile
|
320
320
|
- README.md
|
321
321
|
- Rakefile
|
322
|
+
- appveyor.yml
|
322
323
|
- bin/onceover
|
323
324
|
- factsets/AIX-6.1-powerpc.json
|
324
325
|
- factsets/AIX-7.1-powerpc.json
|