-
Notifications
You must be signed in to change notification settings - Fork 190
Refactor Dockerfiles to use ARG for base images and add ACR sync work… #4952
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
Open
maxmartin-cgi
wants to merge
23
commits into
main
Choose a base branch
from
maxmartin-cgi/utilise-acr-for-docker-pulls
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
23 commits
Select commit
Hold shift + click to select a range
3c28f7c
Refactor Dockerfiles to use ARG for base images and add ACR sync work…
maxmartin-cgi 7989da0
Documentation changes
maxmartin-cgi c0f93b3
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi fefe1b9
Iterate minor version
maxmartin-cgi cc297b9
Iterate minor version (again)
maxmartin-cgi 598eca1
Merge branch 'maxmartin-cgi/utilise-acr-for-docker-pulls' of https://…
maxmartin-cgi 687fa04
Fix issues raised by linter
maxmartin-cgi 593e48f
Iterate minor versions for workspace templates
maxmartin-cgi 879410e
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi 72ed8ef
Pin GitHub Actions in ACR sync workflow
Copilot d8f6e60
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi c89d837
Bump versions
maxmartin-cgi 9eabe13
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi e2a617b
Refactor Dockerfiles to use ARG for base images and tags for improved…
maxmartin-cgi 1962e38
Update version numbers in multiple porter.yaml files and add build ar…
maxmartin-cgi c8fee2d
Bump airlock processor version
maxmartin-cgi 5bcc4d8
Update Docker build workflows to utilize ACR for base images and tags
maxmartin-cgi fb6537a
Fix ACR mirror review feedback
Copilot ae5b101
fix: use VARIANT directly in FROM tag, drop DEVCONTAINER_TAG ARG
Copilot f95fe43
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi d7b2a0f
Bump api version
maxmartin-cgi c2541a5
Merge branch 'main' into maxmartin-cgi/utilise-acr-for-docker-pulls
maxmartin-cgi 5f25c64
Potential fix for pull request finding
maxmartin-cgi File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,161 @@ | ||
| --- | ||
| name: Sync ACR Base Images | ||
|
|
||
| on: # yamllint disable-line rule:truthy | ||
| schedule: | ||
| - cron: "23 2 * * *" | ||
| workflow_dispatch: | ||
|
|
||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
|
|
||
| jobs: | ||
| sync: | ||
| name: Import newer upstream base images into ACR | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - name: Set up Docker Buildx | ||
| uses: docker/setup-buildx-action@4d04d5d9486b7bd6fa91e7baf45bbb4f8b9deedd | ||
|
|
||
| - name: Validate required secrets | ||
| run: | | ||
| if [ "${{ secrets.ACR_NAME }}" = '' ]; then | ||
| echo "Missing secret: ACR_NAME" && exit 1 | ||
| fi | ||
| if [ "${{ secrets.AZURE_CLIENT_ID }}" = '' ]; then | ||
| echo "Missing secret: AZURE_CLIENT_ID" && exit 1 | ||
| fi | ||
| if [ "${{ secrets.AZURE_TENANT_ID }}" = '' ]; then | ||
| echo "Missing secret: AZURE_TENANT_ID" && exit 1 | ||
| fi | ||
| if [ "${{ secrets.AZURE_SUBSCRIPTION_ID }}" = '' ]; then | ||
| echo "Missing secret: AZURE_SUBSCRIPTION_ID" && exit 1 | ||
| fi | ||
|
|
||
| - name: Azure Login | ||
| uses: azure/login@532459ea530d8321f2fb9bb10d1e0bcf23869a43 # v3.0.0 | ||
| with: | ||
| client-id: ${{ secrets.AZURE_CLIENT_ID }} | ||
| tenant-id: ${{ secrets.AZURE_TENANT_ID }} | ||
| subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }} | ||
| environment: ${{ (vars.AZURE_ENVIRONMENT != '' && vars.AZURE_ENVIRONMENT) || 'AzureCloud' }} | ||
|
|
||
| - name: Login to ACR | ||
| run: az acr login --name "${{ secrets.ACR_NAME }}" | ||
|
|
||
| - name: Sync image mirrors | ||
| env: | ||
| ACR_NAME: ${{ secrets.ACR_NAME }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| acr_domain_suffix=$(az cloud show --query suffixes.acrLoginServerEndpoint --output tsv) | ||
| ACR_LOGIN_SERVER="${ACR_NAME}${acr_domain_suffix}" | ||
|
|
||
| # source_repo|target_repo|tag | ||
| IMAGES=( | ||
| "docker.io/library/python|mirror/library/python|3.12-slim-bookworm" | ||
| "docker.io/library/maven|mirror/library/maven|3.9-eclipse-temurin-17-alpine" | ||
| "docker.io/guacamole/guacd|mirror/guacamole/guacd|1.6.0" | ||
| "docker.io/gitea/gitea|mirror/gitea/gitea|1.15" | ||
| "docker.io/gitea/gitea|mirror/gitea/gitea|1.17.3" | ||
| "mcr.microsoft.com/azure-functions/python|mirror/mcr/azure-functions/python|4-python3.12" | ||
| "docker.io/library/debian|mirror/library/debian|bookworm-slim" | ||
| "docker.io/library/debian|mirror/library/debian|bullseye-slim" | ||
| ) | ||
|
maxmartin-cgi marked this conversation as resolved.
|
||
|
|
||
| sync_image() { | ||
| local source_repo="$1" | ||
| local target_repo="$2" | ||
| local tag="$3" | ||
| local source_ref="${source_repo}:${tag}" | ||
| local target_ref="${ACR_LOGIN_SERVER}/${target_repo}:${tag}" | ||
| local digest_format='{{json .Manifest.Digest}}' | ||
|
|
||
| local source_digest | ||
| local target_digest | ||
|
|
||
| if ! source_digest=$(docker buildx imagetools inspect "${source_ref}" \ | ||
| --format "${digest_format}" | tr -d '"'); then | ||
| echo "::error::Failed to inspect source image ${source_ref}. Aborting to avoid unintended forced import." | ||
| return 1 | ||
| fi | ||
|
|
||
| if ! target_digest=$(docker buildx imagetools inspect "${target_ref}" \ | ||
| --format "${digest_format}" | tr -d '"'); then | ||
| echo "::warning::Failed to inspect target image ${target_ref}. Proceeding with import." | ||
| target_digest="" | ||
| fi | ||
|
|
||
| if [[ -z "${source_digest}" ]]; then | ||
| echo "::error::Source digest for ${source_ref} is empty. Aborting to avoid unintended forced import." | ||
| return 1 | ||
| fi | ||
|
|
||
| if [[ -z "${target_digest}" ]]; then | ||
| echo "::warning::Target digest for ${target_ref} is empty. Import will proceed." | ||
| fi | ||
|
|
||
| if [[ -n "${source_digest}" && -n "${target_digest}" && "${source_digest}" == "${target_digest}" ]]; then | ||
| echo "Up-to-date: ${target_repo}:${tag} (${source_digest})" | ||
| return 0 | ||
| fi | ||
|
|
||
| echo "Importing ${source_ref} -> ${target_repo}:${tag}" | ||
| az acr import \ | ||
| --name "${ACR_NAME}" \ | ||
| --source "${source_ref}" \ | ||
| --image "${target_repo}:${tag}" \ | ||
| --force | ||
| } | ||
|
|
||
| for image in "${IMAGES[@]}"; do | ||
| IFS='|' read -r source_repo target_repo tag <<< "${image}" | ||
| sync_image "${source_repo}" "${target_repo}" "${tag}" | ||
| done | ||
|
|
||
| - name: Publish sync summary | ||
| env: | ||
| ACR_NAME: ${{ secrets.ACR_NAME }} | ||
| CURRENT_ACR_BASE_IMAGE_PREFIX: ${{ vars.ACR_BASE_IMAGE_PREFIX }} | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| acr_domain_suffix=$(az cloud show --query suffixes.acrLoginServerEndpoint --output tsv) | ||
| expected_prefix="${ACR_NAME}${acr_domain_suffix}" | ||
|
|
||
| { | ||
| echo "## ACR base image sync summary" | ||
| echo | ||
| echo "- Expected ACR_BASE_IMAGE_PREFIX: ${expected_prefix}" | ||
|
|
||
| if [[ -n "${CURRENT_ACR_BASE_IMAGE_PREFIX}" ]]; then | ||
| echo "- Current ACR_BASE_IMAGE_PREFIX: ${CURRENT_ACR_BASE_IMAGE_PREFIX}" | ||
| else | ||
| echo "- Current ACR_BASE_IMAGE_PREFIX: (not set)" | ||
| fi | ||
|
|
||
| echo | ||
| if [[ -z "${CURRENT_ACR_BASE_IMAGE_PREFIX}" ]]; then | ||
| echo "Repository variable ACR_BASE_IMAGE_PREFIX is not set." | ||
| echo "Please set it to ${expected_prefix}." | ||
| echo "See: Repository Settings > Secrets and variables > Actions > Variables" | ||
| elif [[ "${CURRENT_ACR_BASE_IMAGE_PREFIX}" != "${expected_prefix}" ]]; then | ||
| echo "Repository variable ACR_BASE_IMAGE_PREFIX does not match the expected value." | ||
| echo "Please update it to ${expected_prefix}." | ||
| else | ||
| echo "Repository variable ACR_BASE_IMAGE_PREFIX is correctly configured." | ||
| fi | ||
| } >> "${GITHUB_STEP_SUMMARY}" | ||
|
|
||
| if [[ -z "${CURRENT_ACR_BASE_IMAGE_PREFIX}" ]]; then | ||
| echo "::warning::Repository variable ACR_BASE_IMAGE_PREFIX is not set. Expected: ${expected_prefix}" | ||
| elif [[ "${CURRENT_ACR_BASE_IMAGE_PREFIX}" != "${expected_prefix}" ]]; then | ||
| echo "::warning::Repository variable ACR_BASE_IMAGE_PREFIX mismatch. Current: ${CURRENT_ACR_BASE_IMAGE_PREFIX}, Expected: ${expected_prefix}" | ||
| fi | ||
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
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.8.11" | ||
| __version__ = "0.8.12" |
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
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
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1 @@ | ||
| __version__ = "0.25.29" | ||
| __version__ = "0.25.30" |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.