Skip to content
This repository has been archived by the owner on Feb 13, 2024. It is now read-only.

Commit

Permalink
Merge pull request #5 from OctopusDeployLabs/mh/win2022
Browse files Browse the repository at this point in the history
Add Windows 2022 support
  • Loading branch information
harrisonmeister authored Sep 26, 2023
2 parents 3ac4050 + 6d11316 commit 14d9691
Show file tree
Hide file tree
Showing 3 changed files with 154 additions and 49 deletions.
157 changes: 111 additions & 46 deletions .github/workflows/docker-build-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ jobs:
outputs:
VERSION: ${{ steps.step1.outputs.VERSION }}
CONTINUE: ${{ steps.step1.outputs.Continue }}
WIN2019_VERSION: ${{ steps.step1.outputs.WIN2019_VERSION }}
WIN2022_VERSION: ${{ steps.step1.outputs.WIN2022_VERSION }}
steps:
- uses: actions/checkout@v3
- id: step1
Expand Down Expand Up @@ -67,94 +69,137 @@ jobs:
{
Write-Output "We need to upgrade the container to $versionToCompare"
echo "CONTINUE=Yes" >> $env:GITHUB_OUTPUT
}
}
Write-Host "Getting OS versions for windows 2022 and 2019"
$win2019_manifest = (docker manifest inspect --verbose "octopuslabs/workertools:latest-windows.2019" | ConvertFrom-Json)
$WIN2019_VERSION = $win2019_manifest.Descriptor.Platform.'os.version'
Write-Host "WIN2019_VERSION: $WIN2019_VERSION"
$win2022_manifest = (docker manifest inspect --verbose "octopuslabs/workertools:latest-windows.2022" | ConvertFrom-Json)
$WIN2022_VERSION = $win2022_manifest.Descriptor.Platform.'os.version'
Write-Host "WIN2022_VERSION: $WIN2022_VERSION"
if([string]::IsNullOrWhiteSpace($WIN2019_VERSION) -or [string]::IsNullOrWhiteSpace($WIN2022_VERSION)) {
throw "Could not establish OS versions for windows 2022 and 2019 needed for docker manifest"
}
echo "WIN2019_VERSION=$WIN2019_VERSION" >> $env:GITHUB_OUTPUT
echo "WIN2022_VERSION=$WIN2022_VERSION" >> $env:GITHUB_OUTPUT
shell: powershell

build-win-2019:
build-ubuntu:
needs: [get-version-number]
runs-on: windows-2019
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3

- name: DockerHub Login
env:
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
run: docker login --username ${env:USERNAME} --password "${env:PASSWORD}"
run: docker login --username $USERNAME --password "$PASSWORD"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build the win2019 Docker image
- name: Build the ubuntu.2004 image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}
run: docker build ./windows-2019 --build-arg GOOGLE_CLOUD_CLI_VERSION=${env:GOOGLE_CLOUD_CLI_VERSION} --tag octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2019 --tag octopuslabs/gcp-workertools:latest-windows.2019
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}-0
run: docker build ./ubuntu-2004 --build-arg GOOGLE_CLOUD_CLI_VERSION=$GOOGLE_CLOUD_CLI_VERSION --tag octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2004 --tag octopuslabs/gcp-workertools:latest-ubuntu.2004
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the win2019 version image
- name: Push the ubuntu.2004 version-specific image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2019
run: docker push octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2004
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the win2019 latest image
- name: Push the ubuntu.2004 latest image
run: docker push octopuslabs/gcp-workertools:latest-ubuntu.2004
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build the ubuntu.2204 image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:latest-windows.2019
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}-0
run: docker build ./ubuntu-2204 --build-arg GOOGLE_CLOUD_CLI_VERSION=$GOOGLE_CLOUD_CLI_VERSION --tag octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2204 --tag octopuslabs/gcp-workertools:latest-ubuntu.2204
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the ubuntu.2204 version-specific image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2204
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the ubuntu.2204 latest image
run: docker push octopuslabs/gcp-workertools:latest-ubuntu.2204
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

build-ubuntu:
build-win-2019:
needs: [get-version-number]
runs-on: ubuntu-latest
runs-on: windows-2019

steps:
- uses: actions/checkout@v3

- uses: actions/checkout@v3
- name: DockerHub Login
env:
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
run: docker login --username $USERNAME --password "$PASSWORD"
run: docker login --username ${env:USERNAME} --password "${env:PASSWORD}"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build the ubuntu.2004 Docker image
- name: Build the win2019 image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}-0
run: docker build ./ubuntu-2004 --build-arg GOOGLE_CLOUD_CLI_VERSION=$GOOGLE_CLOUD_CLI_VERSION --tag octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2004 --tag octopuslabs/gcp-workertools:latest-ubuntu.2004
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}
run: docker build ./windows-2019 --build-arg GOOGLE_CLOUD_CLI_VERSION=${env:GOOGLE_CLOUD_CLI_VERSION} --tag octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2019 --tag octopuslabs/gcp-workertools:latest-windows.2019
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the ubuntu.2004 version image
- name: Push the win2019 version-specific image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2004
run: docker push octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2019
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the latest ubuntu.2004 image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:latest-ubuntu.2004
- name: Push the win2019 latest image
run: docker push octopuslabs/gcp-workertools:latest-windows.2019
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build the ubuntu.2204 Docker image
build-win-2022:
needs: [get-version-number]
runs-on: windows-2022

steps:
- uses: actions/checkout@v3

- name: DockerHub Login
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}-0
run: docker build ./ubuntu-2204 --build-arg GOOGLE_CLOUD_CLI_VERSION=$GOOGLE_CLOUD_CLI_VERSION --tag octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2204 --tag octopuslabs/gcp-workertools:latest-ubuntu.2204
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
run: docker login --username ${env:USERNAME} --password "${env:PASSWORD}"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}
- name: Push the ubuntu.2204 version image

- name: Build the win2022 image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2204
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
GOOGLE_CLOUD_CLI_VERSION: ${{ needs.get-version-number.outputs.VERSION }}
run: docker build ./windows-2022 --build-arg GOOGLE_CLOUD_CLI_VERSION=${env:GOOGLE_CLOUD_CLI_VERSION} --tag octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2022 --tag octopuslabs/gcp-workertools:latest-windows.2022
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the latest ubuntu.2204 image
- name: Push the win2022 version-specific image
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker push octopuslabs/gcp-workertools:latest-ubuntu.2204
run: docker push octopuslabs/gcp-workertools:${env:VERSION_NUMBER}-windows.2022
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push the win2022 latest image
run: docker push octopuslabs/gcp-workertools:latest-windows.2022
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

build-docker-manifest:
needs: [get-version-number, build-ubuntu, build-win-2019]
needs: [get-version-number, build-ubuntu, build-win-2019, build-win-2022]
runs-on: ubuntu-latest

steps:
Expand All @@ -163,22 +208,42 @@ jobs:
USERNAME: ${{ secrets.DOCKER_HUB_USER }}
PASSWORD: ${{ secrets.DOCKER_HUB_PAT }}
run: docker login --username $USERNAME --password "$PASSWORD"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build latest version Manifest
run: docker manifest create octopuslabs/gcp-workertools:latest octopuslabs/gcp-workertools:latest-windows.2019 octopuslabs/gcp-workertools:latest-ubuntu.2004
- name: Create docker manifest for latest tag
run: docker manifest create octopuslabs/gcp-workertools:latest octopuslabs/gcp-workertools:latest-windows.2019 octopuslabs/gcp-workertools:latest-windows.2022 octopuslabs/gcp-workertools:latest-ubuntu.2204
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Annotate docker manifest for latest tag
env:
WIN2019_VERSION: ${{ needs.get-version-number.outputs.WIN2019_VERSION }}
WIN2022_VERSION: ${{ needs.get-version-number.outputs.WIN2022_VERSION }}
run: |
docker manifest annotate --os "windows" --os-version "$WIN2019_VERSION" --arch "amd64" "octopuslabs/gcp-workertools:latest" "octopuslabs/gcp-workertools:latest-windows.2019" && \
docker manifest annotate --os "windows" --os-version "$WIN2022_VERSION" --arch "amd64" "octopuslabs/gcp-workertools:latest" "octopuslabs/gcp-workertools:latest-windows.2022"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push latest version Manifest
- name: Push docker manifest for latest tag
run: docker manifest push octopuslabs/gcp-workertools:latest
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Build specific version Manifest
- name: Create docker manifest for version-specific tag
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker manifest create octopuslabs/gcp-workertools:$VERSION_NUMBER octopuslabs/gcp-workertools:$VERSION_NUMBER-windows.2019 octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2004
run: docker manifest create octopuslabs/gcp-workertools:$VERSION_NUMBER octopuslabs/gcp-workertools:$VERSION_NUMBER-windows.2019 octopuslabs/gcp-workertools:$VERSION_NUMBER-windows.2022 octopuslabs/gcp-workertools:$VERSION_NUMBER-ubuntu.2204
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Annotate docker manifest for version-specific tag
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
WIN2019_VERSION: ${{ needs.get-version-number.outputs.WIN2019_VERSION }}
WIN2022_VERSION: ${{ needs.get-version-number.outputs.WIN2022_VERSION }}
run: |
docker manifest annotate --os "windows" --os-version "$WIN2019_VERSION" --arch "amd64" "octopuslabs/gcp-workertools:$VERSION_NUMBER" "octopuslabs/gcp-workertools:$VERSION_NUMBER-windows.2019" && \
docker manifest annotate --os "windows" --os-version "$WIN2022_VERSION" --arch "amd64" "octopuslabs/gcp-workertools:$VERSION_NUMBER" "octopuslabs/gcp-workertools:$VERSION_NUMBER-windows.2022"
if: ${{ needs.get-version-number.outputs.CONTINUE == 'Yes' }}

