From 46971c9092f115378263c39ac8a4d17be1aeeec0 Mon Sep 17 00:00:00 2001 From: cobalt-github-releaser-bot <95661244+cobalt-github-releaser-bot@users.noreply.github.com> Date: Tue, 11 Jul 2023 11:38:39 -0700 Subject: [PATCH 1/3] 23.lts.1+ cherry-pick: 6803a2d763 "Pin Choco to 1.4.0 (#525)" (#473) Refer to the original commit: https://github.com/youtube/cobalt_sandbox/commit/6803a2d7638a95201b6a2c5cc4ac67881d633bb9 Co-authored-by: Igor Sarkisov --- docker/windows/base/build/Dockerfile | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/windows/base/build/Dockerfile b/docker/windows/base/build/Dockerfile index 19aa9b6ada030..74f0f1e02da10 100644 --- a/docker/windows/base/build/Dockerfile +++ b/docker/windows/base/build/Dockerfile @@ -29,6 +29,8 @@ COPY ./spin.ps1 /spin.ps1 # of the execution, i.e. the full invocation string. COPY ./list_python_processes.py /list_python_processes.py +# Pin Choco to 1.4.0 to avoid required reboot in 2.0.0 +ENV chocolateyVersion '1.4.0' # Install deps via chocolatey. RUN iex ((New-Object System.Net.WebClient).DownloadString('https://chocolatey.org/install.ps1'));` mkdir C:\choco-cache;` From b9b14eb32744f222d558d7859486aa26e4312362 Mon Sep 17 00:00:00 2001 From: Igor Sarkisov Date: Tue, 11 Jul 2023 10:49:10 -0700 Subject: [PATCH 2/3] Win runner build for 23.lts.1+ --- .github/workflows/main_win.yaml | 5 +++++ docker/windows/runner/Dockerfile | 34 ++++++++++++++++++++++++++++++++ docker/windows/runner/runner.ps1 | 2 ++ 3 files changed, 41 insertions(+) create mode 100644 docker/windows/runner/Dockerfile create mode 100644 docker/windows/runner/runner.ps1 diff --git a/.github/workflows/main_win.yaml b/.github/workflows/main_win.yaml index 32db4b24c5b50..1d04e1a3cb6c4 100644 --- a/.github/workflows/main_win.yaml +++ b/.github/workflows/main_win.yaml @@ -115,6 +115,11 @@ jobs: uses: ./.github/actions/docker_win with: service: ${{ needs.initialize.outputs.docker_service }} + - name: Build runner docker image + id: build-runner-docker-image + uses: ./.github/actions/docker_win + with: + service: ${{ needs.initialize.outputs.docker_runner_service }} # Runs builds. build: needs: [initialize] diff --git a/docker/windows/runner/Dockerfile b/docker/windows/runner/Dockerfile new file mode 100644 index 0000000000000..a49481150bbde --- /dev/null +++ b/docker/windows/runner/Dockerfile @@ -0,0 +1,34 @@ +# Copyright 2022 The Cobalt Authors. All Rights Reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +FROM cobalt-build-win32-base + +SHELL ["powershell", "-Command", "$ErrorActionPreference = 'Stop';$ProgressPreference='silentlyContinue';"] + +ARG RUNNER_VERSION + +RUN Invoke-WebRequest -Uri 'https://aka.ms/install-powershell.ps1' -OutFile install-powershell.ps1; \ + powershell -ExecutionPolicy Unrestricted -File ./install-powershell.ps1 -AddToPath + +RUN Invoke-WebRequest -Uri https://github.com/actions/runner/releases/download/v$env:RUNNER_VERSION/actions-runner-win-x64-$env:RUNNER_VERSION.zip -OutFile runner.zip; \ + Expand-Archive -Path C:/runner.zip -DestinationPath C:/actions-runner; \ + Remove-Item -Path C:\runner.zip; \ + setx /M PATH $(${Env:PATH} + \";${Env:ProgramFiles}\Git\bin\") + +# Required for packaging artifacts. +RUN choco install -f -y 7zip --version=19.0 + +ENV TMP "C:\Users\ContainerAdministrator\AppData\Local\Temp2" + +ADD runner.ps1 C:/runner.ps1 +CMD ["pwsh", "-ExecutionPolicy", "Unrestricted", "-File", ".\\runner.ps1"] diff --git a/docker/windows/runner/runner.ps1 b/docker/windows/runner/runner.ps1 new file mode 100644 index 0000000000000..e6a798869e44a --- /dev/null +++ b/docker/windows/runner/runner.ps1 @@ -0,0 +1,2 @@ +.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --token $env:RUNNER_TOKEN --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR --labels "${RUNNER_LABELS}"; +.\actions-runner\run.cmd; From 8639fd3e5b082de5021164d382a19820df57f9bc Mon Sep 17 00:00:00 2001 From: Igor Sarkisov Date: Tue, 11 Jul 2023 12:03:54 -0700 Subject: [PATCH 3/3] Fix entrypoint --- docker/windows/runner/runner.ps1 | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/windows/runner/runner.ps1 b/docker/windows/runner/runner.ps1 index e6a798869e44a..9e96a5e581740 100644 --- a/docker/windows/runner/runner.ps1 +++ b/docker/windows/runner/runner.ps1 @@ -1,2 +1,2 @@ -.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --token $env:RUNNER_TOKEN --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR --labels "${RUNNER_LABELS}"; +.\actions-runner\config.cmd --unattended --replace --url https://github.com/${env:RUNNER_REPO} --token $env:RUNNER_TOKEN --name $env:RUNNER_NAME --work $env:RUNNER_WORKDIR --labels $env:RUNNER_LABELS; .\actions-runner\run.cmd;