-
-
Notifications
You must be signed in to change notification settings - Fork 102
66 lines (58 loc) · 2.38 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
name: Vagrant Playbook Checker
on:
pull_request:
paths:
- .github/workflows/build_vagrant.yml
- ansible/playbooks/AdoptOpenJDK_Unix_Playbook/**
branches:
- master
permissions:
contents: read
jobs:
build-solaris:
name: Solaris
runs-on: macos-12
steps:
- uses: actions/checkout@93ea575cb5d8a053eaa0ac8fa3b40d7e05a33cc8 # v3.1.0
- name: Install dependencies
run: |
brew install ansible
- name: Install Solaris 10 Box If Not Already Present
run: |
if [ `vagrant box list|grep ^solaris10|wc -l` -gt 0 ]
then
echo "Box Exists - Do Nothing"
else
echo "No Box - Download From Jenkins And Import"
wget https://ci.adoptium.net/userContent/vagrant/Solaris10.box.gz
CKSUM=`shasum -a 256 ./Solaris10.box.gz|cut -d" " -f1`
if [ "$CKSUM" = "0879215f4bf03f5e125addb139d0b5a49a4f8a258297b765cf1f22a8a7ee3309" ]
then
echo "Checksum OK"
gunzip Solaris10.box.gz
vagrant box add --name="solaris10" ./Solaris10.box
rm Solaris10.box
else
echo "Sum Bad"
exit 99;
fi
fi
- 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
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