Skip to content

Commit e87072b

Browse files
committed
docker: add action to deploy windows build image
1 parent 6105af8 commit e87072b

File tree

11 files changed

+81
-32
lines changed

11 files changed

+81
-32
lines changed

.github/workflows/build.yml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,11 @@ on:
1616
branches:
1717
- master
1818

19+
# Cancel existing runs if user makes another push.
20+
concurrency:
21+
group: ${{ github.workflow }}-${{ github.ref }}
22+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
23+
1924
permissions:
2025
contents: read
2126

.github/workflows/build_vagrant.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ on:
1010

1111
# Cancel existing runs if user makes another push.
1212
concurrency:
13-
group: "${{ github.ref }}"
13+
group: ${{ github.workflow }}-${{ github.ref }}
1414
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1515

1616
permissions:
Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Docker (Windows)
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- .github/workflows/build_windows.yml
7+
- ansible/docker/Dockerfile.win2022
8+
branches:
9+
- master
10+
push:
11+
paths:
12+
- .github/workflows/build_windows.yml
13+
- ansible/docker/Dockerfile.win2022
14+
branches:
15+
- master
16+
17+
# Cancel existing runs if user makes another push.
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.ref }}
20+
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
21+
22+
permissions:
23+
id-token: write
24+
contents: read
25+
26+
jobs:
27+
build:
28+
if: startsWith(github.repository, 'adoptium/')
29+
runs-on: windows-latest
30+
steps:
31+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7
32+
33+
- name: Login to our Azure subscription
34+
if: github.ref == 'refs/heads/master'
35+
uses: azure/login@a65d910e8af852a8061c627c456678983e180302 # v2.2.0
36+
with:
37+
client-id: ${{ secrets.AZURE_CLIENT_ID_OIDC }}
38+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
39+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
40+
41+
- name: Build container image
42+
run: docker build -t adoptium.azurecr.io/windows2022_build_image:latest -f ansible/docker/Dockerfile.win2022 .
43+
44+
- name: Push container image to ACR
45+
if: github.ref == 'refs/heads/master'
46+
run: |
47+
az acr login --name adoptium
48+
docker push adoptium.azurecr.io/windows2022_build_image:latest

.github/workflows/build_wsl.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ on:
1414

1515
# Cancel existing runs if user makes another push.
1616
concurrency:
17-
group: "${{ github.ref }}"
17+
group: ${{ github.workflow }}-${{ github.ref }}
1818
cancel-in-progress: ${{ github.event_name == 'pull_request' }}
1919

2020
permissions:

