Last active
May 21, 2025 19:18
-
-
Save mschuchard/913cee96700bbdc6603315bdcfe30604 to your computer and use it in GitHub Desktop.
provisioner
This file contains hidden or 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
| ### system configuration | |
| # create temp directory, set universal permissions, and change shell into it | |
| New-Item -Path 'C:\' -Name 'temp' -ItemType 'Directory' | |
| cmd.exe /c 'icacls C:\Temp /grant Everyone:F' | |
| Set-Location -Path 'C:\temp' | |
| New-Item -Path 'C:\' -Name 'bitbucket-pipelines-runner' -ItemType 'Directory' | |
| # allow unsigned ps scripts (necessary for runner scripts) | |
| Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser -Force | |
| # modify registry for long filesystem paths | |
| New-ItemProperty -Path 'HKLM:\SYSTEM\CurrentControlSet\Control\FileSystem' -Name 'LongPathsEnabled' -Value 1 -PropertyType DWORD -Force | |
| ### dependency installations | |
| # download, install, and configure openjdk11 | |
| Invoke-WebRequest -Uri https://aka.ms/download-jdk/microsoft-jdk-11.0.27-windows-x64.msi -Outfile ms-jdk-11.msi | |
| Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i ms-jdk-11.msi ADDLOCAL=FeatureMain,FeatureEnvironment,FeatureJarFileRunWith,FeatureJavaHome INSTALLDIR="c:\Program Files\Microsoft\" /qn' -Wait | |
| # download and install git and git lfs | |
| Invoke-WebRequest -Uri https://github.com/git-for-windows/git/releases/download/v2.49.0.windows.1/Git-2.49.0-64-bit.exe -OutFile git.exe | |
| Start-Process -FilePath 'git.exe' -ArgumentList '/SP- /VERYSILENT /SUPPRESSMSGBOXES /NOCANCEL /NORESTART /CLOSEAPPLICATIONS /RESTARTAPPLICATIONS' -Wait | |
| # download and install python 2.7 | |
| Invoke-WebRequest -Uri https://www.python.org/ftp/python/2.7.18/python-2.7.18.amd64.msi -OutFile python-2.7.msi | |
| Start-Process -FilePath 'msiexec.exe' -ArgumentList '/i python-2.7.msi /qn' -Wait | |
| # download and install the msvs build tools bootstrapper TODO: should this be 2015 instead? | |
| Invoke-WebRequest -Uri https://aka.ms/vs/17/release/vs_buildtools.exe -Outfile vs_buildtools.exe | |
| cmd.exe /c '(start /w vs_buildtools.exe --wait --norestart --quiet --nocache --installPath "%ProgramFiles(x86)%\Microsoft Visual Studio\2022\BuildTools" --add Microsoft.VisualStudio.Workload.VCTools --includeRecommended --add Microsoft.VisualStudio.Component.VC.140 || IF "%ERRORLEVEL%"=="3010" EXIT 0)' | |
| # download and unzip the bitbucker pipeline runner | |
| Invoke-WebRequest -Uri https://product-downloads.atlassian.com/software/bitbucket/pipelines/atlassian-bitbucket-pipelines-runner-3.23.0.zip -OutFile C:\temp\atlassian-bitbucket-pipelines-runner.zip | |
| Expand-Archive -LiteralPath 'C:\temp\atlassian-bitbucket-pipelines-runner.zip' -DestinationPath 'C:\bitbucket-pipelines-runner' | |
| # installer cleanup | |
| Remove-Item -Path C:\temp\*.zip | |
| Remove-Item -Path C:\temp\*.msi | |
| Remove-Item -Path C:\temp\*.exe | |
| # launch the bitbucket pipelines runner (persistent service-like process) | |
| Start-Process -FilePath 'java' -ArgumentList '-jar -Dbitbucket.pipelines.runner.account.uuid={125d7879-b3b4-4d0b-9075-48aa179e4716} -Dbitbucket.pipelines.runner.repository.uuid={c8053ed8-1b81-4775-86a5-9c92a02be5b3} -Dbitbucket.pipelines.runner.uuid={892d9a7f-5cdd-549a-a84c-5fc266145403} -Dbitbucket.pipelines.runner.environment=PRODUCTION -Dbitbucket.pipelines.runner.oauth.client.id=VTSOx0ugJ1ABF9J3QOGCrWbFjdezN5iR -Dbitbucket.pipelines.runner.oauth.client.secret=ATOA50peGCDfZ7Qz0wXrropKqR56EBh69GYh8Dhmt-Xn-E-_djtoMCfJx_AJkcAE_ofs42492263 -Dbitbucket.pipelines.runner.directory.working=C:\temp -Dbitbucket.pipelines.runner.runtime=windows-powershell -Dbitbucket.pipelines.runner.scheduled.state.update.initial.delay.seconds=0 -Dbitbucket.pipelines.runner.scheduled.state.update.period.seconds=30 -Dbitbucket.pipelines.runner.cleanup.previous.folders=false -Dbitbucket.pipelines.runner.secret.provider.uri= -Dlogback.configurationFile=logback.xml -Dfile.encoding=UTF-8 -Dsun.jnu.encoding=UTF-8 C:\bitbucket-pipelines-runner\bin\runner.jar' -NoNewWindow -Wait | |
| # TODO: java env vars set during installation are not available here until shell restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment