Skip to content
Merged
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
11 changes: 11 additions & 0 deletions .github/workflows/build_test_promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,19 @@ jobs:
dockerhub_tags_release: ${{ steps.save_output.outputs.dockerhub_tags_release }}
ghcr_tags_asan: ${{ steps.save_output.outputs.ghcr_tags_asan }}
ghcr_tags_release: ${{ steps.save_output.outputs.ghcr_tags_release }}
ghcr_tags_package: ${{ steps.save_output.outputs.ghcr_tags_package }}
dockerhub_tags_package: ${{ steps.save_output.outputs.dockerhub_tags_package }}
runs-on: "ubuntu-22.04"
steps:
- name: Set nightly-specific variables
if: ${{ inputs.nightly }}
run: |
echo "IMG_TAGS_GHCR_ASAN=ghcr.io/${{ github.repository }}:asan-nightly" >> "$GITHUB_ENV"
echo "IMG_TAGS_GHCR_RELEASE=ghcr.io/${{ github.repository }}:nightly" >> "$GITHUB_ENV"
echo "IMG_TAGS_GHCR_PKG=ghcr.io/${{ github.repository }}:pkg-nightly" >> "$GITHUB_ENV"
echo "IMG_TAGS_DOCKERHUB_ASAN=${{ inputs.dockerhub_name }}:asan-nightly" >> "$GITHUB_ENV"
echo "IMG_TAGS_DOCKERHUB_RELEASE=${{ inputs.dockerhub_name }}:nightly" >> "$GITHUB_ENV"
echo "IMG_TAGS_DOCKERHUB_PKG=${{ inputs.dockerhub_name }}:pkg-nightly" >> "$GITHUB_ENV"

- name: Set release-specific variables
if: ${{ ! inputs.nightly }}
Expand All @@ -79,6 +83,8 @@ jobs:
echo "IMG_TAGS_GHCR_ASAN=ghcr.io/${{ github.repository }}:asan-latest,ghcr.io/${{ github.repository }}:asan-${VERSION_BUILD},ghcr.io/${{ github.repository }}:asan-${VERSION_FULL},ghcr.io/${{ github.repository }}:asan-${VERSION_MAJOR_MINOR},ghcr.io/${{ github.repository }}:asan-${VERSION_MAJOR}" >> "$GITHUB_ENV"
echo "IMG_TAGS_DOCKERHUB_RELEASE=${{ inputs.dockerhub_name }}:latest,${{ inputs.dockerhub_name }}:${VERSION_BUILD},${{ inputs.dockerhub_name }}:${VERSION_FULL},${{ inputs.dockerhub_name }}:${VERSION_MAJOR_MINOR},${{ inputs.dockerhub_name }}:${VERSION_MAJOR}" >> "$GITHUB_ENV"
echo "IMG_TAGS_GHCR_RELEASE=ghcr.io/${{ github.repository }}:latest,ghcr.io/${{ github.repository }}:${VERSION_BUILD},ghcr.io/${{ github.repository }}:${VERSION_FULL},ghcr.io/${{ github.repository }}:${VERSION_MAJOR_MINOR},ghcr.io/${{ github.repository }}:${VERSION_MAJOR}" >> "$GITHUB_ENV"
echo "IMG_TAGS_DOCKERHUB_PKG=${{ inputs.dockerhub_name }}:pkg-latest" >> "$GITHUB_ENV"
echo "IMG_TAGS_GHCR_PKG=ghcr.io/${{ github.repository }}:pkg-latest" >> "$GITHUB_ENV"

- name: Save output
id: save_output
Expand All @@ -87,15 +93,20 @@ jobs:
echo "dockerhub_tags_release=${{ env.IMG_TAGS_DOCKERHUB_RELEASE }}" >> $GITHUB_OUTPUT
echo "ghcr_tags_asan=${{ env.IMG_TAGS_GHCR_ASAN }}" >> $GITHUB_OUTPUT
echo "ghcr_tags_release=${{ env.IMG_TAGS_GHCR_RELEASE }}" >> $GITHUB_OUTPUT
echo "ghcr_tags_package=${{ env.IMG_TAGS_GHCR_PKG }}" >> $GITHUB_OUTPUT
echo "dockerhub_tags_package=${{ env.IMG_TAGS_DOCKERHUB_PKG }}" >> $GITHUB_OUTPUT

