Questions about migrating Jenkins to Azure pipeline:
My .net project building requires VS buildtool 2017, Windows SDK and WDK installed. If I use agent pool (MS hosted VM) to build project, are WDK and SDK of required version available in the agent pool (Hosted VM like vs2017-win2016)?
If hosted agent cannot do that, how can I build a Win container for Azure pipeling container job, whch is similar to below jenkins agent container, Is there any dockefile example available? thanks?
Dockerfile for jenkins windows agent:
FROM openjdk:8-jdk-windowsservercore-1809
ARG version
ENV VERSION ${version:-3.39}
ENV JENKINS_HOME="c:/jenkins"
ENV JENKINS_REMOTING_ENTRY_POINT="${JENKINS_HOME}/agent.jar"
ENV JENKINS_REMOTING_URL="https://repo.jenkins-ci.org/public/org/jenkins-ci/main/remoting/${VERSION}/remoting-${VERSION}.jar"
ENV SHA=AA1525E45DA5D8CFFD40B67B064C86F9F6CE8799A024EDF5D468D0DC2ABD062D
ENV JENKINS_MASTER_HOST="win-tc-docker"
ENV JENKINS_AGENT_ID="NET_00"
ENV JENKINS_AGENT_SECRET="0000000000000000000000000000000000000000000000000000000000000000"
ENV GIT_VERSION 2.25.0
ENV GIT_PATCH_VERSION 1
SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; "]
# Install Jenkins agent
RUN \
New-Item -ItemType Directory -Force -Path $env:JENKINS_HOME; \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest -Uri $env:JENKINS_REMOTING_URL -OutFile $env:JENKINS_REMOTING_ENTRY_POINT -UseBasicParsing -Proxy http://proxy.compaq.com:8080 -ProxyUseDefaultCredentials;
# if ((Get-FileHash -Path $env:JENKINS_REMOTING_ENTRY_POINT -Algorithm SHA256).Hash -ne $env:SHA) { throw 'Download hash does not match'}
# Create temp file for installers
RUN New-Item -ItemType Directory -Force -Path c:\temp;
# Install Subversion (x64) 1.13.1.28686
RUN \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest "https://osdn.net/frs/redir.php?m=xtom_hk"""&"""f=%2Fstorage%2Fg%2Ft%2Fto%2Ftortoisesvn%2F1.13.1%2FApplication%2FTortoiseSVN-1.13.1.28686-x64-svn-1.13.0.msi" -OutFile "c:/temp/TortoiseSVN.msi" -UseBasicParsing -Proxy http://proxy.compaq.com:8080 -ProxyUseDefaultCredentials; \
Start-Process -FilePath "c:/temp/TortoiseSVN.msi" -ArgumentList '/Passive', '/NoRestart' -PassThru | Wait-Process;
# Install Git
RUN \
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12 ; \
Invoke-WebRequest $('https://github.com/git-for-windows/git/releases/download/v{0}.windows.{1}/MinGit-{0}-busybox-64-bit.zip' -f $env:GIT_VERSION, $env:GIT_PATCH_VERSION) -OutFile 'mingit.zip' -UseBasicParsing ; \
Expand-Archive mingit.zip -DestinationPath c:\mingit ; \
Remove-Item mingit.zip -Force ; \
setx /M PATH $('c:\mingit\cmd;{0}' -f $env:PATH)
# Install Blend 4 SDK
RUN \
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12; \
Invoke-WebRequest "https://download.microsoft.com/download/E/0/0/E0032698-8F1F-497D-B7BD-35275E1EB6FC/BlendWPFSDK_en.msi" -OutFile "c:/temp/Blend4SDK.msi" -UseBasicParsing -Proxy http://proxy.compaq.com:8080 -ProxyUseDefaultCredentials; \
Start-Process -FilePath "c:/temp/Blend4SDK.msi" -ArgumentList '/passive', '/norestart' -PassThru | Wait-Process;
# Install Blend 4.5 SDK
COPY ./BlendSdk "c:/temp/BlendSdk"
RUN Start-Process -FilePath "c:/temp/BlendSdk/BlendWPFSDK.msi" -ArgumentList '/passive', '/norestart' -PassThru | Wait-Process;
# Install VS 2017 Build Tools
SHELL ["cmd", "/S", "/C" ]
COPY ./BuildTools2017 "c:/temp/BuildTools2017"
RUN C:\temp\BuildTools2017\vs_buildtools_2017.exe --quiet --wait --norestart --nocache --noWeb \
--add Microsoft.VisualStudio.Workload.ManagedDesktopBuildTools \
--add Microsoft.VisualStudio.Workload.VCTools \
--add Microsoft.Net.Component.3.5.DeveloperTools \
--add Microsoft.VisualStudio.Component.Windows10SDK.17763
SHELL ["powershell", "-NoProfile", "-Command", "$ErrorActionPreference = 'Stop'; $ProgressPreference = 'SilentlyContinue'; "]
# Install Visual Studio 2012 Premium
COPY ./VS2012Premium "c:/temp/VS2012Premium"
RUN Start-Process -FilePath "c:/temp/VS2012Premium/vs_premium.exe" -ArgumentList '/passive', '/q', '/s', '/norestart', '/noweb', '/full', '/ProductKey HRFXPFH366KTVG9HXXV8QM3F8' -PassThru | Wait-Process;
# Install WDK 10 1703 (Windows 10.0.15063.0)
COPY ./WDK1703 "c:/temp/WDK1703"
RUN Start-Process -FilePath "c:/temp/WDK1703/wdksetup.exe" -ArgumentList '/q', '/norestart' -PassThru | Wait-Process;
# Install WDK 10 1809 (Windows 10.0.17763.1)
COPY ./WDK1809 "c:/temp/WDK1809"
RUN Start-Process -FilePath "c:/temp/WDK1809/wdksetup.exe" -ArgumentList '/q', '/norestart' -PassThru | Wait-Process;
# Delete temp file content
RUN dir c:\temp | Remove-Item -Force -Recurse -ErrorAction SilentlyContinue;
COPY ./scripts "${JENKINS_HOME}/scripts"
#CMD powershell $env:JENKINS_HOME/scripts/startup.ps1
ENTRYPOINT ["powershell.exe", "-f", "c:/jenkins/scripts/jenkins-agent.ps1"]