Change container labeling so that "latest" is the latest tag (#40593)
* Use `major.minor.patch`, `major.minor`, `major` in tags * Ensure `latest` is the semver largest version, and not "latest in time" * Remove Ubuntu 18.04 from the list of images
This commit is contained in:
parent
f3537bc66b
commit
c232bf435a
1 changed files with 22 additions and 24 deletions
46
.github/workflows/build-containers.yml
vendored
46
.github/workflows/build-containers.yml
vendored
|
@ -38,12 +38,11 @@ jobs:
|
||||||
# Meaning of the various items in the matrix list
|
# Meaning of the various items in the matrix list
|
||||||
# 0: Container name (e.g. ubuntu-bionic)
|
# 0: Container name (e.g. ubuntu-bionic)
|
||||||
# 1: Platforms to build for
|
# 1: Platforms to build for
|
||||||
# 2: Base image (e.g. ubuntu:18.04)
|
# 2: Base image (e.g. ubuntu:22.04)
|
||||||
dockerfile: [[amazon-linux, 'linux/amd64,linux/arm64', 'amazonlinux:2'],
|
dockerfile: [[amazon-linux, 'linux/amd64,linux/arm64', 'amazonlinux:2'],
|
||||||
[centos7, 'linux/amd64,linux/arm64,linux/ppc64le', 'centos:7'],
|
[centos7, 'linux/amd64,linux/arm64,linux/ppc64le', 'centos:7'],
|
||||||
[centos-stream, 'linux/amd64,linux/arm64,linux/ppc64le', 'centos:stream'],
|
[centos-stream, 'linux/amd64,linux/arm64,linux/ppc64le', 'centos:stream'],
|
||||||
[leap15, 'linux/amd64,linux/arm64,linux/ppc64le', 'opensuse/leap:15'],
|
[leap15, 'linux/amd64,linux/arm64,linux/ppc64le', 'opensuse/leap:15'],
|
||||||
[ubuntu-bionic, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:18.04'],
|
|
||||||
[ubuntu-focal, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:20.04'],
|
[ubuntu-focal, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:20.04'],
|
||||||
[ubuntu-jammy, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:22.04'],
|
[ubuntu-jammy, 'linux/amd64,linux/arm64,linux/ppc64le', 'ubuntu:22.04'],
|
||||||
[almalinux8, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:8'],
|
[almalinux8, 'linux/amd64,linux/arm64,linux/ppc64le', 'almalinux:8'],
|
||||||
|
@ -58,18 +57,20 @@ jobs:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # @v2
|
||||||
|
|
||||||
- name: Set Container Tag Normal (Nightly)
|
- uses: docker/metadata-action@96383f45573cb7f253c731d3b3ab81c87ef81934
|
||||||
run: |
|
id: docker_meta
|
||||||
container="${{ matrix.dockerfile[0] }}:latest"
|
with:
|
||||||
echo "container=${container}" >> $GITHUB_ENV
|
images: |
|
||||||
echo "versioned=${container}" >> $GITHUB_ENV
|
ghcr.io/${{ github.repository_owner }}/${{ matrix.dockerfile[0] }}
|
||||||
|
${{ github.repository_owner }}/${{ matrix.dockerfile[0] }}
|
||||||
# On a new release create a container with the same tag as the release.
|
tags: |
|
||||||
- name: Set Container Tag on Release
|
type=schedule,pattern=nightly
|
||||||
if: github.event_name == 'release'
|
type=schedule,pattern=develop
|
||||||
run: |
|
type=semver,pattern={{version}}
|
||||||
versioned="${{matrix.dockerfile[0]}}:${GITHUB_REF##*/}"
|
type=semver,pattern={{major}}.{{minor}}
|
||||||
echo "versioned=${versioned}" >> $GITHUB_ENV
|
type=semver,pattern={{major}}
|
||||||
|
type=ref,event=branch
|
||||||
|
type=ref,event=pr
|
||||||
|
|
||||||
- name: Generate the Dockerfile
|
- name: Generate the Dockerfile
|
||||||
env:
|
env:
|
||||||
|
@ -92,13 +93,13 @@ jobs:
|
||||||
path: dockerfiles
|
path: dockerfiles
|
||||||
|
|
||||||
- name: Set up QEMU
|
- name: Set up QEMU
|
||||||
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 # @v1
|
uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
- name: Set up Docker Buildx
|
||||||
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # @v1
|
uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226
|
||||||
|
|
||||||
- name: Log in to GitHub Container Registry
|
- name: Log in to GitHub Container Registry
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # @v1
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
||||||
with:
|
with:
|
||||||
registry: ghcr.io
|
registry: ghcr.io
|
||||||
username: ${{ github.actor }}
|
username: ${{ github.actor }}
|
||||||
|
@ -106,21 +107,18 @@ jobs:
|
||||||
|
|
||||||
- name: Log in to DockerHub
|
- name: Log in to DockerHub
|
||||||
if: github.event_name != 'pull_request'
|
if: github.event_name != 'pull_request'
|
||||||
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # @v1
|
uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d
|
||||||
with:
|
with:
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||||
|
|
||||||
- name: Build & Deploy ${{ matrix.dockerfile[0] }}
|
- name: Build & Deploy ${{ matrix.dockerfile[0] }}
|
||||||
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09 # @v2
|
uses: docker/build-push-action@0565240e2d4ab88bba5387d719585280857ece09
|
||||||
with:
|
with:
|
||||||
context: dockerfiles/${{ matrix.dockerfile[0] }}
|
context: dockerfiles/${{ matrix.dockerfile[0] }}
|
||||||
platforms: ${{ matrix.dockerfile[1] }}
|
platforms: ${{ matrix.dockerfile[1] }}
|
||||||
push: ${{ github.event_name != 'pull_request' }}
|
push: ${{ github.event_name != 'pull_request' }}
|
||||||
cache-from: type=gha
|
cache-from: type=gha
|
||||||
cache-to: type=gha,mode=max
|
cache-to: type=gha,mode=max
|
||||||
tags: |
|
tags: ${{ steps.docker_meta.outputs.tags }}
|
||||||
spack/${{ env.container }}
|
labels: ${{ steps.docker_meta.outputs.labels }}
|
||||||
spack/${{ env.versioned }}
|
|
||||||
ghcr.io/spack/${{ env.container }}
|
|
||||||
ghcr.io/spack/${{ env.versioned }}
|
|
||||||
|
|
Loading…
Reference in a new issue