Skip to content
Open
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
58 changes: 36 additions & 22 deletions actions/publish_images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,48 @@ inputs:
description: Path to Dockerbuild context
type: string
default: ""
platforms:
description: Docker platforms to build
type: string
default: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
container_image_name:
description: Name of the container image
type: string
default: ""
default: ${{ github.event.repository.name }}
github_token:
type: string
description: Github Token
docker_image_tag:
description: A custom image tag to be added
type: string
runs:
using: composite
steps:
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- if: inputs.docker_image_tag != ''
run: echo "export DOCKER_IMAGE_TAG=${{ inputs.docker_image_tag }}" >> /tmp/tmp-profile
shell: bash
- run: |
touch /tmp/tmp-profile
. /tmp/tmp-profile
make docker DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
docker images
echo ${{ inputs.password }} | docker login -u ${{ inputs.login }} --password-stdin ${{ inputs.registry }}
make docker-publish DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
shell: bash
- name: Docker meta
id: meta
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
with:
github-token: ${{ inputs.github_token }}
images: |
${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.container_image_name }}
flavor: |
latest=false
tags: |
type=ref,event=branch
type=ref,event=pr
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.login }}
password: ${{ inputs.password }}
- name: Build and push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: ${{ inputs.dockerbuild_context || '.' }}
file: ${{ inputs.dockerfile_path }}
platforms: ${{ inputs.platforms }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
5 changes: 5 additions & 0 deletions actions/publish_main/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,9 @@ inputs:
quay_io_password:
type: string
description: Quay.io password
github_token:
type: string
description: Github Token
runs:
using: composite
steps:
Expand All @@ -34,10 +37,12 @@ runs:
organization: ${{ inputs.docker_hub_organization }}
login: ${{ inputs.docker_hub_login }}
password: ${{ inputs.docker_hub_password }}
github_token: ${{ inputs.github_token }}
- uses: ./.github/promci/actions/publish_images
if: inputs.quay_io_organization != '' && inputs.quay_io_login != ''
with:
registry: quay.io
organization: ${{ inputs.quay_io_organization }}
login: ${{ inputs.quay_io_login }}
password: ${{ inputs.quay_io_password }}
github_token: ${{ inputs.github_token }}
3 changes: 3 additions & 0 deletions actions/publish_release/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,17 +49,20 @@ runs:
organization: ${{ inputs.docker_hub_organization }}
login: ${{ inputs.docker_hub_login }}
password: ${{ inputs.docker_hub_password }}
github_token: ${{ inputs.github_token }}
- uses: ./.github/promci/actions/publish_release_images
if: inputs.quay_io_organization != '' && inputs.quay_io_login != ''
with:
registry: quay.io
organization: ${{ inputs.quay_io_organization }}
login: ${{ inputs.quay_io_login }}
password: ${{ inputs.quay_io_password }}
github_token: ${{ inputs.github_token }}
- uses: ./.github/promci/actions/publish_release_images
if: inputs.ghcr_io_organization != '' && inputs.ghcr_io_login != ''
with:
registry: ghcr.io
organization: ${{ inputs.ghcr_io_organization }}
login: ${{ inputs.ghcr_io_login }}
password: ${{ inputs.ghcr_io_password }}
github_token: ${{ inputs.github_token }}
69 changes: 45 additions & 24 deletions actions/publish_release_images/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,34 +20,55 @@ inputs:
description: Path to Dockerbuild context
type: string
default: ""
platforms:
description: Docker platforms to build
type: string
default: "linux/amd64,linux/arm/v7,linux/arm64,linux/ppc64le,linux/s390x"
container_image_name:
description: Name of the container image
type: string
default: ""
default: ${{ github.event.repository.name }}
github_token:
type: string
description: Github Token
runs:
using: composite
steps:
- if: inputs.dockerfile_path != ''
run: echo "export DOCKERFILE_PATH=${{ inputs.dockerfile_path }}" >> /tmp/tmp-profile
shell: bash
- if: inputs.container_image_name != ''
run: echo "export DOCKER_IMAGE_NAME=${{ inputs.container_image_name }}" >> /tmp/tmp-profile
shell: bash
- if: inputs.dockerbuild_context != ''
run: echo "export DOCKERBUILD_CONTEXT=${{ inputs.dockerbuild_context }}" >> /tmp/tmp-profile
shell: bash
- run: |
current_tag=${GITHUB_REF#refs/*/}
touch /tmp/tmp-profile
. /tmp/tmp-profile
make docker DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
docker images
echo ${{ inputs.password }} | docker login -u ${{ inputs.login }} --password-stdin ${{ inputs.registry }}
make docker-publish DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
if [[ "$current_tag" =~ ^v[0-9]+(\.[0-9]+){2}$ ]]; then
make docker-tag-latest DOCKER_IMAGE_TAG="$current_tag" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-publish DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
make docker-manifest DOCKER_IMAGE_TAG="latest" DOCKER_REPO=${{ inputs.registry }}/${{ inputs.organization }}
- name: Determine latest
id: update_latest
run: |
if [ ${{ startsWith(github.ref, 'refs/tags/v3.') }} ]
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

These CI actions are used all over the Prometheus ecosystem. We have v0, v1, etc releases stil.

Maybe we should parameterize this, with something like: refs/tags/${{ inputs.latest_tag_prefix }},

Then set the default to just v, and then when we update Prometheus, we can specify v3.

Also, how does this avoid prerelease?

then
echo "::set-output name=latest::auto"
else
echo "::set-output name=latest::false"
fi
shell: bash
- name: Docker meta
id: meta
uses: docker/metadata-action@318604b99e75e41977312d83839a89be02ca4893 # v5.9.0
with:
github-token: ${{ inputs.github_token }}
images: |
${{ inputs.registry }}/${{ inputs.organization }}/${{ inputs.container_image_name }}
flavor: |
latest=${{ steps.update_latest.outputs.latest }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
- name: Login to DockerHub
if: github.event_name != 'pull_request'
uses: docker/login-action@5e57cd118135c172c3672efd75eb46360885c0ef # v3.6.0
with:
registry: ${{ inputs.registry }}
username: ${{ inputs.login }}
password: ${{ inputs.password }}
- name: Build and push
uses: docker/build-push-action@263435318d21b8e681c14492fe198d362a7d2c83 # v6.18.0
with:
context: ${{ inputs.dockerbuild_context || '.' }}
file: ${{ inputs.dockerfile_path }}
platforms: ${{ inputs.platforms }}
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}