forked from adoptium/infrastructure
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
winPB: Switch to VS2022 build tools and add Windows build dockerfile (a…
…doptium#3702) * winPB: Switch to VS2022 build tools and add build dockerfile + related fixes Notes: - Adds Dockerfile.win2022 which can be used to create a build image comparable to the Linux ones. This will only install VS2022, not the earlier other compilers - Various modifications to support the above including: - Adding more 'win_reboot' tags to tasks to avoid attempting to reboot while running ansible inside the container - Use of gpg2 instead of gpg since that is what the new cygwin seems to have - Since the dockerfile does a base cygwin install, the ansible cygwin role now checks for jq.exe (the most recent addition) instead before deciding whether to skip the cygwin packages - Uses a windows command instead of cygwin (which may not be in the path at that point) as the "Dummy" command in the logs role - Changes the command used for default shortname creation to one that works in containers - Uses Visual Studio Build Tools instead of the community edition (Currently will not take effect if "adoptopenjdk" is skipped but that is skipped in the new dockerfile so it takes effect there) Signed-off-by: Stewart X Addison <sxa@redhat.com> * Use ENV TERM=dumb Co-authored-by: George Adams <george.adams@microsoft.com> * Set USER to ContainerUser Signed-off-by: Stewart X Addison <sxa@redhat.com> --------- Signed-off-by: Stewart X Addison <sxa@redhat.com> Co-authored-by: George Adams <george.adams@microsoft.com>
- Loading branch information
Showing
10 changed files
with
60 additions
and
26 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
FROM mcr.microsoft.com/windows/servercore:ltsc2022 | ||
|
||
# Specify this with --build-arg PW=SomePassword | ||
ARG PW=T3mp=Passwd | ||
|
||
# Set up cygwin with git and ansible as a bootstrap, and add to system default path | ||
RUN powershell wget -UseBasicParsing https://cygwin.com/setup-x86_64.exe -OutFile setup-x86_64.exe & \ | ||
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 & \ | ||
C:\cygwin64\bin\git config --system core.autocrlf false & \ | ||
del setup-x86_64.exe & \ | ||
setx PATH "c:\cygwin64\bin;%PATH%" & \ | ||
mkdir c:\temp | ||
|
||
# Set up WinRM for the ansible connection | ||
RUN powershell wget -UseBasicParsing https://raw.githubusercontent.com/ansible/ansible/dd4c56e4d68664e4a50292aa19ea61b15c92287c/examples/scripts/ConfigureRemotingForAnsible.ps1 -OutFile ConfigureRemotingForAnsible.ps1 & \ | ||
PowerShell .\ConfigureRemotingForAnsible.ps1 -CertValidityDays 9999 & \ | ||
PowerShell .\ConfigureRemotingForAnsible.ps1 -EnableCredSSP & \ | ||
PowerShell .\ConfigureRemotingForAnsible.ps1 -ForceNewSSLCert & \ | ||
PowerShell .\ConfigureRemotingForAnsible.ps1 -SkipNetworkProfileCheck | ||
|
||
# Set up WinRM user, clone and run the playbook, then delete the user so it's not in any layer | ||
ENV TERM=dumb | ||
|
||
RUN net user ansible %PW% /ADD & net localgroup "Administrators" ansible /ADD & net localgroup "Remote Management Users" ansible /ADD & \ | ||
C:\cygwin64\bin\git clone https://github.com/sxa/infrastructure -b windows_docker_support c:/infrastructure & \ | ||
sed -i -e 's/hosts: .*/hosts: localhost/' infrastructure/ansible/playbooks/AdoptOpenJDK_Windows_Playbook/main.yml & \ | ||
echo localhost ansible_connection=winrm > infrastructure/ansible/hosts & \ | ||
cd infrastructure\ansible & \ | ||
C:\cygwin64\bin\python3.7m.exe /usr/bin/ansible-playbook -e git_sha=00000000 -e ansible_user=ansible -e ansible_password=%PW% -i hosts \ | ||
--skip-tags=adoptopenjdk,reboot,NTP_TIME,MSVS_2013,MSVS_2017,MSVS_2019 playbooks/AdoptOpenJDK_Windows_Playbook/main.yml & \ | ||
net user ansible /DELETE | ||
|
||
ENTRYPOINT ["C:\\Program Files (x86)\\Microsoft Visual Studio\\2022\\BuildTools\\Common7\\Tools\\VsDevCmd.bat", "&&", "powershell.exe", "-NoLogo", "-ExecutionPolicy", "Bypass"] | ||
USER ContainerUser |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -35,4 +35,4 @@ | |
when: | ||
- (powershell_output.stdout < '5') | ||
- hotfix_install.reboot_required | ||
tags: WMF | ||
tags: WMF,reboot |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters