vanagon 0.21.0 → 0.24.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (39) hide show
  1. checksums.yaml +4 -4
  2. data/README.md +25 -0
  3. data/lib/vanagon/cli/dependencies.rb +89 -0
  4. data/lib/vanagon/cli/list.rb +3 -3
  5. data/lib/vanagon/cli.rb +4 -0
  6. data/lib/vanagon/component/source/git.rb +9 -7
  7. data/lib/vanagon/component/source/http.rb +3 -0
  8. data/lib/vanagon/component/source.rb +1 -0
  9. data/lib/vanagon/component.rb +1 -1
  10. data/lib/vanagon/driver.rb +12 -1
  11. data/lib/vanagon/engine/pooler.rb +4 -1
  12. data/lib/vanagon/platform/defaults/debian-11-amd64.rb +11 -0
  13. data/lib/vanagon/platform/defaults/el-8-aarch64.rb +1 -1
  14. data/lib/vanagon/platform/defaults/el-8-x86_64.rb +1 -1
  15. data/lib/vanagon/platform/defaults/el-9-aarch64.rb +10 -0
  16. data/lib/vanagon/platform/defaults/el-9-x86_64.rb +10 -0
  17. data/lib/vanagon/platform/defaults/fedora-34-x86_64.rb +17 -0
  18. data/lib/vanagon/platform/defaults/{osx-10.14-x86_64.rb → osx-11-x86_64.rb} +4 -6
  19. data/lib/vanagon/platform/defaults/redhatfips-8-x86_64.rb +28 -0
  20. data/lib/vanagon/platform/defaults/ubuntu-18.04-aarch64.rb +11 -0
  21. data/lib/vanagon/platform/dsl.rb +5 -0
  22. data/lib/vanagon/platform/osx.rb +9 -0
  23. data/lib/vanagon/platform/windows.rb +3 -21
  24. data/lib/vanagon/platform.rb +10 -0
  25. data/lib/vanagon/project.rb +11 -0
  26. data/lib/vanagon/utilities/extra_files_signer.rb +42 -0
  27. data/lib/vanagon/utilities.rb +1 -0
  28. data/resources/rpm/project.spec.erb +1 -5
  29. data/spec/lib/vanagon/cli_spec.rb +3 -3
  30. data/spec/lib/vanagon/component/source/git_spec.rb +13 -0
  31. data/spec/lib/vanagon/component_spec.rb +10 -10
  32. data/spec/lib/vanagon/platform/dsl_spec.rb +4 -5
  33. data/spec/lib/vanagon/platform/rpm_spec.rb +1 -1
  34. data/spec/lib/vanagon/platform_spec.rb +9 -9
  35. data/spec/lib/vanagon/project/dsl_spec.rb +8 -8
  36. data/spec/lib/vanagon/utilities/extra_files_signer_spec.rb +123 -0
  37. metadata +41 -33
  38. data/lib/vanagon/platform/defaults/fedora-30-x86_64.rb +0 -11
  39. data/lib/vanagon/platform/defaults/fedora-31-x86_64.rb +0 -11
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 1e832c071ba2d54e8c938fbeace5fe1c0287bc25b2ff405b6b2d1ca5dbc9f44f
4
- data.tar.gz: 1af5c0c38870de680a4cc1f037a94fa6595d22d0e9b70147371650beb11d7130
3
+ metadata.gz: 958967d126de3ae4bf36c6e13f2aa0dcbe387e7cf52621ba5386ef87e470402d
4
+ data.tar.gz: 57b2cb0b77c9d0fd82d79a935d2c5fd8676c3e46968c036f21dc86128e97303f
5
5
  SHA512:
6
- metadata.gz: 53756b8e737fbe884d6e5ce934442778d07407b638d34186c1b19f658981b5e36a79d0c7c272b0efe82a7f86ded6479ab0a5e1fc7962b0112dfd85732168095c
7
- data.tar.gz: 21b9ebef8bb1d8a54650c4a35551abdf8142d9e28689d843f96278ad81d5081877ec9eb6d4d9432799feb464a2f682754d78d3af6cf4b8c20d17bc0ea3c94145
6
+ metadata.gz: c6a328120e33ef21de286bbb5f1d086632ac855507c3c3a3913d392a7a99a04f447c90128cfeaca4f37674c8f541e5c07c326a70c5dde79a069a8a8339c052f3
7
+ data.tar.gz: 98ffb256fbd7b09fc1c7eea5157036ef666cbb80e9bc686077a2722d64b9371a516b60252a5f70f2956451e83a2f68e3538f3369115e8fdf26cbf18402fb030d
data/README.md CHANGED
@@ -85,6 +85,24 @@ wheezy and build my project against it.
85
85
  For more detailed examples of the DSLs available, please see the
86
86
  [examples](examples) directory and the YARD documentation for Vanagon.
87
87
 
88
+ ### CLI commands
89
+
90
+ The vanagon command line tool contains these commands:
91
+
92
+ * `build` build a package given a project and platform
93
+ * `build_host_info` print information about build hosts
94
+ * `build_requirements` print external packages required to build project
95
+ * `completion` outputs path to tab completion script
96
+ * `inspect` a build dry-run, printing lots of information about the build
97
+ * `list` shows a list of available projects and platforms
98
+ * `render` create local versions of packaging artifacts for project
99
+ * `sign` sign a package
100
+ * `ship` upload a package to a distribution server
101
+ * `help` print this help
102
+
103
+ Commands are called with a git-like pattern of `vanagon <subcommand>`.
104
+ For example: `vanagon list`
105
+
88
106
  ### CLI changes and deprecations (from version 0.16.0)
89
107
 
90
108
  Prior to 0.16.0, the vanagon command line contained these commands
@@ -212,6 +230,13 @@ time. The default value is *7200* seconds(120 minutes) but setting to any
212
230
  integer value these components to fail after the `VANAGON_TIMEOUT` count is reached.
213
231
  Note that this value is expected to be in seconds.
214
232
 
233
+ ##### `VANAGON_FORCE_SIGNING`
234
+ By default, Vanagon does not fail if extra files signing fails, it just logs an
235
+ error and continues building the package. This is unwanted behavior in
236
+ environments where we expect a hard failure when signing cannot proceed. To
237
+ force Vanagon to fail if extra files signing fails, ensure this variable is set
238
+ before starting a build.
239
+
215
240
  #### Example usage
216
241
  `vanagon build --preserve puppet-agent el-6-i386` will build the puppet-agent project
217
242
  on the el-6-i386 platform and leave the host intact afterward.