FAQ.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -89,7 +89,7 @@ have at the moment:
8989
| [Centos6](./ansible/docker/Dockerfile.CentOS6) | [`adoptopenjdk/centos6_build_image`](https://hub.docker.com/r/adoptopenjdk/centos6_build_image)| linux/amd64 | [GH Actions](.github/workflows/build.yml) | Yes
9090
| [Alpine3](./ansible/docker/Dockerfile.Alpine3) | [`adoptopenjdk/alpine3_build_image`](https://hub.docker.com/r/adoptopenjdk/alpine3_build_image) | linux/x64 & linux/arm64 | [Jenkins](https://ci.adoptium.net/job/centos7_docker_image_updater/) | Yes
9191
| [Ubuntu 20.04 (riscv64 only)](./ansible/docker/Dockerfile.Ubuntu2004-riscv64) | [`adoptopenjdk/ubuntu2004_build_image:linux-riscv64`](https://hub.docker.com/r/adoptopenjdk/ubuntu2004_build_image) | linux/riscv64 | [Jenkins](https://ci.adoptium.net/job/centos7_docker_image_updater/) | Yes
92-
| [Windows Server 2022](./ansible/docker/Dockerfile.win2022) | n/a - restricted | Windows | No
92+
| [Windows Server 2022](./ansible/docker/Dockerfile.win2022) | `adoptium.azurecr.io/windows2022_build_image` - restricted | Windows | [GH Actions](.github/workflows/build_windows.yml) | Yes
9393

9494
<details>
9595
<summary>(*) - Caveats:</summary>

ansible/docker/Dockerfile.win2022

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,10 @@ RUN powershell -Command \
1616
Write-Host 'Checksum verification succeeded!' -ForegroundColor Green; \
1717
}"
1818

19-
# Set up cygwin with git and ansible as a bootstrap, and add to system default path
20-
RUN setup-x86_64.exe --packages git,ansible --download --local-install --delete-orphans --site https://mirrors.kernel.org/sourceware/cygwin --local-package-dir c:\cygwin_packages --root C:\cygwin64 --wait --quiet-mode & \
21-
C:\cygwin64\bin\git config --system core.autocrlf false & \
22-
del setup-x86_64.exe & \
23-
setx PATH "c:\cygwin64\bin;%PATH%" & \
19+
# Set up cygwin with ansible as a bootstrap, and add to system default path
20+
RUN setup-x86_64.exe --packages ansible --download --local-install --delete-orphans --site https://mirrors.kernel.org/sourceware/cygwin --local-package-dir c:\cygwin_packages --root C:\cygwin64 --wait --quiet-mode && \
21+
del setup-x86_64.exe && \
22+
setx PATH "c:\cygwin64\bin;%PATH%" && \
2423
mkdir c:\temp
2524

2625
# Download Ansible Config Script & Verify Its Checksum
@@ -45,13 +44,14 @@ RUN PowerShell .\ConfigureRemotingForAnsible.ps1 -CertValidityDays 9999 & \
4544
# Set up WinRM user, clone and run the playbook, then delete the user so it's not in any layer
4645
ENV TERM=dumb
4746

48-
RUN net user ansible %PW% /ADD & net localgroup "Administrators" ansible /ADD & net localgroup "Remote Management Users" ansible /ADD & \
49-
C:\cygwin64\bin\git clone https://github.com/sxa/infrastructure -b windows_docker_support c:/infrastructure & \
50-
sed -i -e 's/hosts: .*/hosts: localhost/' infrastructure/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml & \
51-
echo localhost ansible_connection=winrm > infrastructure/ansible/hosts & \
52-
cd infrastructure\ansible & \
47+
COPY . infrastructure
48+
49+
RUN net user ansible %PW% /ADD & net localgroup "Administrators" ansible /ADD & net localgroup "Remote Management Users" ansible /ADD && \
50+
sed -i -e 's/hosts: .*/hosts: localhost/' infrastructure/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml && \
51+
echo localhost ansible_connection=winrm > infrastructure/ansible/hosts && \
52+
cd infrastructure\ansible && \
5353
C:\cygwin64\bin\python3.7m.exe /usr/bin/ansible-playbook -e git_sha=00000000 -e ansible_user=ansible -e ansible_password=%PW% -i hosts \
54-
--skip-tags=adoptopenjdk,reboot,NTP_TIME,MSVS_2013,MSVS_2017,MSVS_2019 playbooks/AdoptOpenJDK_Windows_Playbook/main.yml & \
54+
--skip-tags=adoptopenjdk,reboot,Windows_Updates,NTP_TIME,MSVS_2013,MSVS_2017,MSVS_2019,NVidia_Cuda_Toolkit,clang_64bit,clang_32bit,nasm,Rust,IcedTea-Web playbooks/AdoptOpenJDK_Windows_Playbook/main.yml && \
5555
net user ansible /DELETE
5656

5757
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"]

ansible/inventory.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,6 @@ hosts:
1515
ubuntu2204-x64-1: {ip: 172.187.163.163, user: adoptopenjdk, description: infra-wazuh-server}
1616
ubuntu2204-x64-2: {ip: 20.90.182.165, description: trss.adoptium.net}
1717
ubuntu2204-x64-3: {ip: 172.187.93.97, description: awx.adoptium.net}
18-
ubuntu2204-vagrant-x64-1: {ip: 172.203.178.157, description: VPC-Qemu-1}
19-
ubuntu2204-vagrant-x64-2: {ip: 48.217.96.46, description: VPC-Qemu-2}
2018

2119
- digitalocean:
2220
ubuntu2004-x64-1: {ip: 178.62.115.224, description: bastillion.adoptopenjdk.net}

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/ANT/tasks/main.yml

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -64,12 +64,7 @@
6464
tags: ANT
6565

6666
- name: Download ant-contrib
67-
win_get_url:
68-
url: https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip
69-
dest: c:\temp\ant-contrib.zip
70-
force: no
71-
checksum: 22bae6c3ddf1a464b285784599eef8698f64dde24378c77e42522a536b88cbbc
72-
checksum_algorithm: sha256
67+
win_shell: c:\cygwin64\bin\curl -L -o /cygdrive/c/temp/ant-contrib.zip https://sourceforge.net/projects/ant-contrib/files/ant-contrib/ant-contrib-1.0b2/ant-contrib-1.0b2-bin.zip
7368
when: (not ant_contrib_installed.stat.exists)
7469
tags: ANT
7570

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/Incredibuild/tasks/main.yml

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,19 @@
33
# Incredibuild - Configuration Tasks #
44
#######################################
55

6-
- name: Check if the ibxbuild service exists
7-
ansible.windows.win_service_info:
8-
name: IBXDashboard
6+
- name: Check if the IBXDashboard service exists
7+
win_shell: |
8+
if (Get-Service -Name 'IBXDashboard' -ErrorAction SilentlyContinue) {
9+
Write-Host "exists"
10+
}
911
register: service_info
12+
changed_when: false
1013

1114
- name: Stop the IBX Dashboard service if it exists
12-
ansible.windows.win_service:
15+
win_service:
1316
name: IBXDashboard
1417
state: stopped
15-
when: service_info.exists
18+
when: "'exists' in service_info.stdout"
1619

1720
- name: Check if incredibuild.conf file exists
1821
win_stat:
@@ -28,7 +31,7 @@
2831
when: incredibuild_conf_file.stat.exists
2932

3033
- name: Start the IBX Dashboard service if it exists
31-
ansible.windows.win_service:
34+
win_service:
3235
name: IBXDashboard
3336
state: started
34-
when: service_info.exists
37+
when: "'exists' in service_info.stdout"

ansible/playbooks/AdoptOpenJDK_Windows_Playbook/roles/MSVS_2022/tasks/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,7 @@
100100

101101
# Download & Install VS2022 When No Layout & Not AdoptOpenJDK
102102
# This is the target that you're redirected to when you go to https://aka.ms/vs/17/release/vs_community.exe
103-
- name: Download Visual Studio Community 2022
103+
- name: Download Visual Studio Build Tools 2022
104104
win_get_url:
105105
# https://learn.microsoft.com/en-us/visualstudio/releases/2022/release-history
106106
# 17.7.34302.85 url: 'https://download.visualstudio.microsoft.com/download/pr/47b236ad-5505-4752-9d2b-5cf9795528bc/87684889f46dec53d1452f4a0ff9fec1ac202a97ebed866718d7c0269e814b28/vs_BuildTools.exe'

0 commit comments

Comments
 (0)