Skip to content

Remove long EOL R <= 3.6 images #246

Remove long EOL R <= 3.6 images

Remove long EOL R <= 3.6 images #246

Workflow file for this run

name: R Docker
on:
push:
workflow_dispatch:
inputs:
variants:
description: |
Space-separated list of variants (platforms). Defaults to all variants.
required: false
default: ''
type: string
versions:
description: |
Space-separated list of R versions. Defaults to all versions.
required: false
default: ''
type: string
arch:
description: |
Comma-separated list of architectures. Specify "amd64", "arm64", or both.
Defaults to "amd64,arm64".
required: false
default: 'amd64,arm64'
type: choice
options:
- 'amd64,arm64'
- 'amd64'
- 'arm64'
publish_images:
description: |
Publish images to Docker Hub?
required: false
default: false
type: boolean
include_patch_versions:
description: |
When building all R versions, include R patch version tags (x.y.z) as well?
required: false
default: false
type: boolean
workflow_call:
inputs:
versions:
description: |
Space-separated list of R versions. Defaults to all versions.
required: false
default: ''
type: string
arch:
description: |
Comma-separated list of architectures. Specify "amd64", "arm64", or both.
Defaults to "amd64,arm64".
required: false
default: 'amd64,arm64'
type: string
publish_images:
description: |
Publish images to Docker Hub?
required: false
default: false
type: boolean
include_patch_versions:
description: |
Include R patch versions?
required: false
default: false
type: boolean
secrets:
DOCKERHUB_USERNAME:
required: true
DOCKERHUB_TOKEN:
required: true
RSTUDIO_DOCKERHUB_USERNAME:
required: true
RSTUDIO_DOCKERHUB_TOKEN:
required: true
permissions:
contents: read
jobs:
setup-matrix:
runs-on: ubuntu-latest
outputs:
variants: ${{ steps.setup-matrix.outputs.variants }}
variants_arm64: ${{ steps.setup-matrix.outputs.variants_arm64 }}
arch: ${{ steps.setup-matrix.outputs.arch }}
steps:
- uses: actions/checkout@v4
- name: Set up matrix
id: setup-matrix
run: |
if [[ "${{ inputs.variants }}" != "" ]]; then
variants="${{ inputs.variants }}"
else
variants="$(make print-variants)"
fi
variants=$(echo "$variants" | jq -R -c '[splits(" ")]')
echo "variants=$variants" >> $GITHUB_OUTPUT
echo "variants: $variants"
# centos7 is not supported on arm64, so filter it out for arm64 builds.
# This can be removed once centos7 is no longer supported.
variants_arm64=$(echo "$variants" | jq -c 'map(select(. != "centos7"))')
echo "variants_arm64=$variants_arm64" >> $GITHUB_OUTPUT
echo "variants_arm64: $variants_arm64"
# Convert comma-separated list of architectures to JSON array
arch=$(echo "${{ inputs.arch || 'amd64,arm64' }}" | jq -Rc 'split(",")')
echo "arch=$arch" >> $GITHUB_OUTPUT
echo "arch: $arch"
docker-images-amd64:
needs: setup-matrix
if: contains(needs.setup-matrix.outputs.arch, '"amd64"')
strategy:
fail-fast: false
matrix:
variant: ${{ fromJson(needs.setup-matrix.outputs.variants) }}
# Reduce max-parallel in case of `out of space` errors, particularly on the full patch version builds
max-parallel: 10
runs-on: ubuntu-latest-4x
name: Docker images (${{ matrix.variant }}-amd64)
env:
VARIANTS: ${{ matrix.variant }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# Use the docker driver since the default driver (docker-container) does not work well
# with building images that depend on another local image.
# https://github.com/docker/buildx/issues/847
driver: docker
install: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup environment
run: |
if [[ "${{ inputs.versions }}" != "" ]]; then
echo "VERSIONS=${{ inputs.versions }}" >> $GITHUB_ENV
fi
if [[ "${{ inputs.include_patch_versions }}" == "true" ]]; then
echo "INCLUDE_PATCH_VERSIONS=yes" >> $GITHUB_ENV
fi
- name: Build images
run: |
make build-all
- name: Test images
run: |
make test-all
- name: Push images
if: ${{ github.ref == 'refs/heads/main' || inputs.publish_images }}
run: |
if [[ "${{ matrix.variant }}" != "centos7" ]]; then
make push-all
else
# centos7 is not supported on arm64, so we push the amd64 image only.
# This can be removed once centos7 is no longer supported.
make push-all ARCH=
fi
# Push images to deprecated rstudio repository.
# Multiarch images are not supported here, only amd64.
- name: Login to Docker Hub (rstudio)
uses: docker/login-action@v3
with:
username: ${{ secrets.RSTUDIO_DOCKERHUB_USERNAME }}
password: ${{ secrets.RSTUDIO_DOCKERHUB_TOKEN }}
- name: Push images (rstudio)
if: ${{ github.ref == 'refs/heads/main' || inputs.publish_images }}
run: |
TARGET_BASE_IMAGE=rstudio/r-base ARCH= make push-all
# arm64 images are built in a separate job with different platform support, and no pushes
# to the deprecated rstudio repository.
docker-images-arm64:
needs: setup-matrix
if: contains(needs.setup-matrix.outputs.arch, '"arm64"') && needs.setup-matrix.outputs.variants_arm64 != '[]'
strategy:
fail-fast: false
matrix:
variant: ${{ fromJson(needs.setup-matrix.outputs.variants_arm64) }}
# Reduce max-parallel in case of `out of space` errors, particularly on the full patch version builds
max-parallel: 10
runs-on: ubuntu-24.04-arm
name: Docker images (${{ matrix.variant }}-arm64)
env:
VARIANTS: ${{ matrix.variant }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# Use the docker driver since the default driver (docker-container) does not work well
# with building images that depend on another local image.
# https://github.com/docker/buildx/issues/847
driver: docker
install: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup environment
run: |
if [[ "${{ inputs.versions }}" != "" ]]; then
echo "VERSIONS=${{ inputs.versions }}" >> $GITHUB_ENV
fi
if [[ "${{ inputs.include_patch_versions }}" == "true" ]]; then
echo "INCLUDE_PATCH_VERSIONS=yes" >> $GITHUB_ENV
fi
- name: Build images
run: |
make build-all
- name: Test images
run: |
make test-all
- name: Push images
if: ${{ github.ref == 'refs/heads/main' || inputs.publish_images }}
run: |
make push-all
# Publish multi-platform images (manifests). Only done when both architectures are built..
publish-manifest:
runs-on: ubuntu-latest
name: Publish multi-platform image (${{ matrix.variant }})
needs: [setup-matrix, docker-images-amd64, docker-images-arm64]
if: ${{ (github.ref == 'refs/heads/main' || inputs.publish_images) }}
strategy:
fail-fast: false
matrix:
variant: ${{ fromJson(needs.setup-matrix.outputs.variants_arm64) }}
env:
VARIANTS: ${{ matrix.variant }}
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
with:
# Use the docker driver since the default driver (docker-container) does not work well
# with building images that depend on another local image.
# https://github.com/docker/buildx/issues/847
driver: docker
install: true
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Setup environment
run: |
if [[ "${{ inputs.versions }}" != "" ]]; then
echo "VERSIONS=${{ inputs.versions }}" >> $GITHUB_ENV
fi
if [[ "${{ inputs.include_patch_versions }}" == "true" ]]; then
echo "INCLUDE_PATCH_VERSIONS=yes" >> $GITHUB_ENV
fi
- name: Create and push manifest
run: |
make push-multiarch-all