-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrelease.py
51 lines (40 loc) · 1.24 KB
/
release.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
from packerlicious import builder, post_processor, provisioner, \
Ref, Template, UserVar
from packerpy import PackerExecutable
from dotenv import load_dotenv
load_dotenv()
import os
token = os.environ.get("cloud_token")
cloud_token = UserVar("cloud_token", token)
user_variables = [ cloud_token ]
builders = [
builder.Null(
communicator = "none"
)
]
post_processors = [
[
post_processor.Artifice(
files = [
"builds/ubuntu1804-desktop-base.box"
]
),
post_processor.VagrantCloud(
box_tag = "catosplace/ubuntu1804-desktop-base",
access_token = Ref(cloud_token),
version = "1.0.2"
),
#post_processor.Checksum(
# checksum_types = [ "md5", "sha1", "sha256" ]
#),
]
]
t = Template()
t.add_variable(user_variables)
t.add_builder(builders)
t.add_post_processor(post_processors)
print(t.to_json())
(ret, out, err) = PackerExecutable(machine_readable=False).validate(t.to_json())
print(out.decode('unicode_escape'))
(ret, out, err) = PackerExecutable(machine_readable=False).build(t.to_json())
print(out.decode('unicode_escape'))