Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Windows docker enhancements #794

Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 21 additions & 12 deletions .github/workflows/windows-docker-image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ on:
push:
# Will only trigger building a docker image if any of these changed
paths:
- '.github/docker/rez-win-base/**'
- '.github/docker/rez-win-py/**'
- '.github/workflows/windows-docker-image.yaml'
- '.github/docker/rez-win-base/**'
- '.github/docker/rez-win-py/**'
- '.github/workflows/windows-docker-image.yaml'

jobs:

Expand All @@ -51,13 +51,14 @@ jobs:
run: |
${Env:LAST_DOCKER_BASE_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
${gh_user} = ("${{ github.repository }}" -Split '/')[0]
$ErrorActionPreference = "Continue"
docker manifest inspect ${gh_user}/rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION} | Out-Null
if (-not $?) {
$ErrorActionPreference = "Stop"
if ($LastExitCode -ne 0) {
cd .github\docker\rez-win-base
docker build --tag ${gh_user}/rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION} .
docker push ${gh_user}/rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION}
}

env:
DOCKER_CLI_EXPERIMENTAL: enabled

Expand Down Expand Up @@ -92,12 +93,20 @@ jobs:
docker pull ${gh_user}/rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION}
docker tag ${gh_user}/rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION} rez-win-base:${ENV:LAST_DOCKER_BASE_REVISION}

- name: Build and push Docker image
- name: Build Docker image if needed
run: |
${gh_user} = ("${{ github.repository }}" -Split '/')[0]
${ENV:DOCKER_TAG} = "${{ github.sha }}".Substring(0, 8)
${Env:LAST_DOCKER_BASE_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
cd .github\docker\rez-win-py
docker build --tag ${gh_user}/rez-win-py:${{ matrix.python-version }}-${ENV:DOCKER_TAG} --build-arg PYTHON_VERSION="${{ matrix.python-version }}" --build-arg BASE_TAG=${ENV:LAST_DOCKER_BASE_REVISION} .
docker push ${gh_user}/rez-win-py:${{ matrix.python-version }}-${ENV:DOCKER_TAG}

${Env:LAST_DOCKER_PY_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
${Env:DOCKER_TAG} = "${{ matrix.python-version }}-${ENV:LAST_DOCKER_PY_REVISION}"
${gh_user} = ("${{ github.repository }}" -Split '/')[0]
$ErrorActionPreference = "Continue"
docker manifest inspect ${gh_user}/rez-win-py:${ENV:DOCKER_TAG} | Out-Null
$ErrorActionPreference = "Stop"
if ($LastExitCode -ne 0) {
cd .github\docker\rez-win-py
docker build --tag ${gh_user}/rez-win-py:${ENV:DOCKER_TAG} --build-arg PYTHON_VERSION="${{ matrix.python-version }}" --build-arg BASE_TAG=${ENV:LAST_DOCKER_BASE_REVISION} .
docker push ${gh_user}/rez-win-py:${ENV:DOCKER_TAG}
}
$ErrorActionPreference = "Stop"
env:
DOCKER_CLI_EXPERIMENTAL: enabled
4 changes: 2 additions & 2 deletions .github/workflows/windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ jobs:
- name: Pull docker image
run: |
${gh_user} = ("${{ github.repository }}" -Split '/')[0]
${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
echo "Pulling rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}"
docker pull ${gh_user}/rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION}

- name: Run Docker image (installs and tests rez)
run: |
${gh_user} = ("${{ github.repository }}" -Split '/')[0]
${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
${Env:LAST_DOCKER_REVISION} = $( git log -n 1 --author-date-order --pretty=format:%H -- .\.github\docker\rez-win-py\ .\.github\docker\rez-win-base\ .\.github\workflows\windows-docker-image.yaml ).SubString(0, 8)
docker run ${gh_user}/rez-win-py:${{ matrix.python-version }}-${Env:LAST_DOCKER_REVISION} ${{ github.repository }} ${{ github.sha }}