promote:
needs: [build_amd64, build_arm64, get_tags, test_amd64, test_arm64]
uses: ./.github/workflows/promote.yml
with:
images: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_release }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_release }}
images_asan: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_asan }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_asan }}
images_package: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_package }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_package }}
dockerhub_tags_asan: "${{ needs.get_tags.outputs.dockerhub_tags_asan }}"
dockerhub_tags_release: "${{ needs.get_tags.outputs.dockerhub_tags_release }}"
ghcr_tags_asan: "${{ needs.get_tags.outputs.ghcr_tags_asan }}"
ghcr_tags_release: "${{ needs.get_tags.outputs.ghcr_tags_release }}"
ghcr_tags_package: "${{ needs.get_tags.outputs.ghcr_tags_package }}"
dockerhub_tags_package: "${{ needs.get_tags.outputs.dockerhub_tags_package }}"
secrets: inherit
7 changes: 7 additions & 0 deletions .github/workflows/docker_build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ on:
digest_release:
description: "Digest of the release image"
value: ${{ jobs.docker_build.outputs.digest_release }}
digest_package:
description: "Digest of the package image"
value: ${{ jobs.docker_build.outputs.digest_package }}
tag:
description: "Tag in rspamd repo to check out for tests"
value: ${{ jobs.docker_build.outputs.tag }}
Expand All @@ -26,6 +29,7 @@ jobs:
outputs:
digest_asan: "${{ steps.build_asan.outputs.digest }}"
digest_release: "${{ steps.build_release.outputs.digest }}"
digest_package: "${{ steps.build_pkg.outputs.digest }}"
tag: ${{ steps.save_output.outputs.tag }}
runs-on: "${{ (inputs.platform == 'arm64') && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}"
permissions:
Expand Down Expand Up @@ -73,6 +77,7 @@ jobs:
echo "tag=${{ env.RSPAMD_GIT }}" >> $GITHUB_OUTPUT

- name: Build pkg image
id: build_pkg
uses: docker/build-push-action@v5
with:
build-args: |
Expand Down Expand Up @@ -104,6 +109,8 @@ jobs:
ASAN_TAG=-asan
PKG_IMG=ghcr.io/${{ github.repository }}
PKG_TAG=pkg${{ env.PKG_TAG_SUFFIX }}
labels: |
com.rspamd.pkg-tag=pkg${{ env.PKG_TAG_SUFFIX }}
file: Dockerfile
push: true
tags: ""
Expand Down
32 changes: 32 additions & 0 deletions .github/workflows/promote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,27 @@ on:
dockerhub_tags_release:
required: true
type: string
dockerhub_tags_package:
required: true
type: string
ghcr_tags_asan:
required: true
type: string
ghcr_tags_release:
required: true
type: string
ghcr_tags_package:
required: true
type: string
images:
required: true
type: string
images_asan:
required: true
type: string
images_package:
required: true
type: string

jobs:
promote:
Expand Down Expand Up @@ -55,6 +64,17 @@ jobs:
done
docker buildx imagetools create ${TAGLIST} ${IMAGES}

- name: Push package image to GHCR
run: |
IFS=, read -a tags <<< "${{ inputs.ghcr_tags_package }}"
IMAGES="${{ inputs.images_package }}"
IMAGES="${IMAGES//,/ }"
for tag in ${tags[@]}
do
TAGLIST+=" -t ${tag} "
done
docker buildx imagetools create ${TAGLIST} ${IMAGES}

- name: Check for Dockerhub secrets
run: |
if [ -n "${{ secrets.DOCKER_USERNAME }}" ]; then
Expand Down Expand Up @@ -91,3 +111,15 @@ jobs:
TAGLIST+=" -t ${tag} "
done
docker buildx imagetools create ${TAGLIST} ${IMAGES}

- name: Push package image to Dockerhub
if: ${{ env.HAVE_DOCKERHUB }}
run: |
IFS=, read -a tags <<< "${{ inputs.dockerhub_tags_package }}"
IMAGES="${{ inputs.images_package }}"
IMAGES="${IMAGES//,/ }"
for tag in ${tags[@]}
do
TAGLIST+=" -t ${tag} "
done
docker buildx imagetools create ${TAGLIST} ${IMAGES}
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
ARG DEBIAN_RELEASE=bookworm
ARG PKG_IMG=ghcr.io/rspamd/rspamd-docker
ARG PKG_TAG
ARG PKG_TAG=pkg-latest

FROM ${PKG_IMG}:${PKG_TAG} AS pkg

Expand Down