-
-
Notifications
You must be signed in to change notification settings - Fork 102
157 lines (138 loc) · 6.71 KB
/
build_vagrant.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
name: Vagrant Playbook Checker
on:
pull_request:
paths:
- .github/workflows/build_vagrant.yml
- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/**
branches:
- master
# Cancel existing runs if user makes another push.
concurrency:
group: "${{ github.ref }}"
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
permissions:
contents: read
jobs:
build-solaris:
name: Solaris
runs-on: macos-latest
steps:
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
# As Solaris Needs An Older Version Of Ansible/Python
# Use Python2 & Pip To Install On Ubuntu 22.04
# Rather Than The System Packages
# - name: Install Python 2
# run: sudo apt-get install python2
#
# - name: Python 2 Get Pip Bootstrap Script
# run: curl https://bootstrap.pypa.io/pip/2.7/get-pip.py --output get-pip.py
#
# - name: Python 2 Get Pip
# run: sudo python2 get-pip.py
#
# - name: Install Ansible Using PIP2
# run: pip2 install ansible
# - name: Add Oracle Virtualbox GPG Key
# run: wget -O- https://www.virtualbox.org/download/oracle_vbox_2016.asc | sudo gpg --dearmor --yes --output /usr/share/keyrings/oracle-virtualbox-2016.gpg
#
# - name: Add Virtualbox Repository
# run: echo "deb [arch=amd64 signed-by=/usr/share/keyrings/oracle-virtualbox-2016.gpg] http://download.virtualbox.org/virtualbox/debian $(lsb_release -cs) contrib" | sudo tee /etc/apt/sources.list.d/virtualbox.list
#
# - name: Update Repos
# run: sudo apt-get update
#
# - name: Install VirtualBox
# run: sudo apt-get install virtualbox-7.0
#
# - name: Add Hashicorp GPG Key
# run: wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
#
# - name: Add Hashicorp Repository
# run: echo "deb [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
#
# - name: Update Repos
# run: sudo apt-get update
#
# - name: Install Vagrant
# run: sudo apt-get install vagrant
- name: Install Homebrew (if not already installed)
run: |
which brew || /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
- name: Update Homebrew
run: brew update
# - name: Install VirtualBox
# run: brew install --cask virtualbox
- name: Install VirtualBox 7.0 (specific version)
run: |
brew install --cask [email protected] || \
curl -LO https://download.virtualbox.org/virtualbox/7.0.10/VirtualBox-7.0.10-158379-OSX.dmg && \
hdiutil attach VirtualBox-7.0.10-158379-OSX.dmg && \
sudo installer -pkg /Volumes/VirtualBox/VirtualBox.pkg -target /
- name: Install Vagrant
run: brew install --cask vagrant
- name: Cache Solaris10.box
id: solaris-10-cache
uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
with:
path: Solaris10.box
key: sol10boxcache
- name: Download Solaris 10 Box If Cache Misses
if: steps.solaris-10-cache.outputs.cache-hit != 'true'
run: wget https://ci.adoptium.net/userContent/vagrant/Solaris10.box.gz
- name: Verify Checksum If Cache Misses
if: steps.solaris-10-cache.outputs.cache-hit != 'true'
run: |
CKSUM=`shasum -a 256 ./Solaris10.box.gz|cut -d" " -f1`
if [ "$CKSUM" = "0879215f4bf03f5e125addb139d0b5a49a4f8a258297b765cf1f22a8a7ee3309" ]
then
echo "Checksum OK"
else
echo "Sum Bad"
exit 99;
fi
- name: Extract Solaris10.box.gz If Cache Misses
if: steps.solaris-10-cache.outputs.cache-hit != 'true'
run: gunzip Solaris10.box.gz
- name: Add Solaris 10 Box To Vagrant
run: vagrant box add --name="solaris10" ./Solaris10.box
# - name: Setup Vagrant VM
# working-directory: ansible
# run: |
# ln -sf vagrant/Vagrantfile.Solaris10 Vagrantfile
# rm -f id_rsa.pub id_rsa
# # Copy the machine's ssh key for the VMs to use, after removing prior files
# ssh-keygen -q -f $PWD/id_rsa -t rsa -N ''
# vagrant plugin install vagrant-vbguest
# vagrant up
# vagrantPORT=$(vagrant port | grep host | awk '{ print $4 }')
# rm -f playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx
# echo "[127.0.0.1]:${vagrantPORT}" >> playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx
# [ ! -d $HOME/.ssh ] && mkdir $HOME/.ssh && chmod 700 $HOME/.ssh
# [ ! -r $HOME/.ssh/known_hosts ] && touch $HOME/.ssh/known_hosts && chmod 644 $HOME/.ssh/known_hosts
# [ ! -d $HOME/.ansible ] && mkdir $HOME/.ansible
# ssh-keygen -R $(cat playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx)
# sed -i -e "s/.*hosts:.*/ hosts: all/g" playbooks/AdoptOpenJDK_Unix_Playbook/main.yml
# awk '{print}/^\[defaults\]$/{print "private_key_file = id_rsa"; print "timeout = 60"; print "remote_tmp = $HOME/.ansible/tmp"}' < ansible.cfg > ansible.cfg.tmp && mv ansible.cfg.tmp ansible.cfg
#
# - name: Run Ansible Playbook
# working-directory: ansible
# run: ansible-playbook -i playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx --ssh-common-args='-o HostKeyAlgorithms=ssh-rsa,ssh-dss,ecdsa-sha2-nistp256,ssh-ed25519 -o PubKeyAcceptedKeyTypes=ssh-rsa' -u vagrant -b --skip-tags adoptopenjdk,cups playbooks/AdoptOpenJDK_Unix_Playbook/main.yml
- name: Setup Vagrant VM
run: |
cd ansible
ln -sf vagrant/Vagrantfile.Solaris10 Vagrantfile
rm -f id_rsa.pub id_rsa
# Copy the machine's ssh key for the VMs to use, after removing prior files
ssh-keygen -q -f $PWD/id_rsa -t rsa -N ''
vagrant up --provider=virtualbox
vagrantPORT=$(vagrant port | grep host | awk '{ print $4 }')
rm -f playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx
echo "[127.0.0.1]:${vagrantPORT}" >> playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx
[ ! -r $HOME/.ssh/known_hosts ] && touch $HOME/.ssh/known_hosts && chmod 644 $HOME/.ssh/known_hosts
ssh-keygen -R $(cat playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx)
sed -i -e "s/.*hosts:.*/- hosts: all/g" playbooks/AdoptOpenJDK_Unix_Playbook/main.yml
awk '{print}/^\[defaults\]$/{print "private_key_file = id_rsa"; print "timeout = 60"; print "remote_tmp = $HOME/.ansible/tmp"}' < ansible.cfg > ansible.cfg.tmp && mv ansible.cfg.tmp ansible.cfg
- name: Run Ansible Playbook
run: |
cd ansible
ansible-playbook -i playbooks/AdoptOpenJDK_Unix_Playbook/hosts.unx -u vagrant -b --skip-tags adoptopenjdk,cups playbooks/AdoptOpenJDK_Unix_Playbook/main.yml