forked from chef/bento
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (168 loc) · 6.76 KB
/
pkr-bld-vmware-x64.yml
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
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
on:
push:
branches: ["main"]
pull_request:
branches: ["main"]
env:
PACKER_GITHUB_API_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
# PACKER_LOG: "1"
jobs:
x86_64:
runs-on: macos-13
strategy:
fail-fast: false
matrix:
os:
- debian-11
- debian-12
- ubuntu-22.04
- ubuntu-24.04
provider:
- vmware-iso
steps:
- name: Checkout
uses: actions/checkout@main
- name: Install Vagrant VMware-fusion
run: |
brew tap hashicorp/tap
brew update
brew install --cask hashicorp/tap/hashicorp-vagrant
brew install --cask vmware-fusion
brew install --cask vagrant-vmware-utility
vagrant plugin install vagrant-vmware-desktop
sudo mkdir -p /Library/Preferences/VMware\ Fusion/vmnet8
NETWORKING_CONF="/Library/Preferences/VMware Fusion/networking"
DHCPD_CONF="/Library/Preferences/VMware Fusion/vmnet8/dhcpd.conf"
NAT_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.conf"
NAT_MAC_CONF="/Library/Preferences/VMware Fusion/vmnet8/nat.mac"
DHCPD_CONFIG='
# Configuration file for ISC 2.0 vmnet-dhcpd operating on vmnet8.
###### VMNET DHCP Configuration. Start of "DO NOT MODIFY SECTION" #####
# Modification Instructions: This section of the configuration file contains
# information generated by the configuration program. Do not modify this
# section.
# Written at: 05/20/2024 11:50:44
allow unknown-clients;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
subnet 172.16.38.0 netmask 255.255.255.0 {
range 172.16.38.128 172.16.38.254;
option broadcast-address 172.16.38.255;
option domain-name-servers 172.16.38.2;
option domain-name localdomain;
default-lease-time 1800; # default is 30 minutes
max-lease-time 7200; # default is 2 hours
option netbios-name-servers 172.16.38.2;
option routers 172.16.38.2;
}
host vmnet8 {
hardware ethernet 00:50:56:C0:00:08;
fixed-address 172.16.38.1;
option domain-name-servers 0.0.0.0;
option domain-name "";
option routers 0.0.0.0;
}
####### VMNET DHCP Configuration. End of "DO NOT MODIFY SECTION" #######
'
NAT_CONFIG="
# VMware NAT configuration file
[host]
# Use MacOS network virtualization API
useMacosVmnetVirtApi = 1
# NAT gateway address
ip = 172.16.38.2
netmask = 255.255.255.0
# VMnet device if not specified on command line
device = vmnet8
# Allow PORT/EPRT FTP commands (they need incoming TCP stream ...)
activeFTP = 1
# Allows the source to have any OUI. Turn this on if you change the OUI in the MAC address of your virtual machines.
allowAnyOUI = 1
# VMnet host IP address
hostIp = 172.16.38.1
# Controls if (TCP) connections should be reset when the adapter they are bound to goes down
resetConnectionOnLinkDown = 1
# Controls if (TCP) connection should be reset when guest packet's destination is NAT's IP address
resetConnectionOnDestLocalHost = 1
# Controls if enable nat ipv6
natIp6Enable = 0
# Controls if enable nat ipv6
natIp6Prefix = fd15:4ba5:5a2b:1008::/64
[tcp]
# Value of timeout in TCP TIME_WAIT state, in seconds
timeWaitTimeout = 30
[udp]
# Timeout in seconds. Dynamically-created UDP mappings will purged if idle for this duration of time 0 = no timeout, default = 60; real value might be up to 100% longer
timeout = 60
[netbios]
# Timeout for NBNS queries.
nbnsTimeout = 2
# Number of retries for each NBNS query.
nbnsRetries = 3
# Timeout for NBDS queries.
nbdsTimeout = 3
[incomingtcp]
# Use these with care - anyone can enter into your VM through these...
# The format and example are as follows:
#<external port number> = <VM's IP address>:<VM's port number>
#8080 = 172.16.3.128:80
[incomingudp]
# UDP port forwarding example
#6000 = 172.16.3.0:6001
"
NAT_MAC_CONFIG="00:50:56:F2:C7:28"
NETWORKING_CONFIG="
VERSION=1,0
answer VNET_1_DHCP yes
answer VNET_1_DHCP_CFG_HASH 97D56988968565698E051056ADEDEEACF00F5981
answer VNET_1_HOSTONLY_NETMASK 255.255.255.0
answer VNET_1_HOSTONLY_SUBNET 172.16.252.0
answer VNET_1_HOSTONLY_UUID 74A7B7F5-AB8E-41CF-9E0F-595F9C9FA1C5
answer VNET_1_VIRTUAL_ADAPTER yes
answer VNET_8_DHCP yes
answer VNET_8_DHCP_CFG_HASH 2040265D0F7053A921FB3F6EDE944490D9E687D6
answer VNET_8_HOSTONLY_NETMASK 255.255.255.0
answer VNET_8_HOSTONLY_SUBNET 172.16.38.0
answer VNET_8_HOSTONLY_UUID 3CBAC6B3-6A71-4182-8BC6-849058A947B8
answer VNET_8_NAT yes
answer VNET_8_VIRTUAL_ADAPTER yes
"
# Write the network configuration to the file
echo "$NETWORKING_CONFIG" | sudo tee "$NETWORKING_CONF" > /dev/null
echo "$DHCPD_CONFIG" | sudo tee "$DHCPD_CONF" > /dev/null
echo "$NAT_CONFIG" | sudo tee "$NAT_CONF" > /dev/null
echo "$NAT_MAC_CONFIG" | sudo tee "$NAT_MAC_CONF" > /dev/null
echo "VMware Fusion networking configuration updated."
- name: Install Chef
uses: actionshub/[email protected]
with:
version: 24.2.1058
- name: Setup Packer
uses: hashicorp/setup-packer@main
with:
version: latest
- name: Install Bento
run: |
eval "$(chef shell-init bash)"
gem build bento.gemspec
gem install bento-*.gem
- name: Bento build
run: |
eval "$(chef shell-init bash)"
bento build -o ${{ matrix.provider }}.vm os_pkrvars/$(echo ${{ matrix.os }} | cut -d "-" -f 1)/"${{ matrix.os }}-x86_64.pkrvars.hcl"
ls -alh builds/
cat builds/${{ matrix.os }}*-x86_64._metadata.json
- name: Upload build artifact
uses: actions/upload-artifact@v3
with:
name: "${{ matrix.os }}-vmware-x86_64"
path: |
builds/*.box
builds/*.json
retention-days: 10
compression-level: 0 # no compression
- name: Bento Test
run: |
eval "$(chef shell-init bash)"
bento test