@@ -0,0 +1,89 @@
1
+ require 'docopt'
2
+ require 'json'
3
+ require 'vanagon/logger'
4
+
5
+ class Vanagon
6
+ class CLI
7
+ class Dependencies < Vanagon::CLI
8
+ DOCUMENTATION = <<~DOCOPT.freeze
9
+ Usage:
10
+ dependencies [options] <project-name> <platforms>
11
+
12
+ Options:
13
+ -h, --help Display help
14
+ -c, --configdir DIRECTORY Configuration directory [default: #{Dir.pwd}/configs]
15
+ -w, --workdir DIRECTORY Working directory on the local host
16
+ -v, --verbose Only here for backwards compatibility. Does nothing.
17
+
18
+ Project-Name:
19
+ May be a project name of a project from the configs/projects directory or 'all' to generate dependencies for all projects.
20
+ Platforms:
21
+ May be a platform name of a platform from the configs/platforms directory or 'all' to generate dependencies for all platforms.
22
+ DOCOPT
23
+
24
+ def parse(argv)
25
+ Docopt.docopt(DOCUMENTATION, { argv: argv })
26
+ rescue Docopt::Exit => e
27
+ VanagonLogger.error e.message
28
+ exit 1
29
+ end
30
+
31
+ def run(options) # rubocop:disable Metrics/AbcSize
32
+ platforms_directory = File.join(options[:configdir], 'platforms')
33
+ projects_directory = File.join(options[:configdir], 'projects')
34
+
35
+ unless Dir.exist?(projects_directory) && Dir.exist?(platforms_directory)
36
+ VanagonLogger.error "Path to #{platforms_directory} or #{projects_directory} not found."
37
+ exit 1
38
+ end
39
+
40
+ projects = [options[:project_name]]
41
+ if projects.include?('all')
42
+ projects = Dir.children(projects_directory).map do |project|
43
+ File.basename(project, File.extname(project))
44
+ end
45
+ end
46
+
47
+ platforms = options[:platforms].split(',')
48
+ if platforms.include?('all')
49
+ platforms = Dir.children(platforms_directory).map do |platform|
50
+ File.basename(platform, File.extname(platform))
51
+ end
52
+ end
53
+
54
+ failures = []
55
+
56
+ projects.each do |project|
57
+ platforms.each do |platform|
58
+ begin
59
+ artifact = Vanagon::Driver.new(platform, project, options)
60
+ artifact.dependencies
61
+ rescue RuntimeError => e
62
+ failures.push("#{project}, #{platform}: #{e}")
63
+ end
64
+ end
65
+ end
66
+
67
+ unless failures.empty?
68
+ VanagonLogger.info "Failed to generate dependencies for the following:"
69
+ failures.each do |failure|
70
+ VanagonLogger.info failure
71
+ end
72
+ end
73
+
74
+ VanagonLogger.info "Finished generating dependencies"
75
+ end
76
+
77
+ def options_translate(docopt_options)
78
+ translations = {
79
+ '--verbose' => :verbose,
80
+ '--workdir' => :workdir,
81
+ '--configdir' => :configdir,
82
+ '<project-name>' => :project_name,
83
+ '<platforms>' => :platforms
84
+ }
85
+ return docopt_options.map { |k, v| [translations[k], v] }.to_h
86
+ end
87
+ end
88
+ end
89
+ end
@@ -39,15 +39,15 @@ class Vanagon
39
39
 
40
40
  default_list = Dir.children(File.join(File.dirname(__FILE__), '..', 'platform', 'defaults')).map do |platform|
41
41
  File.basename(platform, File.extname(platform))
42
- end
42
+ end.sort
43
43
 
44
44
  platform_list = Dir.children(File.join(options[:configdir], 'platforms')).map do |platform|
45
45
  File.basename(platform, File.extname(platform))
46
- end
46
+ end.sort
47
47
 
48
48
  project_list = Dir.children(File.join(options[:configdir], 'projects')).map do |project|
49
49
  File.basename(project, File.extname(project))
50
- end
50
+ end.sort
51
51
 
52
52
  if options[:defaults]
53
53
  puts "- Defaults", output(default_list, options[:use_spaces])
data/lib/vanagon/cli.rb CHANGED
@@ -14,6 +14,7 @@ require 'vanagon/cli/list'
14
14
  require 'vanagon/cli/render'
15
15
  require 'vanagon/cli/ship'
16
16
  require 'vanagon/cli/sign'
17
+ require 'vanagon/cli/dependencies'
17
18
 
18
19
  require 'vanagon/logger'
19
20
 
@@ -37,6 +38,7 @@ class Vanagon
37
38
  render create local versions of packaging artifacts for project
38
39
  sign sign a package
39
40
  ship upload a package to a distribution server
41
+ dependencies write json file to STDOUT that shows all required gems for a given project and platform
40
42
  help print this help
41
43
  DOCOPT
42
44
 
@@ -64,6 +66,8 @@ class Vanagon
64
66
  @sub_parser = Vanagon::CLI::Sign.new
65
67
  when 'ship'
66
68
  @sub_parser = Vanagon::CLI::Ship.new
69
+ when 'dependencies'
70
+ @sub_parser = Vanagon::CLI::Dependencies.new
67
71
  when 'help'
68
72
  puts DOCUMENTATION
69
73
  exit 0
@@ -13,7 +13,7 @@ class Vanagon
13
13
  class Component
14
14
  class Source
15
15
  class Git
16
- attr_accessor :url, :ref, :workdir, :clone_options
16
+ attr_accessor :url, :log_url, :ref, :workdir, :clone_options
17
17
  attr_reader :version, :default_options, :repo
18
18
 
19
19
  class << self
@@ -73,17 +73,19 @@ class Vanagon
73
73
  # @param url [String] url of git repo to use as source
74
74
  # @param ref [String] ref to checkout from git repo
75
75
  # @param workdir [String] working directory to clone into
76
- def initialize(url, workdir:, **options)
76
+ def initialize(url, workdir:, **options) # rubocop:disable Metrics/AbcSize
77
77
  opts = default_options.merge(options.reject { |k, v| v.nil? })
78
78
 
79
79
  # Ensure that #url returns a URI object
80
80
  @url = URI.parse(url.to_s)
81
+ @log_url = @url.host + @url.path unless @url.host.nil? || @url.path.nil?
81
82
  @ref = opts[:ref]
83
+ @dirname = opts[:dirname]
82
84
  @workdir = File.realpath(workdir)
83
85
  @clone_options = opts[:clone_options] ||= {}
84
86
 
85
87
  # We can test for Repo existence without cloning
86
- raise Vanagon::InvalidRepo, "#{url} not a valid Git repo" unless valid_remote?
88
+ raise Vanagon::InvalidRepo, "url is not a valid Git repo" unless valid_remote?
87
89
  end
88
90
 
89
91
  # Fetch the source. In this case, clone the repository into the workdir
@@ -113,7 +115,7 @@ class Vanagon
113
115
  #
114
116
  # @return [String] the directory where the repo was cloned
115
117
  def dirname
116
- File.basename(url.path, ".git")
118
+ @dirname || File.basename(url.path, ".git")
117
119
  end
118
120
 
119
121
  # Use `git describe` to lazy-load a version for this component
@@ -156,10 +158,10 @@ class Vanagon
156
158
  # Clone a remote repo, make noise about it, and fail entirely
157
159
  # if we're unable to retrieve the remote repo
158
160
  def clone!
159
- VanagonLogger.info "Cloning Git repo '#{url}'"
161
+ VanagonLogger.info "Cloning Git repo '#{log_url}'"
160
162
  VanagonLogger.info "Successfully cloned '#{dirname}'" if clone
161
163
  rescue ::Git::GitExecuteError
162
- raise Vanagon::InvalidRepo, "Unable to clone from '#{url}'"
164
+ raise Vanagon::InvalidRepo, "Unable to clone from '#{log_url}'"
163
165
  end
164
166
  private :clone!
165
167
 
@@ -169,7 +171,7 @@ class Vanagon
169
171
  VanagonLogger.info "Checking out '#{ref}' from Git repo '#{dirname}'"
170
172
  clone.checkout(ref)
171
173
  rescue ::Git::GitExecuteError
172
- raise Vanagon::CheckoutFailed, "unable to checkout #{ref} from '#{url}'"
174
+ raise Vanagon::CheckoutFailed, "unable to checkout #{ref} from '#{log_url}'"
173
175
  end
174
176
  private :checkout!
175
177
 
@@ -108,6 +108,9 @@ class Vanagon
108
108
  uri = URI.parse(target_url.to_s)
109
109
  target_file ||= File.basename(uri.path)
110
110
 
111
+ # Add X-RPROXY-PASS to request header if the environment variable exists
112
+ headers['X-RPROXY-PASS'] = ENV['X-RPROXY-PASS'] if ENV['X-RPROXY-PASS']
113
+
111
114
  VanagonLogger.info "Downloading file '#{target_file}' from url '#{target_url}'"
112
115
 
113
116
  Net::HTTP.start(uri.host, uri.port, use_ssl: uri.scheme == 'https') do |http|
@@ -37,6 +37,7 @@ class Vanagon
37
37
  sum: options[:sum],
38
38
  ref: options[:ref],
39
39
  workdir: options[:workdir],
40
+ dirname: options[:dirname],
40
41
  clone_options: options[:clone_options]
41
42
  end
42
43
 
@@ -304,7 +304,7 @@ class Vanagon
304
304
  #
305
305
  # @param workdir [String] working directory to put the source into
306
306
  def get_source(workdir) # rubocop:disable Metrics/AbcSize, Metrics/PerceivedComplexity
307
- opts = options.merge({ workdir: workdir })
307
+ opts = options.merge({ workdir: workdir, dirname: dirname })
308
308
  if url || !mirrors.empty?
309
309
  if ENV['VANAGON_USE_MIRRORS'] == 'n' or ENV['VANAGON_USE_MIRRORS'] == 'false'
310
310
  fetch_url(opts)
@@ -171,7 +171,7 @@ class Vanagon
171
171
 
172
172
  def render # rubocop:disable Metrics/AbcSize
173
173
  # Simple sanity check for the project
174
- if @project.version.nil? or @project.version.empty?
174
+ if @project.version.nil? || @project.version.empty?
175
175
  raise Vanagon::Error, "Project requires a version set, all is lost."
176
176
  end
177
177
 
@@ -182,6 +182,17 @@ class Vanagon
182
182
  @project.make_makefile(workdir)
183
183
  end
184
184
 
185
+ def dependencies
186
+ # Simple sanity check for the project
187
+ if @project.version.nil? || @project.version.empty?
188
+ raise Vanagon::Error, "Project requires a version set, all is lost."
189
+ end
190
+
191
+ VanagonLogger.info "creating dependencies list"
192
+ @project.fetch_sources(workdir, retry_count, timeout)
193
+ @project.cli_manifest_json(@platform)
194
+ end
195
+
185
196
  # Initialize the logging instance
186
197
  def loginit(logfile)
187
198
  @@logger = Logger.new(logfile)
@@ -15,7 +15,10 @@ class Vanagon
15
15
  def initialize(platform, target = nil, **opts)
16
16
  super
17
17
 
18
- @available_poolers = ["https://vmpooler.delivery.puppetlabs.net", "https://nspooler-service-prod-1.delivery.puppetlabs.net"]
18
+ @available_poolers = %w[
19
+ https://vmpooler-prod.k8s.infracore.puppet.net
20
+ https://nspooler-prod.k8s.infracore.puppet.net
21
+ ]
19
22
  @token = load_token
20
23
  @required_attributes << "vmpooler_template"
21
24
  end
@@ -0,0 +1,11 @@
1
+ platform "debian-11-amd64" do |plat|
2
+ plat.servicedir "/lib/systemd/system"
3
+ plat.defaultdir "/etc/default"
4
+ plat.servicetype "systemd"
5
+ plat.codename "bullseye"
6
+
7
+ packages = %w(build-essential devscripts make quilt pkg-config debhelper rsync fakeroot cmake)
8
+ plat.provision_with "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq; apt-get install -qy --no-install-recommends #{packages.join(' ')}"
9
+ plat.install_build_dependencies_with "DEBIAN_FRONTEND=noninteractive; apt-get install -qy --no-install-recommends "
10
+ plat.vmpooler_template "debian-11-x86_64"
11
+ end
@@ -3,7 +3,7 @@ platform "el-8-aarch64" do |plat|
3
3
  plat.defaultdir "/etc/sysconfig"
4
4
  plat.servicetype "systemd"
5
5
 
6
- packages = %w(autoconf automake createrepo gcc gcc-c++ rsync cmake make rpm-libs rpm-build)
6
+ packages = %w(autoconf automake createrepo gcc gcc-c++ rsync cmake make rpm-libs rpm-build libarchive)
7
7
  plat.provision_with "dnf install -y --allowerasing #{packages.join(' ')}"
8
8
  plat.install_build_dependencies_with "dnf install -y --allowerasing "
9
9
  plat.vmpooler_template "redhat-8-arm64"
@@ -3,7 +3,7 @@ platform "el-8-x86_64" do |plat|
3
3
  plat.defaultdir "/etc/sysconfig"
4
4
  plat.servicetype "systemd"
5
5
 
6
- packages = %w(gcc gcc-c++ autoconf automake createrepo rsync cmake make rpm-libs rpm-build rpm-sign libtool)
6
+ packages = %w(gcc gcc-c++ autoconf automake createrepo rsync cmake make rpm-libs rpm-build rpm-sign libtool libarchive)
7
7
  plat.provision_with "dnf install -y --allowerasing #{packages.join(' ')}"
8
8
  plat.install_build_dependencies_with "dnf install -y --allowerasing "
9
9
  plat.vmpooler_template "redhat-8-x86_64"
@@ -0,0 +1,10 @@
1
+ platform "el-9-aarch64" do |plat|
2
+ plat.servicedir "/usr/lib/systemd/system"
3
+ plat.defaultdir "/etc/sysconfig"
4
+ plat.servicetype "systemd"
5
+
6
+ packages = %w(autoconf automake createrepo gcc gcc-c++ rsync cmake make rpm-libs rpm-build libarchive)
7
+ plat.provision_with "dnf install -y --allowerasing #{packages.join(' ')}"
8
+ plat.install_build_dependencies_with "dnf install -y --allowerasing "
9
+ plat.vmpooler_template "redhat-9-arm64"
10
+ end
@@ -0,0 +1,10 @@
1
+ platform "el-9-x86_64" do |plat|
2
+ plat.servicedir "/usr/lib/systemd/system"
3
+ plat.defaultdir "/etc/sysconfig"
4
+ plat.servicetype "systemd"
5
+
6
+ packages = %w(gcc gcc-c++ autoconf automake createrepo rsync cmake make rpm-libs rpm-build rpm-sign libtool libarchive)
7
+ plat.provision_with "dnf install -y --allowerasing #{packages.join(' ')}"
8
+ plat.install_build_dependencies_with "dnf install -y --allowerasing "
9
+ plat.vmpooler_template "redhat-9-x86_64"
10
+ end
@@ -0,0 +1,17 @@
1
+ platform 'fedora-34-x86_64' do |plat|
2
+ plat.servicedir '/usr/lib/systemd/system'
3
+ plat.defaultdir '/etc/sysconfig'
4
+ plat.servicetype 'systemd'
5
+ plat.dist 'fc34'
6
+
7
+ packages = %w[
8
+ autoconf automake bzip2-devel gcc gcc-c++ libselinux-devel
9
+ libsepol libsepol-devel make cmake pkgconfig readline-devel
10
+ rpmdevtools rsync swig zlib-devel systemtap-sdt-devel
11
+ perl-lib perl-FindBin
12
+ ]
13
+ plat.provision_with("/usr/bin/dnf install -y --best --allowerasing #{packages.join(' ')}")
14
+
15
+ plat.install_build_dependencies_with '/usr/bin/dnf install -y --best --allowerasing'
16
+ plat.vmpooler_template 'fedora-34-x86_64'
17
+ end
@@ -1,8 +1,7 @@
1
- platform "osx-10.14-x86_64" do |plat|
1
+ platform "osx-11-x86_64" do |plat|
2
2
  plat.servicetype "launchd"
3
3
  plat.servicedir "/Library/LaunchDaemons"
4
- plat.codename "mojave"
5
-
4
+ plat.codename "bigsur"
6
5
  plat.provision_with "export HOMEBREW_NO_EMOJI=true"
7
6
  plat.provision_with "export HOMEBREW_VERBOSE=true"
8
7
  plat.provision_with "sudo dscl . -create /Users/test"
@@ -15,8 +14,7 @@ platform "osx-10.14-x86_64" do |plat|
15
14
  plat.provision_with "echo 'test ALL=(ALL:ALL) NOPASSWD: ALL' > /etc/sudoers.d/username"
16
15
  plat.provision_with "mkdir -p /etc/homebrew"
17
16
  plat.provision_with "cd /etc/homebrew"
18
- plat.provision_with %Q(su test -c 'echo | /usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"')
17
+ plat.provision_with %Q(su test -c 'echo | /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"')
19
18
  plat.provision_with "sudo chown -R test:admin /Users/test/"
20
- plat.vmpooler_template "osx-1014-x86_64"
21
- plat.output_dir File.join("apple", "10.14", "puppet6", "x86_64")
19
+ plat.vmpooler_template "macos-112-x86_64"
22
20
  end
@@ -0,0 +1,28 @@
1
+ platform "redhatfips-8-x86_64" do |plat|
2
+ plat.servicedir "/usr/lib/systemd/system"
3
+ plat.defaultdir "/etc/sysconfig"
4
+ plat.servicetype "systemd"
5
+
6
+ packages = %w(
7
+ cmake
8
+ gcc-c++
9
+ java-1.8.0-openjdk-devel
10
+ libarchive
11
+ libsepol-devel
12
+ libselinux-devel
13
+ openssl-devel
14
+ pkgconfig
15
+ readline-devel
16
+ rpm-build
17
+ rpmdevtools
18
+ rsync
19
+ swig
20
+ systemtap-sdt-devel
21
+ yum-utils
22
+ zlib-devel
23
+ )
24
+
25
+ plat.provision_with "dnf install -y --allowerasing #{packages.join(' ')}"
26
+ plat.install_build_dependencies_with "dnf install -y --allowerasing "
27
+ plat.vmpooler_template "redhat-fips-8-x86_64"
28
+ end
@@ -0,0 +1,11 @@
1
+ platform "ubuntu-18.04-aarch64" do |plat|
2
+ plat.servicedir "/lib/systemd/system"
3
+ plat.defaultdir "/etc/default"
4
+ plat.servicetype "systemd"
5
+ plat.codename "bionic"
6
+
7
+ packages = %w(build-essential devscripts make quilt pkg-config debhelper rsync fakeroot cmake)
8
+ plat.provision_with "export DEBIAN_FRONTEND=noninteractive; apt-get update -qq; apt-get install -qy --no-install-recommends #{packages.join(' ')}"
9
+ plat.install_build_dependencies_with "DEBIAN_FRONTEND=noninteractive; apt-get install -qy --no-install-recommends "
10
+ plat.vmpooler_template "ubuntu-1804-arm64"
11
+ end
@@ -214,6 +214,11 @@ class Vanagon
214
214
  @platform.provision_with(command)
215
215
  end
216
216
 
217
+ # Clears the provisioning commands array
218
+ def clear_provisioning
219
+ @platform.provisioning.clear
220
+ end
221
+
217
222
  # Set the command to install any needed build dependencies for the target machine
218
223
  #
219
224
  # @param command [String] Command to install build dependencies for the target machine
@@ -35,6 +35,11 @@ class Vanagon
35
35
  bom_install = []
36
36
  end
37
37
 
38
+ if project.extra_files_to_sign.any?
39
+ sign_commands = Vanagon::Utilities::ExtraFilesSigner.commands(project, @mktemp, "/osx/build/root/#{project.name}-#{project.version}")
40
+ else
41
+ sign_commands = []
42
+ end
38
43
 
39
44
  # Setup build directories
40
45
  ["bash -c 'mkdir -p $(tempdir)/osx/build/{dmg,pkg,scripts,resources,root,payload,plugins}'",
@@ -51,11 +56,15 @@ class Vanagon
51
56
 
52
57
  bom_install,
53
58
 
59
+ # Sign extra files
60
+ sign_commands,
61
+
54
62
  # Package the project
55
63
  "(cd $(tempdir)/osx/build/; #{@pkgbuild} --root root/#{project.name}-#{project.version} \
56
64
  --scripts $(tempdir)/osx/build/scripts \
57
65
  --identifier #{project.identifier}.#{project.name} \
58
66
  --version #{project.version} \
67
+ --preserve-xattr \
59
68
  --install-location / \
60
69
  payload/#{project.name}-#{project.version}-#{project.release}.pkg)",
61
70
  # Create a custom installer using the pkg above
@@ -214,28 +214,10 @@ class Vanagon
214
214
  "gunzip -c #{project.name}-#{project.version}.tar.gz | '#{@tar}' -C '$(tempdir)/SourceDir' --strip-components 1 -xf -"
215
215
  ]
216
216
 
217
- unless project.extra_files_to_sign.empty?
218
- begin
219
- tempdir = nil
220
- # Skip signing extra files if logging into the signing_host fails
221
- # This enables things like CI being able to sign the additional files,
222
- # but locally triggered builds by developers who don't have access to
223
- # the signing host just print a message and skip the signing.
224
- Vanagon::Utilities.retry_with_timeout(3, 5) do
225
- tempdir = Vanagon::Utilities::remote_ssh_command("#{project.signing_username}@#{project.signing_hostname}", "#{@mktemp} 2>/dev/null", return_command_output: true)
226
- end
227
- project.extra_files_to_sign.each do |file|
228
- file_location = File.join(tempdir, File.basename(file))
229
- make_commands << [
230
- "rsync -e '#{Vanagon::Utilities.ssh_command}' -rHlv --no-perms --no-owner --no-group #{File.join('$(tempdir)', 'SourceDir', file)} #{project.signing_username}@#{project.signing_hostname}:#{tempdir}",
231
- "#{Vanagon::Utilities.ssh_command} #{project.signing_username}@#{project.signing_hostname} #{project.signing_command} #{file_location}",
232
- "rsync -e '#{Vanagon::Utilities.ssh_command}' -rHlv -O --no-perms --no-owner --no-group #{project.signing_username}@#{project.signing_hostname}:#{file_location} #{File.join('$(tempdir)', 'SourceDir', file)}"
233
- ]
234
- end
235
- rescue RuntimeError
236
- VanagonLogger.error "Unable to connect to #{project.signing_username}@#{project.signing_hostname}, skipping signing extra files: #{project.extra_files_to_sign.join(',')}"
237
- end
217
+ if project.extra_files_to_sign.any?
218
+ make_commands << Vanagon::Utilities::ExtraFilesSigner.commands(project, @mktemp, 'SourceDir')
238
219
  end
220
+
239
221
  make_commands << [
240
222
  "mkdir -p $(tempdir)/#{misc_dir}",
241
223
  # Need to use awk here to convert to DOS format so that notepad can display file correctly.
@@ -339,10 +339,20 @@ class Vanagon
339
339
  return !!@name.match(/^(el|redhat|redhatfips)-.*$/)
340
340
  end
341
341
 
342
+ # Utility matcher to determine if the platform is of an EL 8 variety
343
+ #
344
+ # @return [true, false] true if it is an EL 8 variety, false otherwise
342
345
  def is_el8?
343
346
  return !!@name.match(/^(el|redhat|redhatfips)-8.*$/)
344
347
  end
345
348
 
349
+ # Utility matcher to determine if the platform is a FIPS platform
350
+ #
351
+ # @return [true, false] true if it is a FIPS platform, false otherwise
352
+ def is_fips?
353
+ return @name.include?('fips')
354
+ end
355
+
346
356
  # Utility matcher to determine is the platform is a sles variety
347
357
  #
348
358
  # @return [true, false] true if it is a sles variety, false otherwise
@@ -762,6 +762,17 @@ class Vanagon
762
762
  end
763
763
  end
764
764
 
765
+ # Writes a json file to STDOUT containing information
766
+ # about what will go into an artifact
767
+ #
768
+ # @param platform [String] platform we're writing metadata for
769
+ def cli_manifest_json(platform)
770
+ manifest = build_manifest_json
771
+ metadata = metadata_merge(manifest, @upstream_metadata)
772
+
773
+ puts JSON.pretty_generate(metadata)
774
+ end
775
+
765
776
  # Writes a yaml file at `output/<name>-<version>.<platform>.settings.yaml`
766
777
  # containing settings used to build the current project on the platform
767
778
  # provided (and a corresponding sha1sum file) if `yaml_settings` has been
@@ -0,0 +1,42 @@
1
+ class Vanagon
2
+ module Utilities
3
+ module ExtraFilesSigner
4
+ class << self
5
+ def commands(project, mktemp, source_dir) # rubocop:disable Metrics/AbcSize
6
+ tempdir = nil
7
+ commands = []
8
+ # Skip signing extra files if logging into the signing_host fails
9
+ # This enables things like CI being able to sign the additional files,
10
+ # but locally triggered builds by developers who don't have access to
11
+ # the signing host just print a message and skip the signing.
12
+ Vanagon::Utilities.retry_with_timeout(3, 5) do
13
+ tempdir = Vanagon::Utilities::remote_ssh_command("#{project.signing_username}@#{project.signing_hostname}", "#{mktemp} 2>/dev/null", return_command_output: true)
14
+ end
15
+
16
+ project.extra_files_to_sign.each do |file|
17
+ file_location = File.join(tempdir, File.basename(file))
18
+ local_source_path = File.join('$(tempdir)', source_dir, file)
19
+ remote_host = "#{project.signing_username}@#{project.signing_hostname}"
20
+ remote_destination_path = "#{remote_host}:#{tempdir}"
21
+ remote_file_location = "#{remote_host}:#{file_location}"
22
+ extra_flags = ''
23
+ extra_flags = '--extended-attributes' if project.platform.is_macos?
24
+
25
+ commands += [
26
+ "rsync -e '#{Vanagon::Utilities.ssh_command}' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group #{extra_flags} #{local_source_path} #{remote_destination_path}",
27
+ "#{Vanagon::Utilities.ssh_command} #{remote_host} #{project.signing_command} #{file_location}",
28
+ "rsync -e '#{Vanagon::Utilities.ssh_command}' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group #{extra_flags} #{remote_file_location} #{local_source_path}"
29
+ ]
30
+ end
31
+
32
+ commands
33
+ rescue RuntimeError
34
+ require 'vanagon/logger'
35
+ VanagonLogger.error "Unable to connect to #{project.signing_username}@#{project.signing_hostname}, skipping signing extra files: #{project.extra_files_to_sign.join(',')}"
36
+ raise if ENV['VANAGON_FORCE_SIGNING']
37
+ []
38
+ end
39
+ end
40
+ end
41
+ end
42
+ end
@@ -10,6 +10,7 @@ require 'timeout'
10
10
  require 'English'
11
11
  require 'vanagon/extensions/string'
12
12
  require 'vanagon/logger'
13
+ require 'vanagon/utilities/extra_files_signer'
13
14
 
14
15
  class Vanagon
15
16
  module Utilities
@@ -33,15 +33,11 @@
33
33
  <%= var %>
34
34
  <% end -%>
35
35
 
36
- # This breaks on el8. This is a hack to unblock development.
37
36
  <%- if @platform.is_el8? %>
38
- %undefine __debug_package
39
-
40
37
  # Build el-8 packages without build-id files to prevent collision
41
38
  %define _build_id_links none
42
39
  <% end -%>
43
40
 
44
-
45
41
  # To avoid files installed but not packaged errors
46
42
  %global __os_install_post %{__os_install_post} \
47
43
  rm -rf %{buildroot}/usr/lib/debug
@@ -85,7 +81,7 @@ Requires: <%= requires.requirement %><%= requires.version ? " #{requires.versio
85
81
  # did not specify a dependency on these.
86
82
  # In the future, we will supress pre/post scripts completely if there's nothing
87
83
  # specified by the project or the components.
88
- <%- if @platform.is_fedora? && @platform.os_version.to_i >= 29 -%>
84
+ <%- if @platform.is_fedora? || (@platform.is_el? && @platform.os_version.to_i >= 9) -%>
89
85
  Requires(pre): /usr/bin/mkdir
90
86
  Requires(pre): /usr/bin/touch
91
87
  Requires(post): /usr/bin/mkdir
@@ -98,9 +98,9 @@ describe Vanagon::CLI::List do
98
98
  let(:platforms){ ['1', '2', '3'] }
99
99
  let(:output_both){
100
100
  "- Projects
101
- foo
102
101
  bar
103
102
  baz
103
+ foo
104
104
 
105
105
  - Platforms
106
106
  1
@@ -167,7 +167,7 @@ baz
167
167
 
168
168
  let(:output_both_space){
169
169
  "- Projects
170
- foo bar baz
170
+ bar baz foo
171
171
 
172
172
  - Platforms
173
173
  1 2 3
@@ -194,9 +194,9 @@ foo bar baz
194
194
 
195
195
  let(:output_projects){
196
196
  "- Projects
197
- foo
198
197
  bar
199
198
  baz
199
+ foo
200
200
  "
201
201
  }
202
202
  it "outputs only projects when projects is passed" do
@@ -60,6 +60,7 @@ describe "Vanagon::Component::Source::Git" do
60
60
  allow(::Git).to receive(:clone).and_return(clone)
61
61
  expect(File).to receive(:realpath).and_return(@file_path)
62
62
  end
63
+
63
64
  it "repository" do
64
65
  git_source = @klass.new(@url, ref: @ref_tag, workdir: "/tmp/foo")
65
66
  expect(::Git).to receive(:clone).with(git_source.url, git_source.dirname, path: @file_path)
@@ -72,6 +73,12 @@ describe "Vanagon::Component::Source::Git" do
72
73
  expect(::Git).to receive(:clone).with(git_source.url, git_source.dirname, path: @file_path, **expected_clone_options)
73
74
  git_source.clone
74
75
  end
76
+
77
+ it 'uses a custom dirname' do
78
+ git_source = @klass.new(@url, ref: @ref_tag, workdir: "/tmp/foo", dirname: 'facter-ng')
79
+ expect(::Git).to receive(:clone).with(git_source.url, 'facter-ng', path: @file_path)
80
+ git_source.clone
81
+ end
75
82
  end
76
83
 
77
84
  describe "#dirname" do
@@ -86,6 +93,12 @@ describe "Vanagon::Component::Source::Git" do
86
93
  expect(git_source.dirname)
87
94
  .to eq('facter')
88
95
  end
96
+
97
+ it "returns @dirname if is set" do
98
+ git_source = @klass.new(@url, ref: @ref_tag, workdir: @workdir, dirname: 'facter-ng')
99
+ expect(git_source.dirname)
100
+ .to eq('facter-ng')
101
+ end
89
102
  end
90
103
 
91
104
  describe "#ref" do
@@ -151,8 +151,8 @@ describe "Vanagon::Component" do
151
151
  # Initialize a new instance of Vanagon::Component and define a
152
152
  # new secondary source that's *compressed*. We can now reason about
153
153
  # this instance and test behavior for retrieving secondary sources.
154
- plat = Vanagon::Platform::DSL.new('el-5-x86_64')
155
- plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
154
+ plat = Vanagon::Platform::DSL.new('el-6-x86_64')
155
+ plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
156
156
  @platform = plat._platform
157
157
 
158
158
  comp = Vanagon::Component::DSL.new('build-dir-test', {}, @platform)
@@ -173,8 +173,8 @@ describe "Vanagon::Component" do
173
173
  # Initialize a new instance of Vanagon::Component and define a
174
174
  # new secondary source that's *compressed*. We can now reason about
175
175
  # this instance and test behavior for retrieving secondary sources.
176
- plat = Vanagon::Platform::DSL.new('el-5-x86_64')
177
- plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
176
+ plat = Vanagon::Platform::DSL.new('el-6-x86_64')
177
+ plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
178
178
  @platform = plat._platform
179
179
 
180
180
  comp = Vanagon::Component::DSL.new('build-dir-test', {}, @platform)
@@ -190,8 +190,8 @@ describe "Vanagon::Component" do
190
190
  # Initialize a new instance of Vanagon::Component and define a
191
191
  # new secondary source that's *compressed*. We can now reason about
192
192
  # this instance and test behavior for retrieving secondary sources.
193
- plat = Vanagon::Platform::DSL.new('el-5-x86_64')
194
- plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
193
+ plat = Vanagon::Platform::DSL.new('el-6-x86_64')
194
+ plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
195
195
  @platform = plat._platform
196
196
 
197
197
  comp = Vanagon::Component::DSL.new('build-dir-test', {}, @platform)
@@ -206,8 +206,8 @@ describe "Vanagon::Component" do
206
206
  # Initialize a new instance of Vanagon::Component and define a
207
207
  # new secondary source that's *compressed*. We can now reason about
208
208
  # this instance and test behavior for retrieving secondary sources.
209
- plat = Vanagon::Platform::DSL.new('el-5-x86_64')
210
- plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
209
+ plat = Vanagon::Platform::DSL.new('el-6-x86_64')
210
+ plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
211
211
  @platform = plat._platform
212
212
 
213
213
  comp = Vanagon::Component::DSL.new('build-dir-test', {}, @platform)
@@ -225,8 +225,8 @@ describe "Vanagon::Component" do
225
225
  end
226
226
 
227
227
  let(:platform) do
228
- plat = Vanagon::Platform::DSL.new('el-5-x86_64')
229
- plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
228
+ plat = Vanagon::Platform::DSL.new('el-6-x86_64')
229
+ plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
230
230
  plat._platform
231
231
  end
232
232
 
@@ -2,7 +2,6 @@ require 'vanagon/platform/dsl'
2
2
 
3
3
  describe 'Vanagon::Platform::DSL' do
4
4
  let (:deb_platform_block) { "platform 'debian-test-fixture' do |plat| end" }
5
- let (:el_5_platform_block) { "platform 'el-5-fixture' do |plat| end" }
6
5
  let (:el_6_platform_block) { "platform 'el-6-fixture' do |plat| end" }
7
6
  let (:redhat_7_platform_block) { "platform 'redhat-7-fixture' do |plat| end" }
8
7
  let (:sles_platform_block) { "platform 'sles-test-fixture' do |plat| end" }
@@ -62,9 +61,9 @@ describe 'Vanagon::Platform::DSL' do
62
61
 
63
62
  describe '#yum_repo' do
64
63
  it "grabs the file and adds .repo to it" do
65
- plat = Vanagon::Platform::DSL.new('el-5-fixture')
64
+ plat = Vanagon::Platform::DSL.new('el-6-fixture')
66
65
  expect(SecureRandom).to receive(:hex).and_return(hex_value)
67
- plat.instance_eval(el_5_platform_block)
66
+ plat.instance_eval(el_6_platform_block)
68
67
  plat.yum_repo(el_definition)
69
68
  expect(plat._platform.provisioning[0]).to include('rpm -q curl', 'yum -y install curl')
70
69
  expect(plat._platform.provisioning[1]).to include(
@@ -97,8 +96,8 @@ describe 'Vanagon::Platform::DSL' do
97
96
 
98
97
  describe "installs a rpm when given a rpm" do
99
98
  it 'uses rpm everywhere' do
100
- plat = Vanagon::Platform::DSL.new('el-5-fixture')
101
- plat.instance_eval(el_5_platform_block)
99
+ plat = Vanagon::Platform::DSL.new('el-6-fixture')
100
+ plat.instance_eval(el_6_platform_block)
102
101
  plat.yum_repo(el_definition_rpm)
103
102
  expect(plat._platform.provisioning[0]).to include('rpm -q curl', 'yum -y install curl')
104
103
  expect(plat._platform.provisioning[1]).to include(
@@ -2,7 +2,7 @@ require 'vanagon/platform'
2
2
 
3
3
  describe 'Vanagon::Platform::RPM' do
4
4
  platforms = [
5
- { name: 'el-5-i386' },
5
+ { name: 'el-6-i386' },
6
6
  { name: 'fedora-21-x86_64', dist: 'f21' },
7
7
  { name: 'cisco-wrlinux-7-x86_64' }
8
8
  ]
@@ -49,19 +49,19 @@ describe "Vanagon::Platform" do
49
49
  end ],
50
50
  },
51
51
  {
52
- :name => "el-5-i386",
52
+ :name => "el-6-i386",
53
53
  :os_name => "el",
54
- :os_version => "5",
54
+ :os_version => "6",
55
55
  :architecture => "i386",
56
- :output_dir => "el/5/products/i386",
57
- :output_dir_with_target => "el/5/thing/i386",
58
- :output_dir_empty_string => "el/5/i386",
59
- :source_output_dir => "el/5/products/SRPMS",
60
- :source_output_dir_with_target => "el/5/thing/SRPMS",
61
- :source_output_dir_empty_string => "el/5/SRPMS",
56
+ :output_dir => "el/6/products/i386",
57
+ :output_dir_with_target => "el/6/thing/i386",
58
+ :output_dir_empty_string => "el/6/i386",
59
+ :source_output_dir => "el/6/products/SRPMS",
60
+ :source_output_dir_with_target => "el/6/thing/SRPMS",
61
+ :source_output_dir_empty_string => "el/6/SRPMS",
62
62
  :is_rpm => true,
63
63
  :is_el => true,
64
- :block => %Q[ platform "el-5-i386" do |plat| end ],
64
+ :block => %Q[ platform "el-6-i386" do |plat| end ],
65
65
  },
66
66
  {
67
67
  :name => "redhat-7-x86_64",
@@ -244,8 +244,8 @@ end" }
244
244
  describe "#provides" do
245
245
  before do
246
246
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
247
- @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
248
- @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
247
+ @el_plat = Vanagon::Platform::DSL.new('el-6-x86_64')
248
+ @el_plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
249
249
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
250
250
  @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
251
251
  end
@@ -326,8 +326,8 @@ end" }
326
326
  describe "#replaces" do
327
327
  before do
328
328
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
329
- @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
330
- @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
329
+ @el_plat = Vanagon::Platform::DSL.new('el-6-x86_64')
330
+ @el_plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
331
331
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
332
332
  @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
333
333
  end
@@ -404,8 +404,8 @@ end" }
404
404
  describe "#conflicts" do
405
405
  before do
406
406
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
407
- @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
408
- @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
407
+ @el_plat = Vanagon::Platform::DSL.new('el-6-x86_64')
408
+ @el_plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
409
409
  @deb_plat = Vanagon::Platform::DSL.new('ubuntu-16.04-amd64')
410
410
  @deb_plat.instance_eval("platform 'ubuntu-16.04-amd64' do |plat| end")
411
411
  end
@@ -488,8 +488,8 @@ end"
488
488
 
489
489
  before do
490
490
  allow_any_instance_of(Vanagon::Project::DSL).to receive(:puts)
491
- @el_plat = Vanagon::Platform::DSL.new('el-5-x86_64')
492
- @el_plat.instance_eval("platform 'el-5-x86_64' do |plat| end")
491
+ @el_plat = Vanagon::Platform::DSL.new('el-6-x86_64')
492
+ @el_plat.instance_eval("platform 'el-6-x86_64' do |plat| end")
493
493
  @osx_plat = Vanagon::Platform::DSL.new('osx-10.10-x86_64')
494
494
  @osx_plat.instance_eval("platform 'osx-10.10-x86_64' do |plat| end")
495
495
 
@@ -0,0 +1,123 @@
1
+ require 'vanagon/platform'
2
+ require 'vanagon/project'
3
+ require 'vanagon/utilities/extra_files_signer'
4
+
5
+ describe Vanagon::Utilities::ExtraFilesSigner do
6
+ let(:platform_block) do
7
+ %( platform "osx-11-x86_64" do |plat|
8
+ end
9
+ )
10
+ end
11
+ let (:project_block) do
12
+ <<-HERE.undent
13
+ project 'test-fixture' do |proj|
14
+ proj.version '0.0.0'
15
+ end
16
+ HERE
17
+ end
18
+ let(:configdir) { '/a/b/c' }
19
+ let(:platform) { Vanagon::Platform::DSL.new('osx-11-x86_64') }
20
+ let(:project) do
21
+ Vanagon::Project::DSL.new('test-fixture', configdir, platform._platform, [])
22
+ end
23
+ let(:mktemp) { '/tmp/xyz' }
24
+ let(:source_dir) { '/dir/source_dir' }
25
+
26
+ before do
27
+ allow(VanagonLogger).to receive(:error)
28
+ platform.instance_eval(platform_block)
29
+ project.instance_eval(project_block)
30
+ allow(Vanagon::Utilities).to receive(:remote_ssh_command).and_return(mktemp)
31
+ end
32
+
33
+ describe '.commands' do
34
+ context 'without extra files to sign' do
35
+ it 'returns empty array' do
36
+ commands = Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
37
+ expect(commands).to eql([])
38
+ end
39
+ end
40
+
41
+ context 'with extra files to sign' do
42
+ let (:project_block) do
43
+ <<-HERE.undent
44
+ project 'test-fixture' do |proj|
45
+ proj.version '0.0.0'
46
+ proj.extra_file_to_sign '/test1/a.rb'
47
+ proj.extra_file_to_sign '/test2/b.rb'
48
+ proj.signing_hostname('abc')
49
+ proj.signing_username('test')
50
+ proj.signing_command('codesign')
51
+ end
52
+ HERE
53
+ end
54
+
55
+ context 'when it cannot connect to signing hostname' do
56
+ before do
57
+ allow(Vanagon::Utilities).to receive(:remote_ssh_command)
58
+ .with('test@abc', '/tmp/xyz 2>/dev/null', return_command_output: true)
59
+ .and_raise RuntimeError
60
+ end
61
+
62
+ it 'returns empty array' do
63
+ commands = Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
64
+ expect(commands).to eql([])
65
+ end
66
+
67
+ it 'logs error' do
68
+ Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
69
+ expect(VanagonLogger).to have_received(:error).with(/Unable to connect to test@abc/)
70
+ end
71
+
72
+ it 'fails the build if VANAGON_FORCE_SIGNING is set' do
73
+ allow(ENV).to receive(:[]).with('VANAGON_FORCE_SIGNING').and_return('true')
74
+ expect {
75
+ Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
76
+ }.to raise_error(RuntimeError)
77
+ end
78
+ end
79
+
80
+ context 'when success' do
81
+ context 'when macos' do
82
+ it 'generates signing commands for each file using --extended-attributes' do
83
+ commands = Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
84
+ expect(commands).to match(
85
+ [
86
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group --extended-attributes $(tempdir)/dir/source_dir/test1/a.rb test@abc:/tmp/xyz",
87
+ "/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no test@abc codesign /tmp/xyz/a.rb",
88
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group --extended-attributes test@abc:/tmp/xyz/a.rb $(tempdir)/dir/source_dir/test1/a.rb",
89
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group --extended-attributes $(tempdir)/dir/source_dir/test2/b.rb test@abc:/tmp/xyz",
90
+ "/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no test@abc codesign /tmp/xyz/b.rb",
91
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group --extended-attributes test@abc:/tmp/xyz/b.rb $(tempdir)/dir/source_dir/test2/b.rb"
92
+ ]
93
+ )
94
+ end
95
+ end
96
+
97
+ context 'when other platform' do
98
+ let(:platform_block) do
99
+ %( platform "windows-2012r2-x86_64" do |plat|
100
+ end
101
+ )
102
+ end
103
+
104
+ let(:platform) { Vanagon::Platform::DSL.new('windows-2012r2-x86_64') }
105
+
106
+ it 'generates signing commands for each file' do
107
+ commands = Vanagon::Utilities::ExtraFilesSigner.commands(project._project, mktemp, source_dir)
108
+ expect(commands).to match(
109
+ [
110
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group $(tempdir)/dir/source_dir/test1/a.rb test@abc:/tmp/xyz",
111
+ "/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no test@abc codesign /tmp/xyz/a.rb",
112
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group test@abc:/tmp/xyz/a.rb $(tempdir)/dir/source_dir/test1/a.rb",
113
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group $(tempdir)/dir/source_dir/test2/b.rb test@abc:/tmp/xyz",
114
+ "/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no test@abc codesign /tmp/xyz/b.rb",
115
+ "rsync -e '/usr/bin/ssh -p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no' --verbose --recursive --hard-links --links --no-perms --no-owner --no-group test@abc:/tmp/xyz/b.rb $(tempdir)/dir/source_dir/test2/b.rb"
116
+ ]
117
+ )
118
+ end
119
+ end
120
+ end
121
+ end
122
+ end
123
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: vanagon
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.21.0
4
+ version: 0.24.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Puppet Labs
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-04-15 00:00:00.000000000 Z
11
+ date: 2022-01-14 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: docopt
@@ -118,6 +118,7 @@ files:
118
118
  - lib/vanagon/cli/build_host_info.rb
119
119
  - lib/vanagon/cli/build_requirements.rb
120
120
  - lib/vanagon/cli/completion.rb
121
+ - lib/vanagon/cli/dependencies.rb
121
122
  - lib/vanagon/cli/inspect.rb
122
123
  - lib/vanagon/cli/list.rb
123
124
  - lib/vanagon/cli/render.rb
@@ -153,6 +154,7 @@ files:
153
154
  - lib/vanagon/platform.rb
154
155
  - lib/vanagon/platform/deb.rb
155
156
  - lib/vanagon/platform/defaults/debian-10-amd64.rb
157
+ - lib/vanagon/platform/defaults/debian-11-amd64.rb
156
158
  - lib/vanagon/platform/defaults/debian-8-amd64.rb
157
159
  - lib/vanagon/platform/defaults/debian-8-i386.rb
158
160
  - lib/vanagon/platform/defaults/debian-9-amd64.rb
@@ -163,18 +165,21 @@ files:
163
165
  - lib/vanagon/platform/defaults/el-7-x86_64.rb
164
166
  - lib/vanagon/platform/defaults/el-8-aarch64.rb
165
167
  - lib/vanagon/platform/defaults/el-8-x86_64.rb
166
- - lib/vanagon/platform/defaults/fedora-30-x86_64.rb
167
- - lib/vanagon/platform/defaults/fedora-31-x86_64.rb
168
+ - lib/vanagon/platform/defaults/el-9-aarch64.rb
169
+ - lib/vanagon/platform/defaults/el-9-x86_64.rb
168
170
  - lib/vanagon/platform/defaults/fedora-32-x86_64.rb
169
- - lib/vanagon/platform/defaults/osx-10.14-x86_64.rb
171
+ - lib/vanagon/platform/defaults/fedora-34-x86_64.rb
170
172
  - lib/vanagon/platform/defaults/osx-10.15-x86_64.rb
173
+ - lib/vanagon/platform/defaults/osx-11-x86_64.rb
171
174
  - lib/vanagon/platform/defaults/redhatfips-7-x86_64.rb
175
+ - lib/vanagon/platform/defaults/redhatfips-8-x86_64.rb
172
176
  - lib/vanagon/platform/defaults/sles-12-x86_64.rb
173
177
  - lib/vanagon/platform/defaults/sles-15-x86_64.rb
174
178
  - lib/vanagon/platform/defaults/solaris-11-i386.rb
175
179
  - lib/vanagon/platform/defaults/solaris-11-sparc.rb
176
180
  - lib/vanagon/platform/defaults/ubuntu-16.04-amd64.rb
177
181
  - lib/vanagon/platform/defaults/ubuntu-16.04-i386.rb
182
+ - lib/vanagon/platform/defaults/ubuntu-18.04-aarch64.rb
178
183
  - lib/vanagon/platform/defaults/ubuntu-18.04-amd64.rb
179
184
  - lib/vanagon/platform/defaults/ubuntu-20.04-aarch64.rb
180
185
  - lib/vanagon/platform/defaults/ubuntu-20.04-amd64.rb
@@ -191,6 +196,7 @@ files:
191
196
  - lib/vanagon/project.rb
192
197
  - lib/vanagon/project/dsl.rb
193
198
  - lib/vanagon/utilities.rb
199
+ - lib/vanagon/utilities/extra_files_signer.rb
194
200
  - lib/vanagon/utilities/shell_utilities.rb
195
201
  - resources/Makefile.erb
196
202
  - resources/deb/changelog.erb
@@ -292,6 +298,7 @@ files:
292
298
  - spec/lib/vanagon/platform_spec.rb
293
299
  - spec/lib/vanagon/project/dsl_spec.rb
294
300
  - spec/lib/vanagon/project_spec.rb
301
+ - spec/lib/vanagon/utilities/extra_files_signer_spec.rb
295
302
  - spec/lib/vanagon/utilities/shell_utilities_spec.rb
296
303
  - spec/lib/vanagon/utilities_spec.rb
297
304
  - spec/spec_helper.rb
@@ -319,41 +326,42 @@ signing_key:
319
326
  specification_version: 3
320
327
  summary: All of your packages will fit into this van with this one simple trick.
321
328
  test_files:
322
- - spec/lib/git/rev_list_spec.rb
323
- - spec/lib/makefile_spec.rb
324
- - spec/lib/vanagon/common/user_spec.rb
325
- - spec/lib/vanagon/common/pathname_spec.rb
326
- - spec/lib/vanagon/extensions/set/json_spec.rb
329
+ - spec/lib/vanagon/project_spec.rb
330
+ - spec/lib/vanagon/utilities/extra_files_signer_spec.rb
331
+ - spec/lib/vanagon/utilities/shell_utilities_spec.rb
327
332
  - spec/lib/vanagon/extensions/string_spec.rb
333
+ - spec/lib/vanagon/extensions/set/json_spec.rb
328
334
  - spec/lib/vanagon/extensions/ostruct/json_spec.rb
329
- - spec/lib/vanagon/component_spec.rb
330
- - spec/lib/vanagon/utilities/shell_utilities_spec.rb
331
- - spec/lib/vanagon/platform_spec.rb
332
- - spec/lib/vanagon/environment_spec.rb
333
- - spec/lib/vanagon/project/dsl_spec.rb
334
- - spec/lib/vanagon/platform/osx_spec.rb
335
- - spec/lib/vanagon/platform/dsl_spec.rb
335
+ - spec/lib/vanagon/utilities_spec.rb
336
+ - spec/lib/vanagon/common/user_spec.rb
337
+ - spec/lib/vanagon/common/pathname_spec.rb
338
+ - spec/lib/vanagon/cli_spec.rb
339
+ - spec/lib/vanagon/platform/solaris_10_spec.rb
336
340
  - spec/lib/vanagon/platform/solaris_11_spec.rb
337
- - spec/lib/vanagon/platform/rpm/aix_spec.rb
338
- - spec/lib/vanagon/platform/windows_spec.rb
341
+ - spec/lib/vanagon/platform/osx_spec.rb
339
342
  - spec/lib/vanagon/platform/deb_spec.rb
343
+ - spec/lib/vanagon/platform/rpm/aix_spec.rb
340
344
  - spec/lib/vanagon/platform/rpm_spec.rb
341
- - spec/lib/vanagon/platform/solaris_10_spec.rb
342
- - spec/lib/vanagon/component/rules_spec.rb
343
- - spec/lib/vanagon/component/dsl_spec.rb
344
- - spec/lib/vanagon/component/source/rewrite_spec.rb
345
- - spec/lib/vanagon/component/source/git_spec.rb
346
- - spec/lib/vanagon/component/source/local_spec.rb
347
- - spec/lib/vanagon/component/source/http_spec.rb
348
- - spec/lib/vanagon/component/source_spec.rb
345
+ - spec/lib/vanagon/platform/windows_spec.rb
346
+ - spec/lib/vanagon/platform/dsl_spec.rb
347
+ - spec/lib/vanagon/project/dsl_spec.rb
349
348
  - spec/lib/vanagon/driver_spec.rb
350
- - spec/lib/vanagon/project_spec.rb
351
- - spec/lib/vanagon/utilities_spec.rb
352
- - spec/lib/vanagon/cli_spec.rb
353
- - spec/lib/vanagon/engine/ec2_spec.rb
354
- - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
349
+ - spec/lib/vanagon/component_spec.rb
350
+ - spec/lib/vanagon/environment_spec.rb
351
+ - spec/lib/vanagon/platform_spec.rb
355
352
  - spec/lib/vanagon/engine/base_spec.rb
353
+ - spec/lib/vanagon/engine/hardware_spec.rb
354
+ - spec/lib/vanagon/engine/always_be_scheduling_spec.rb
356
355
  - spec/lib/vanagon/engine/docker_spec.rb
357
356
  - spec/lib/vanagon/engine/local_spec.rb
358
- - spec/lib/vanagon/engine/hardware_spec.rb
357
+ - spec/lib/vanagon/engine/ec2_spec.rb
359
358
  - spec/lib/vanagon/engine/pooler_spec.rb
359
+ - spec/lib/vanagon/component/source/rewrite_spec.rb
360
+ - spec/lib/vanagon/component/source/http_spec.rb
361
+ - spec/lib/vanagon/component/source/local_spec.rb
362
+ - spec/lib/vanagon/component/source/git_spec.rb
363
+ - spec/lib/vanagon/component/rules_spec.rb
364
+ - spec/lib/vanagon/component/source_spec.rb
365
+ - spec/lib/vanagon/component/dsl_spec.rb
366
+ - spec/lib/git/rev_list_spec.rb
367
+ - spec/lib/makefile_spec.rb
@@ -1,11 +0,0 @@
1
- platform "fedora-30-x86_64" do |plat|
2
- plat.servicedir "/usr/lib/systemd/system"
3
- plat.defaultdir "/etc/sysconfig"
4
- plat.servicetype "systemd"
5
- plat.dist "fc30"
6
-
7
- packages = %w(autoconf automake createrepo rsync gcc gcc-c++ make rpmdevtools rpm-libs cmake rpm-sign yum-utils)
8
- plat.provision_with "/usr/bin/dnf install -y --best --allowerasing #{packages.join(' ')}"
9
- plat.install_build_dependencies_with "/usr/bin/dnf install -y --best --allowerasing"
10
- plat.vmpooler_template "fedora-30-x86_64"
11
- end
@@ -1,11 +0,0 @@
1
- platform "fedora-31-x86_64" do |plat|
2
- plat.servicedir "/usr/lib/systemd/system"
3
- plat.defaultdir "/etc/sysconfig"
4
- plat.servicetype "systemd"
5
- plat.dist "fc31"
6
-
7
- packages = %w(autoconf automake cmake createrepo rsync gcc gcc-c++ make rpmdevtools rpm-libs rpm-sign)
8
- plat.provision_with "/usr/bin/dnf install -y --best --allowerasing #{packages.join(' ')}"
9
- plat.install_build_dependencies_with "/usr/bin/dnf install -y --best --allowerasing"
10
- plat.vmpooler_template "fedora-31-x86_64"
11
- end