- name: Push specific version Manifest
- name: Push docker manifest for version-specific tag
env:
VERSION_NUMBER: ${{ needs.get-version-number.outputs.VERSION }}
run: docker manifest push octopuslabs/gcp-workertools:$VERSION_NUMBER
Expand Down
18 changes: 15 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,21 @@ This repository contains images that contain the tooling necessary to to use the
The following images are built in this repo:

- Ubuntu 22.04
- Ubuntu 20.04 (tagged `latest` in [DockerHub](https://hub.docker.com/r/octopuslabs/gcp-workertools/tags?page=1&name=latest))
- Windows 2019 (tagged `latest` in [DockerHub](https://hub.docker.com/r/octopuslabs/gcp-workertools/tags?page=1&name=latest))
- Ubuntu 20.04
- Windows 2022
- Windows 2019

A new image will be built each time a new version of the GCloud CLI is released. The version numbers will be based on the version of the GCloud CLI.

**Please consider this repository provided as is. If there are any issues please do not contact support.**
## Deprecated tags

Over time, certain tags will be deprecated, usually according to their mainstream support end date. New versions for any matching images will stop being maintained and pushed based on the end date shown.

Tag | End date
---------| ---------------
`windows.2019`| [Jan 9th, 2024](https://learn.microsoft.com/en-us/lifecycle/products/windows-server-2019)

## Support

Please consider this repository provided as is. If there are any issues please do not contact support.

28 changes: 28 additions & 0 deletions windows-2022/Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# escape=`

FROM octopuslabs/workertools:latest-windows.2022
SHELL ["powershell", "-Command"]

ARG GOOGLE_CLOUD_CLI_VERSION=433.0.0

# Install Terraform
RUN choco install terraform -y --no-progress

# Install gcloud
RUN $GCLOUD_VERSION = $env:GOOGLE_CLOUD_CLI_VERSION; `
Write-Host "GCLOUD_VERSION: ${env:GOOGLE_CLOUD_CLI_VERSION}"; `
Write-Host "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${env:GOOGLE_CLOUD_CLI_VERSION}-windows-x86_64.zip"; `
Invoke-WebRequest "https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${env:GOOGLE_CLOUD_CLI_VERSION}-windows-x86_64.zip" -OutFile google-cloud-sdk-$env:GOOGLE_CLOUD_CLI_VERSION-windows-x86_64.zip; `
& '.\Program Files\7-Zip\7z.exe' x .\google-cloud-sdk-$env:GOOGLE_CLOUD_CLI_VERSION-windows-x86_64.zip; `
.\google-cloud-sdk\install.bat --quiet; `
rm .\google-cloud-sdk-$env:GOOGLE_CLOUD_CLI_VERSION-windows-x86_64.zip

# Update Path
RUN $old = (Get-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path).path; `
Write-Host $old; `
$gcloudPath = ';C:\google-cloud-sdk\bin'; `
$new = $old + $gcloudPath; `
Write-Host $new; `
Set-ItemProperty -Path 'Registry::HKEY_LOCAL_MACHINE\System\CurrentControlSet\Control\Session Manager\Environment' -Name path -Value $new; `
Import-Module $env:ChocolateyInstall\helpers\chocolateyProfile.psm1; `
refreshenv

0 comments on commit 14d9691

Please sign in to comment.