hashipack 0.1.3 → 0.1.5
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.devcontainer/Dockerfile +7 -0
- data/.devcontainer/devcontainer.json +38 -0
- data/Gemfile.lock +5 -3
- data/lib/hashipack/client.rb +25 -15
- data/lib/hashipack/message.rb +2 -0
- data/lib/hashipack/version.rb +1 -1
- metadata +5 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0a97072d2fd6b4702a2fce358d21b149551cc190b4fc782231c59bab036c9b68
|
4
|
+
data.tar.gz: e765c7c6cf65fcb219e52527dcf530c430dda4d3337a352431f957ae8986f2cb
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: bea07df2852be1ae4066c0bba8ae70b013212391db6bb1f840b6596557a889e6bb5e6a0ff57979a7c43085c8539dc625cb529fba67ddac9a860fd2a81421324a
|
7
|
+
data.tar.gz: c5880b968204a7682afa8f8f82f7172e6ec5c6a0ae1515aab55ffa26efdf970f217b5f163f2c54a41e66852d75188b2100daf6b256a3e93ee4ce64cf4817bb3a
|
@@ -0,0 +1,7 @@
|
|
1
|
+
FROM mcr.microsoft.com/devcontainers/ruby:1-3.3-bullseye
|
2
|
+
|
3
|
+
# Install packages needed to build gems
|
4
|
+
RUN curl -fsSL https://apt.releases.hashicorp.com/gpg | sudo apt-key add -
|
5
|
+
RUN sudo apt-add-repository "deb [arch=amd64] https://apt.releases.hashicorp.com $(lsb_release -cs) main"
|
6
|
+
RUN apt-get update -qq && \
|
7
|
+
apt-get install --no-install-recommends -y packer
|
@@ -0,0 +1,38 @@
|
|
1
|
+
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
|
2
|
+
// README at: https://github.com/devcontainers/templates/tree/main/src/ruby
|
3
|
+
{
|
4
|
+
"name": "Ruby",
|
5
|
+
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
|
6
|
+
"build": {
|
7
|
+
"dockerfile": "Dockerfile"
|
8
|
+
},
|
9
|
+
|
10
|
+
// Features to add to the dev container. More info: https://containers.dev/features.
|
11
|
+
"features": {
|
12
|
+
"ghcr.io/devcontainers/features/docker-in-docker:2": {}
|
13
|
+
},
|
14
|
+
|
15
|
+
// Use 'forwardPorts' to make a list of ports inside the container available locally.
|
16
|
+
// "forwardPorts": [],
|
17
|
+
|
18
|
+
// Use 'postCreateCommand' to run commands after the container is created.
|
19
|
+
"postCreateCommand": "packer init spec/docker.pkr.hcl",
|
20
|
+
|
21
|
+
// Configure tool-specific properties.
|
22
|
+
"customizations": {
|
23
|
+
"vscode": {
|
24
|
+
"extensions": [
|
25
|
+
"shardulm94.trailing-spaces"
|
26
|
+
],
|
27
|
+
"settings": {
|
28
|
+
"rubyLsp.rubyVersionManager": {
|
29
|
+
"identifier": "none"
|
30
|
+
},
|
31
|
+
"editor.formatOnSaveMode": "file"
|
32
|
+
}
|
33
|
+
}
|
34
|
+
}
|
35
|
+
|
36
|
+
// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
|
37
|
+
// "remoteUser": "root"
|
38
|
+
}
|
data/Gemfile.lock
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
PATH
|
2
2
|
remote: .
|
3
3
|
specs:
|
4
|
-
hashipack (0.1.
|
4
|
+
hashipack (0.1.5)
|
5
5
|
|
6
6
|
GEM
|
7
7
|
remote: https://rubygems.org/
|
@@ -20,7 +20,8 @@ GEM
|
|
20
20
|
rainbow (3.1.1)
|
21
21
|
rake (13.0.6)
|
22
22
|
regexp_parser (2.8.2)
|
23
|
-
rexml (3.
|
23
|
+
rexml (3.3.6)
|
24
|
+
strscan
|
24
25
|
rspec (3.12.0)
|
25
26
|
rspec-core (~> 3.12.0)
|
26
27
|
rspec-expectations (~> 3.12.0)
|
@@ -64,6 +65,7 @@ GEM
|
|
64
65
|
standard-performance (1.2.1)
|
65
66
|
lint_roller (~> 1.1)
|
66
67
|
rubocop-performance (~> 1.19.1)
|
68
|
+
strscan (3.1.0)
|
67
69
|
unicode-display_width (2.5.0)
|
68
70
|
|
69
71
|
PLATFORMS
|
@@ -76,4 +78,4 @@ DEPENDENCIES
|
|
76
78
|
standard (~> 1.3)
|
77
79
|
|
78
80
|
BUNDLED WITH
|
79
|
-
2.
|
81
|
+
2.5.11
|
data/lib/hashipack/client.rb
CHANGED
@@ -1,8 +1,10 @@
|
|
1
1
|
require 'tempfile'
|
2
|
+
require 'open3'
|
2
3
|
|
3
4
|
module Hashipack
|
4
5
|
class Client
|
5
|
-
def build(
|
6
|
+
def build(path, on_output: lambda {}, on_progress: lambda {}, estimated_duration: 300)
|
7
|
+
directory, filename = File.split(path)
|
6
8
|
command = "packer -machine-readable build #{filename}"
|
7
9
|
|
8
10
|
initial_timestamp = 99999999999
|
@@ -10,27 +12,35 @@ module Hashipack
|
|
10
12
|
|
11
13
|
artifacts = []
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
+
Open3.popen3(command, chdir: directory) do |stdin, stdout, stderr, wait_thr|
|
16
|
+
stdout.each do |line|
|
17
|
+
message = Message.parse(line)
|
15
18
|
|
16
|
-
|
17
|
-
|
19
|
+
if message.type == :ui
|
20
|
+
initial_timestamp = message.timestamp if message.timestamp < initial_timestamp
|
18
21
|
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
22
|
+
if message.timestamp > last_timestamp
|
23
|
+
last_timestamp = message.timestamp
|
24
|
+
running_duration = message.timestamp - initial_timestamp
|
25
|
+
progress = running_duration / estimated_duration.to_f
|
26
|
+
on_progress.call(progress)
|
27
|
+
end
|
28
|
+
|
29
|
+
on_output.call(message.text)
|
25
30
|
|
26
|
-
|
31
|
+
elsif message.type == :artifact
|
27
32
|
|
28
|
-
|
33
|
+
artifacts[message.number] ||= Artifact.new
|
34
|
+
artifacts[message.number].append_info(message.key, message.value)
|
29
35
|
|
30
|
-
|
31
|
-
|
36
|
+
end
|
37
|
+
end
|
32
38
|
|
39
|
+
stderr.each do |line|
|
40
|
+
puts "Error: #{line}"
|
33
41
|
end
|
42
|
+
|
43
|
+
puts "Exit status: #{wait_thr.value}"
|
34
44
|
end
|
35
45
|
|
36
46
|
artifacts
|
data/lib/hashipack/message.rb
CHANGED
data/lib/hashipack/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: hashipack
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.5
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Lukas_Skywalker
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2024-08-28 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: None.
|
14
14
|
email:
|
@@ -17,6 +17,8 @@ executables: []
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
+
- ".devcontainer/Dockerfile"
|
21
|
+
- ".devcontainer/devcontainer.json"
|
20
22
|
- ".rspec"
|
21
23
|
- ".standard.yml"
|
22
24
|
- CHANGELOG.md
|
@@ -52,7 +54,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
52
54
|
- !ruby/object:Gem::Version
|
53
55
|
version: '0'
|
54
56
|
requirements: []
|
55
|
-
rubygems_version: 3.
|
57
|
+
rubygems_version: 3.5.11
|
56
58
|
signing_key:
|
57
59
|
specification_version: 4
|
58
60
|
summary: Ruby client for Hashicorps Packer
|