-
-
Notifications
You must be signed in to change notification settings - Fork 102
83 lines (71 loc) · 3.05 KB
/
build_wsl.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
name: Windows Playbook Checker
defaults:
run:
shell: wsl-bash {0}
on:
pull_request:
paths:
- .github/workflows/build_wsl.yml
- ansible/playbooks/AdoptOpenJDK_Windows_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-wsl:
strategy:
fail-fast: false
matrix:
os: [windows-2019, windows-2022]
name: Windows
runs-on: ${{ matrix.os }}
steps:
test
- name: Setup WinRM and Password (checksum verified)
shell: powershell
run: |
Set-LocalUser -Name "runneradmin" -Password (ConvertTo-SecureString -AsPlainText "Ansible_password123!" -Force)
New-NetFirewallRule -DisplayName "ALLOW TCP PORT 5986" -Direction inbound -Profile Any -Action Allow -LocalPort 5986 -Protocol TCP
Invoke-WebRequest https://raw.githubusercontent.com/ansible/ansible-documentation/devel/examples/scripts/ConfigureRemotingForAnsible.ps1 -OutFile .\ConfigureRemotingForAnsible.ps1
$expectedChecksum = "EBA72DF06E3E77709595F75D1D5B4D95B06602429DD2A3F7867406DF875B0C70"
$actualChecksum = Get-FileHash -Path ".\ConfigureRemotingForAnsible.ps1" -Algorithm SHA256 | Select-Object -ExpandProperty Hash
if ($actualChecksum -ne $expectedChecksum) {
Write-Output "Checksum mismatch"
Write-Output "Actual Checksum: $actualChecksum"
Write-Output "Expect Checksum: $expectedChecksum"
exit 1
} else {
.\ConfigureRemotingForAnsible.ps1 -CertValidityDays 9999
.\ConfigureRemotingForAnsible.ps1 -EnableCredSSP
.\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert
.\ConfigureRemotingForAnsible.ps1 -SkipNetworkProfileCheck
}
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
- uses: Vampire/setup-wsl@6f87de3102a29ac6b92800f33bf1e8d9164ac0a1 # v3.1.1
- name: Install dependencies
run: |
sudo apt-get update
sudo apt install -y ansible
- name: Setup Hosts file
working-directory: ansible
run: |
rm -f playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win
cat <<EOF > playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win
[windows]
127.0.0.1
[windows:vars]
ansible_user=runneradmin
ansible_password=Ansible_password123!
ansible_become=false
EOF
sed -i -e "s/.*hosts:.*/ hosts: all/g" playbooks/AdoptOpenJDK_Windows_Playbook/main.yml
- name: Run Ansible Playbook
working-directory: ansible
run: |
export ANSIBLE_CONFIG=./ansible.cfg
# Skip MSVS_2013 until https://github.com/adoptium/infrastructure/issues/2178 is fixed
ansible-playbook -i playbooks/AdoptOpenJDK_Windows_Playbook/hosts.win --extra-vars 'git_sha=${{ github.sha }}' -b --skip-tags adoptopenjdk,jenkins,MSVS_2013,reboot playbooks/AdoptOpenJDK_Windows_Playbook/main.yml