iapi-idlc-sdk-build 1.0.3 → 1.0.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/.gitignore +13 -0
- data/.rspec +2 -0
- data/.travis.yml +5 -0
- data/.yardopts +1 -0
- data/Gemfile +6 -0
- data/Jenkinsfile +21 -0
- data/LICENSE.txt +21 -0
- data/README.md +37 -0
- data/Rakefile +6 -0
- data/bin/console +14 -0
- data/bin/setup +8 -0
- data/iapi-idlc-sdk-build.gemspec +38 -0
- data/lib/iapi-idlc-sdk-build/config.rb +33 -0
- data/lib/iapi-idlc-sdk-build/httpd.rb +50 -0
- data/lib/iapi-idlc-sdk-build/metadata.rb +115 -0
- data/lib/iapi-idlc-sdk-build/template.rb +26 -0
- data/lib/iapi-idlc-sdk-build/templates/app/build.json.erb +79 -0
- data/lib/iapi-idlc-sdk-build/templates/base/build.json.erb +71 -0
- data/lib/iapi-idlc-sdk-build/version.rb +6 -0
- data/lib/iapi-idlc-sdk-build.rb +20 -0
- metadata +23 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 69d29f70b1d5c6fa7a91b14dc89f1c5b9be8c7ec0e4837ef7e3b47923dd4ef2c
|
4
|
+
data.tar.gz: f10412b9b37486670764e341e9f0d4929432df9d116f713cd25146c452a9353e
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 59bdfc7aaecfbd0a78651e1d54f604fe04d102ac1ed8f16474c7ea8238e3c5d93c8da953d8382eedd919b7889c52518441d7bedaea05a1485c2050a8c0360496
|
7
|
+
data.tar.gz: d741a0903645d2a03e036f0d518f66c310a9d0f8f766861481cc5654c5276d5eaf3276d88bfa0f45684aa610d060262a358abb8a9d542e26cf2d104bae70edd0
|
data/.gitignore
ADDED
data/.rspec
ADDED
data/.travis.yml
ADDED
data/.yardopts
ADDED
@@ -0,0 +1 @@
|
|
1
|
+
-m markdown
|
data/Gemfile
ADDED
data/Jenkinsfile
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
pipeline {
|
2
|
+
agent any
|
3
|
+
options {
|
4
|
+
buildDiscarder logRotator(daysToKeepStr: '5', numToKeepStr: '10')
|
5
|
+
}
|
6
|
+
stages {
|
7
|
+
stage('Ruby Gem Push') {
|
8
|
+
environment {
|
9
|
+
GEM_HOST_API_KEY = credentials('rubygems-apikey')
|
10
|
+
}
|
11
|
+
steps {
|
12
|
+
sh '''
|
13
|
+
DOCKER_CMD="docker run --rm -v $PWD:/opt -w /opt -e GEM_HOST_API_KEY -e BUILD_NUMBER -u 999 ruby:3.0"
|
14
|
+
$DOCKER_CMD gem build iapi-idlc-sdk-build.gemspec -o iapi-idlc-sdk-build.gem
|
15
|
+
$DOCKER_CMD gem push iapi-idlc-sdk-build.gem
|
16
|
+
'''
|
17
|
+
}
|
18
|
+
}
|
19
|
+
}
|
20
|
+
}
|
21
|
+
|
data/LICENSE.txt
ADDED
@@ -0,0 +1,21 @@
|
|
1
|
+
The MIT License (MIT)
|
2
|
+
|
3
|
+
Copyright (c) 2017 Nathan Cazell
|
4
|
+
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
7
|
+
in the Software without restriction, including without limitation the rights
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
10
|
+
furnished to do so, subject to the following conditions:
|
11
|
+
|
12
|
+
The above copyright notice and this permission notice shall be included in
|
13
|
+
all copies or substantial portions of the Software.
|
14
|
+
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
21
|
+
THE SOFTWARE.
|
data/README.md
ADDED
@@ -0,0 +1,37 @@
|
|
1
|
+
# Idlc::Sdk::Build
|
2
|
+
|
3
|
+
Provides build libraries for idlc-sdk. This gem is part of the IDLC SDK
|
4
|
+
|
5
|
+
## Installation
|
6
|
+
|
7
|
+
Add this line to your application's Gemfile:
|
8
|
+
|
9
|
+
```ruby
|
10
|
+
gem 'iapi-idlc-sdk-build'
|
11
|
+
```
|
12
|
+
|
13
|
+
And then execute:
|
14
|
+
|
15
|
+
$ bundle
|
16
|
+
|
17
|
+
Or install it yourself as:
|
18
|
+
|
19
|
+
$ gem install idlc-sdk-build
|
20
|
+
|
21
|
+
## Usage
|
22
|
+
|
23
|
+
require 'iapi-idlc-sdk-build'
|
24
|
+
|
25
|
+
## Development
|
26
|
+
|
27
|
+
After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
|
28
|
+
|
29
|
+
To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
|
30
|
+
|
31
|
+
## Contributing
|
32
|
+
|
33
|
+
Bug reports and pull requests are welcome on GitHub at https://github.com/nathantcz/idlc-sdk-build.
|
34
|
+
|
35
|
+
## License
|
36
|
+
|
37
|
+
The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
|
data/Rakefile
ADDED
data/bin/console
ADDED
@@ -0,0 +1,14 @@
|
|
1
|
+
#!/usr/bin/env ruby
|
2
|
+
|
3
|
+
require "bundler/setup"
|
4
|
+
require "idlc/sdk/build"
|
5
|
+
|
6
|
+
# You can add fixtures and/or initialization code here to make experimenting
|
7
|
+
# with your gem easier. You can also use a different console, if you like.
|
8
|
+
|
9
|
+
# (If you use this, don't forget to add pry to your Gemfile!)
|
10
|
+
# require "pry"
|
11
|
+
# Pry.start
|
12
|
+
|
13
|
+
require "irb"
|
14
|
+
IRB.start(__FILE__)
|
data/bin/setup
ADDED
@@ -0,0 +1,38 @@
|
|
1
|
+
# coding: utf-8
|
2
|
+
lib = File.expand_path("../lib", __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require "iapi-idlc-sdk-build/version"
|
5
|
+
|
6
|
+
Gem::Specification.new do |spec|
|
7
|
+
spec.name = "iapi-idlc-sdk-build"
|
8
|
+
spec.version = Idlc::Build::VERSION
|
9
|
+
spec.authors = ["Nathan Cazell", "Michael McHolm"]
|
10
|
+
spec.email = ["techsupport@imageapi.com"]
|
11
|
+
|
12
|
+
spec.summary = 'IDLC SDK for AWS resources - Build'
|
13
|
+
spec.description = 'Provides core libraries for idlc-sdk. This gem is part of the IDLC SDK'
|
14
|
+
spec.homepage = 'https://bitbucket.org/imageapi/iapi-idlc-sdk-build'
|
15
|
+
spec.license = 'MIT'
|
16
|
+
|
17
|
+
spec.metadata = {
|
18
|
+
'source_code_uri' => 'https://bitbucket.org/imageapi/iapi-idlc-sdk-build'
|
19
|
+
}
|
20
|
+
|
21
|
+
spec.files = `git ls-files -z`.split("\x0").reject do |f|
|
22
|
+
f.match(%r{^(test|spec|features)/})
|
23
|
+
end
|
24
|
+
|
25
|
+
spec.require_paths = ['lib']
|
26
|
+
|
27
|
+
spec.add_development_dependency 'bundler', '~> 2'
|
28
|
+
spec.add_development_dependency 'rake', '>= 12.3.3'
|
29
|
+
spec.add_development_dependency 'rspec', '~> 3.0'
|
30
|
+
spec.add_development_dependency 'rubocop', '0.48.1'
|
31
|
+
spec.add_development_dependency 'pry'
|
32
|
+
spec.add_development_dependency 'yard'
|
33
|
+
|
34
|
+
spec.add_runtime_dependency 'iapi-idlc-sdk-core'
|
35
|
+
spec.add_runtime_dependency 'net-telnet'
|
36
|
+
spec.add_runtime_dependency 'packer-binary'
|
37
|
+
spec.add_runtime_dependency 'rubocop', '0.48.1'
|
38
|
+
end
|
@@ -0,0 +1,33 @@
|
|
1
|
+
module Idlc::Build
|
2
|
+
class Config
|
3
|
+
include Idlc::Helpers
|
4
|
+
|
5
|
+
class << self
|
6
|
+
include Idlc::Helpers
|
7
|
+
|
8
|
+
def add_build_var(key, value)
|
9
|
+
ENV[key] = value
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
def initialize(region)
|
14
|
+
@region = region
|
15
|
+
@build_vars = []
|
16
|
+
|
17
|
+
Idlc::Utility.check_for_creds
|
18
|
+
|
19
|
+
rescue Idlc::Utility::MissingCredentials => e
|
20
|
+
msg("WARN: #{e.message}\nFalling back to implicit authentication.")
|
21
|
+
end
|
22
|
+
|
23
|
+
def dump_build_vars
|
24
|
+
@build_vars.join(' ')
|
25
|
+
end
|
26
|
+
|
27
|
+
def add_build_var_v2(key, value)
|
28
|
+
ENV[key] = value
|
29
|
+
|
30
|
+
@build_vars << "-var '#{key}=#{value}'"
|
31
|
+
end
|
32
|
+
end
|
33
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
module Idlc
|
2
|
+
module Build
|
3
|
+
module Httpd
|
4
|
+
class << self
|
5
|
+
def private_ip
|
6
|
+
Socket.ip_address_list.detect(&:ipv4_private?).ip_address
|
7
|
+
end
|
8
|
+
|
9
|
+
def start(root_dir, sleep_time = 3)
|
10
|
+
httpd = server(root_dir)
|
11
|
+
|
12
|
+
pid = Process.fork
|
13
|
+
if pid.nil?
|
14
|
+
# In child
|
15
|
+
exec((
|
16
|
+
trap('INT') { httpd.shutdown }
|
17
|
+
httpd.start
|
18
|
+
# ignore the nil excpetion here, this happens when the child process exits
|
19
|
+
)) rescue nil
|
20
|
+
else
|
21
|
+
# In parent
|
22
|
+
Process.detach(pid)
|
23
|
+
end
|
24
|
+
|
25
|
+
sleep sleep_time
|
26
|
+
|
27
|
+
# Return process id
|
28
|
+
pid
|
29
|
+
end
|
30
|
+
|
31
|
+
def stop(pid)
|
32
|
+
Process.kill('INT', pid) unless pid.nil?
|
33
|
+
end
|
34
|
+
|
35
|
+
private
|
36
|
+
|
37
|
+
def server(root)
|
38
|
+
# get a random port number
|
39
|
+
port = Random.rand(49_152...65_535)
|
40
|
+
ENV['HTTPD_PORT'] = port.to_s
|
41
|
+
|
42
|
+
WEBrick::HTTPServer.new(
|
43
|
+
Port: port,
|
44
|
+
DocumentRoot: root
|
45
|
+
)
|
46
|
+
end
|
47
|
+
end
|
48
|
+
end
|
49
|
+
end
|
50
|
+
end
|
@@ -0,0 +1,115 @@
|
|
1
|
+
module Idlc
|
2
|
+
module Build
|
3
|
+
class MissingMetadataFile < StandardError; end
|
4
|
+
class MissingRequiredMetadataAttribute < StandardError; end
|
5
|
+
|
6
|
+
class Metadata
|
7
|
+
class MetadataAttribute
|
8
|
+
attr_reader :key
|
9
|
+
attr_reader :value
|
10
|
+
|
11
|
+
def initialize(value, required = false)
|
12
|
+
@value = value
|
13
|
+
@required = required
|
14
|
+
end
|
15
|
+
|
16
|
+
def required?
|
17
|
+
@required
|
18
|
+
end
|
19
|
+
|
20
|
+
def defined?
|
21
|
+
!@value.nil?
|
22
|
+
end
|
23
|
+
end
|
24
|
+
|
25
|
+
attr_reader :attributes
|
26
|
+
|
27
|
+
def initialize(name, file = 'metadata')
|
28
|
+
@name = name
|
29
|
+
@file = file
|
30
|
+
@attributes = {}
|
31
|
+
|
32
|
+
# Required
|
33
|
+
@attributes['build_stage'] = MetadataAttribute.new(nil, true)
|
34
|
+
@attributes['chef_run_list'] = MetadataAttribute.new(nil, true)
|
35
|
+
@attributes['instance_type'] = MetadataAttribute.new(nil, true)
|
36
|
+
@attributes['os_type'] = MetadataAttribute.new(nil, true)
|
37
|
+
@attributes['role'] = MetadataAttribute.new(nil, true)
|
38
|
+
@attributes['source_ami_name'] = MetadataAttribute.new(nil, true)
|
39
|
+
@attributes['source_ami_owner'] = MetadataAttribute.new(nil, true)
|
40
|
+
@attributes['version'] = MetadataAttribute.new(REPO_VERSION, true)
|
41
|
+
@attributes['security_group_id'] = MetadataAttribute.new(ENV['PACKER_BUILD_SG_ID'], true)
|
42
|
+
@attributes['vpc_id'] = MetadataAttribute.new(ENV['PACKER_BUILD_VPC_ID'], true)
|
43
|
+
@attributes['vpc_subnet'] = MetadataAttribute.new(ENV['PACKER_BUILD_SUBNET_ID'], true)
|
44
|
+
@attributes['iam_instance_profile'] = MetadataAttribute.new(ENV['PACKER_BUILD_INSTANCE_PROFILE_NAME'], true)
|
45
|
+
|
46
|
+
# Optional Defaults
|
47
|
+
@attributes['block_device_mapping'] = MetadataAttribute.new('[]')
|
48
|
+
@attributes['job_code'] = MetadataAttribute.new('988')
|
49
|
+
@attributes['chef_dir'] = MetadataAttribute.new('c:/windows/temp/packer-chef-client')
|
50
|
+
end
|
51
|
+
|
52
|
+
def load
|
53
|
+
raise MissingMetadataFile, "Expected metadata file at: #{metadata_file}" unless File.exist? metadata_file
|
54
|
+
|
55
|
+
YAML.load_file(metadata_file).each do |key, value|
|
56
|
+
value = nested_json(value) if key == 'block_device_mapping'
|
57
|
+
|
58
|
+
value = strip_trailing_dash(value) if key == 'source_ami_name'
|
59
|
+
|
60
|
+
puts "WARNING: unrecognized metadata key: '#{key}'" unless @attributes.key? key
|
61
|
+
next unless @attributes.key? key
|
62
|
+
|
63
|
+
required = @attributes[key].required?
|
64
|
+
@attributes[key] = MetadataAttribute.new(value, required)
|
65
|
+
end
|
66
|
+
end
|
67
|
+
|
68
|
+
def strip_trailing_dash(value)
|
69
|
+
return value[0..-2] if dash? value[-1]
|
70
|
+
|
71
|
+
value
|
72
|
+
end
|
73
|
+
|
74
|
+
def dash?(char)
|
75
|
+
char == '-'
|
76
|
+
end
|
77
|
+
|
78
|
+
def nested_json(value)
|
79
|
+
total_block = []
|
80
|
+
value.each do |block|
|
81
|
+
total_block.push(block)
|
82
|
+
end
|
83
|
+
|
84
|
+
total_block.to_json
|
85
|
+
end
|
86
|
+
|
87
|
+
def requirements_satisfied?
|
88
|
+
begin
|
89
|
+
@attributes['version'] = MetadataAttribute.new(YAML.load_file(version_file)['version'], true) unless @attributes['version'].defined?
|
90
|
+
rescue
|
91
|
+
puts('WARNING: \'version\' not specified in environment, metadata, or version file')
|
92
|
+
end
|
93
|
+
|
94
|
+
@attributes.each do |key, att|
|
95
|
+
raise MissingRequiredMetadataAttribute, "Missing required key: '#{key}' in metadata file" if att.required? && att.value.nil?
|
96
|
+
raise MissingRequiredMetadataAttribute, "Metadata key: '#{key}' cannot be nil" if att.required? && att.value.strip.empty?
|
97
|
+
end
|
98
|
+
|
99
|
+
true
|
100
|
+
end
|
101
|
+
|
102
|
+
def metadata_file
|
103
|
+
"#{Dir.pwd}/#{base_dir}/#{@file}"
|
104
|
+
end
|
105
|
+
|
106
|
+
def version_file
|
107
|
+
"#{Dir.pwd}/#{base_dir}/version"
|
108
|
+
end
|
109
|
+
|
110
|
+
def base_dir
|
111
|
+
"builds/#{@name}"
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,26 @@
|
|
1
|
+
module Idlc
|
2
|
+
module Build
|
3
|
+
class Template
|
4
|
+
def initialize(metadata, output_file)
|
5
|
+
@metadata = metadata
|
6
|
+
@output_file = output_file
|
7
|
+
end
|
8
|
+
|
9
|
+
def templates_dir
|
10
|
+
"#{__dir__}/templates/#{@metadata['build_stage'].value}"
|
11
|
+
end
|
12
|
+
|
13
|
+
def render
|
14
|
+
tpl = File.read("#{templates_dir}/build.json.erb")
|
15
|
+
|
16
|
+
renderer = ERB.new(tpl)
|
17
|
+
renderer.result(binding)
|
18
|
+
end
|
19
|
+
|
20
|
+
def write
|
21
|
+
# Write rendered template to output_file
|
22
|
+
File.open(@output_file, 'w') { |file| file.write(render) }
|
23
|
+
end
|
24
|
+
end
|
25
|
+
end
|
26
|
+
end
|
@@ -0,0 +1,79 @@
|
|
1
|
+
{
|
2
|
+
"builders": [
|
3
|
+
{
|
4
|
+
"type": "amazon-ebs",
|
5
|
+
"region": "{{ user `aws_region` }}",
|
6
|
+
"communicator": "winrm",
|
7
|
+
"winrm_username": "Administrator",
|
8
|
+
"winrm_use_ssl": true,
|
9
|
+
"winrm_insecure": true,
|
10
|
+
"vpc_id": "{{ user `vpc_id` }}",
|
11
|
+
"subnet_id": "{{ user `vpc_subnet` }}",
|
12
|
+
"security_group_id": "{{ user `security_group_id` }}",
|
13
|
+
"iam_instance_profile": "{{ user `iam_instance_profile` }}",
|
14
|
+
"source_ami_filter": {
|
15
|
+
"filters": {
|
16
|
+
"name": "{{ user `source_ami_name` }}-*"
|
17
|
+
},
|
18
|
+
"owners": ["{{ user `source_ami_owner` }}"],
|
19
|
+
"most_recent": true
|
20
|
+
},
|
21
|
+
"instance_type": "{{ user `instance_type` }}",
|
22
|
+
"ami_name": "{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}{{ user `build_metadata` }}",
|
23
|
+
"user_data_file": "files/config/init.ps1.userdata",
|
24
|
+
"launch_block_device_mappings": <%= @metadata['block_device_mapping'].value %>,
|
25
|
+
"run_tags": {
|
26
|
+
"job_code": "{{ user `job_code` }}",
|
27
|
+
"Name": "Packer_Builder-{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}{{ user `build_metadata` }}"
|
28
|
+
},
|
29
|
+
"run_volume_tags": {
|
30
|
+
"job_code": "{{ user `job_code` }}",
|
31
|
+
"Name": "Packer_Builder-{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}{{ user `build_metadata` }}"
|
32
|
+
},
|
33
|
+
"tags": {
|
34
|
+
"job_code": "{{ user `job_code` }}",
|
35
|
+
"version": "{{ user `version` }}",
|
36
|
+
"build": "{{ user `build_number`}}",
|
37
|
+
"build_metadata": "{{ user `build_metadata`}}",
|
38
|
+
"build_uuid": "{{ user `build_uuid` }}",
|
39
|
+
"os": "{{ user `os_type` }}",
|
40
|
+
"build_stage": "{{ user `build_stage` }}",
|
41
|
+
"Name": "{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}{{ user `build_metadata` }}",
|
42
|
+
"app_release": "{{ user `app_release` }}{{ user `build_metadata` }}"
|
43
|
+
}
|
44
|
+
}
|
45
|
+
],
|
46
|
+
|
47
|
+
"provisioners": [
|
48
|
+
{
|
49
|
+
"type": "file",
|
50
|
+
"source": "{{user `cookbooks_zip`}}",
|
51
|
+
"destination": "c:/chef/cookbooks.zip"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"type": "powershell",
|
55
|
+
"inline": [
|
56
|
+
"Expand-Archive c:/chef/cookbooks.zip -DestinationPath c:/chef"
|
57
|
+
]
|
58
|
+
},
|
59
|
+
{
|
60
|
+
"type": "powershell",
|
61
|
+
"inline": [
|
62
|
+
"Rename-Computer -NewName {{ user `build_uuid` }} -Force"
|
63
|
+
]
|
64
|
+
},
|
65
|
+
{
|
66
|
+
"type": "chef-client",
|
67
|
+
"guest_os_type": "windows",
|
68
|
+
"server_url": "http://localhost:8889",
|
69
|
+
"config_template": "./files/config/client.rb.template",
|
70
|
+
"run_list": [ "{{ user `chef_run_list` }}" ],
|
71
|
+
"skip_clean_node": true,
|
72
|
+
"skip_clean_client": true,
|
73
|
+
"skip_install": true,
|
74
|
+
"json": {
|
75
|
+
"app_release": "{{user `app_release`}}"
|
76
|
+
}
|
77
|
+
}
|
78
|
+
]
|
79
|
+
}
|
@@ -0,0 +1,71 @@
|
|
1
|
+
{
|
2
|
+
"builders": [
|
3
|
+
{
|
4
|
+
"type": "amazon-ebs",
|
5
|
+
"region": "{{ user `aws_region` }}",
|
6
|
+
"communicator": "winrm",
|
7
|
+
"winrm_username": "Administrator",
|
8
|
+
"winrm_password": "Aut0m@t0r",
|
9
|
+
"winrm_use_ssl": true,
|
10
|
+
"winrm_insecure": true,
|
11
|
+
"vpc_id": "{{ user `vpc_id` }}",
|
12
|
+
"subnet_id": "{{ user `vpc_subnet` }}",
|
13
|
+
"security_group_id": "{{ user `security_group_id` }}",
|
14
|
+
"iam_instance_profile": "{{ user `iam_instance_profile` }}",
|
15
|
+
"source_ami_filter": {
|
16
|
+
"filters": {
|
17
|
+
"name": "{{ user `source_ami_name` }}*"
|
18
|
+
},
|
19
|
+
"owners": ["{{ user `source_ami_owner` }}"],
|
20
|
+
"most_recent": true
|
21
|
+
},
|
22
|
+
"instance_type": "{{ user `instance_type` }}",
|
23
|
+
"ami_name": "{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}",
|
24
|
+
"user_data_file": "files/config/init.ps1.userdata",
|
25
|
+
"run_tags": {
|
26
|
+
"job_code": "{{ user `job_code` }}",
|
27
|
+
"Name": "Packer Builder"
|
28
|
+
},
|
29
|
+
"run_volume_tags": {
|
30
|
+
"job_code": "{{ user `job_code` }}",
|
31
|
+
"Name": "Packer Builder"
|
32
|
+
},
|
33
|
+
"tags": {
|
34
|
+
"job_code": "{{ user `job_code` }}",
|
35
|
+
"version": "{{ user `version` }}",
|
36
|
+
"build": "{{ user `build_number`}}",
|
37
|
+
"build_uuid": "{{ user `build_uuid` }}",
|
38
|
+
"os": "{{ user `os_type` }}",
|
39
|
+
"build_stage": "{{ user `build_stage` }}",
|
40
|
+
"Name": "{{ user `build_stage` }}-{{ user `role` }}-{{ user `version` }}.{{ user `build_number` }}",
|
41
|
+
"source_ami": "{{ user `source_ami_name` }}"
|
42
|
+
}
|
43
|
+
}
|
44
|
+
],
|
45
|
+
|
46
|
+
"provisioners": [
|
47
|
+
{ "type": "powershell", "inline": [ "mkdir {{user `chef_dir`}}" ] },
|
48
|
+
{
|
49
|
+
"type": "file",
|
50
|
+
"source": "{{user `cookbooks_zip`}}",
|
51
|
+
"destination": "{{user `chef_dir`}}/cookbooks.zip"
|
52
|
+
},
|
53
|
+
{
|
54
|
+
"type": "powershell",
|
55
|
+
"inline": [
|
56
|
+
"Add-Type -AssemblyName System.IO.Compression.FileSystem",
|
57
|
+
"[System.IO.Compression.ZipFile]::ExtractToDirectory('{{user `chef_dir`}}/cookbooks.zip', '{{user `chef_dir`}}')"
|
58
|
+
]
|
59
|
+
},
|
60
|
+
{
|
61
|
+
"type": "chef-client",
|
62
|
+
"guest_os_type": "windows",
|
63
|
+
"install_command": "powershell.exe -Command \"(New-Object System.Net.WebClient).DownloadFile('https://packages.chef.io/files/stable/chef/12.19.36/windows/2012r2/chef-client-12.19.36-1-x64.msi', 'C:\\Windows\\Temp\\chef.msi');Start-Process 'msiexec' -ArgumentList '/qb /i C:\\Windows\\Temp\\chef.msi' -NoNewWindow -Wait\"",
|
64
|
+
"server_url": "http://localhost:8889",
|
65
|
+
"config_template": "./files/config/client.rb.template",
|
66
|
+
"run_list": [ "{{ user `chef_run_list` }}" ],
|
67
|
+
"skip_clean_node": true,
|
68
|
+
"skip_clean_client": true
|
69
|
+
}
|
70
|
+
]
|
71
|
+
}
|
@@ -0,0 +1,20 @@
|
|
1
|
+
require 'date'
|
2
|
+
require 'fileutils'
|
3
|
+
require 'packer/binary'
|
4
|
+
require 'rspec/core/rake_task'
|
5
|
+
require 'securerandom'
|
6
|
+
require 'tmpdir'
|
7
|
+
require 'webrick'
|
8
|
+
|
9
|
+
# Use the packer-binary gem to provide the executable
|
10
|
+
Packer::Binary.configure do |config|
|
11
|
+
config.version = '0.12.3'
|
12
|
+
end
|
13
|
+
|
14
|
+
require 'iapi-idlc-sdk-core'
|
15
|
+
|
16
|
+
require 'iapi-idlc-sdk-build/version'
|
17
|
+
require 'iapi-idlc-sdk-build/config'
|
18
|
+
require 'iapi-idlc-sdk-build/httpd'
|
19
|
+
require 'iapi-idlc-sdk-build/metadata'
|
20
|
+
require 'iapi-idlc-sdk-build/template'
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iapi-idlc-sdk-build
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0.
|
4
|
+
version: 1.0.4
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Nathan Cazell
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2023-11-
|
12
|
+
date: 2023-11-08 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|
@@ -157,7 +157,27 @@ email:
|
|
157
157
|
executables: []
|
158
158
|
extensions: []
|
159
159
|
extra_rdoc_files: []
|
160
|
-
files:
|
160
|
+
files:
|
161
|
+
- ".gitignore"
|
162
|
+
- ".rspec"
|
163
|
+
- ".travis.yml"
|
164
|
+
- ".yardopts"
|
165
|
+
- Gemfile
|
166
|
+
- Jenkinsfile
|
167
|
+
- LICENSE.txt
|
168
|
+
- README.md
|
169
|
+
- Rakefile
|
170
|
+
- bin/console
|
171
|
+
- bin/setup
|
172
|
+
- iapi-idlc-sdk-build.gemspec
|
173
|
+
- lib/iapi-idlc-sdk-build.rb
|
174
|
+
- lib/iapi-idlc-sdk-build/config.rb
|
175
|
+
- lib/iapi-idlc-sdk-build/httpd.rb
|
176
|
+
- lib/iapi-idlc-sdk-build/metadata.rb
|
177
|
+
- lib/iapi-idlc-sdk-build/template.rb
|
178
|
+
- lib/iapi-idlc-sdk-build/templates/app/build.json.erb
|
179
|
+
- lib/iapi-idlc-sdk-build/templates/base/build.json.erb
|
180
|
+
- lib/iapi-idlc-sdk-build/version.rb
|
161
181
|
homepage: https://bitbucket.org/imageapi/iapi-idlc-sdk-build
|
162
182
|
licenses:
|
163
183
|
- MIT
|