Skip to content

Commit def4084

Browse files
authored
Merge pull request #51 from fatalbanana/pkg_latest
Add `pkg-latest`/`pkg-nightly` tag
2 parents eac8f21 + e6ecc35 commit def4084

File tree

4 files changed

+51
-1
lines changed

4 files changed

+51
-1
lines changed

.github/workflows/build_test_promote.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,19 @@ jobs:
5454
dockerhub_tags_release: ${{ steps.save_output.outputs.dockerhub_tags_release }}
5555
ghcr_tags_asan: ${{ steps.save_output.outputs.ghcr_tags_asan }}
5656
ghcr_tags_release: ${{ steps.save_output.outputs.ghcr_tags_release }}
57+
ghcr_tags_package: ${{ steps.save_output.outputs.ghcr_tags_package }}
58+
dockerhub_tags_package: ${{ steps.save_output.outputs.dockerhub_tags_package }}
5759
runs-on: "ubuntu-22.04"
5860
steps:
5961
- name: Set nightly-specific variables
6062
if: ${{ inputs.nightly }}
6163
run: |
6264
echo "IMG_TAGS_GHCR_ASAN=ghcr.io/${{ github.repository }}:asan-nightly" >> "$GITHUB_ENV"
6365
echo "IMG_TAGS_GHCR_RELEASE=ghcr.io/${{ github.repository }}:nightly" >> "$GITHUB_ENV"
66+
echo "IMG_TAGS_GHCR_PKG=ghcr.io/${{ github.repository }}:pkg-nightly" >> "$GITHUB_ENV"
6467
echo "IMG_TAGS_DOCKERHUB_ASAN=${{ inputs.dockerhub_name }}:asan-nightly" >> "$GITHUB_ENV"
6568
echo "IMG_TAGS_DOCKERHUB_RELEASE=${{ inputs.dockerhub_name }}:nightly" >> "$GITHUB_ENV"
69+
echo "IMG_TAGS_DOCKERHUB_PKG=${{ inputs.dockerhub_name }}:pkg-nightly" >> "$GITHUB_ENV"
6670
6771
- name: Set release-specific variables
6872
if: ${{ ! inputs.nightly }}
@@ -79,6 +83,8 @@ jobs:
7983
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"
8084
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"
8185
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"
86+
echo "IMG_TAGS_DOCKERHUB_PKG=${{ inputs.dockerhub_name }}:pkg-latest" >> "$GITHUB_ENV"
87+
echo "IMG_TAGS_GHCR_PKG=ghcr.io/${{ github.repository }}:pkg-latest" >> "$GITHUB_ENV"
8288
8389
- name: Save output
8490
id: save_output
@@ -87,15 +93,20 @@ jobs:
8793
echo "dockerhub_tags_release=${{ env.IMG_TAGS_DOCKERHUB_RELEASE }}" >> $GITHUB_OUTPUT
8894
echo "ghcr_tags_asan=${{ env.IMG_TAGS_GHCR_ASAN }}" >> $GITHUB_OUTPUT
8995
echo "ghcr_tags_release=${{ env.IMG_TAGS_GHCR_RELEASE }}" >> $GITHUB_OUTPUT
96+
echo "ghcr_tags_package=${{ env.IMG_TAGS_GHCR_PKG }}" >> $GITHUB_OUTPUT
97+
echo "dockerhub_tags_package=${{ env.IMG_TAGS_DOCKERHUB_PKG }}" >> $GITHUB_OUTPUT
9098
9199
promote:
92100
needs: [build_amd64, build_arm64, get_tags, test_amd64, test_arm64]
93101
uses: ./.github/workflows/promote.yml
94102
with:
95103
images: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_release }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_release }}
96104
images_asan: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_asan }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_asan }}
105+
images_package: ghcr.io/${{ github.repository }}@${{ needs.build_amd64.outputs.digest_package }},ghcr.io/${{ github.repository }}@${{ needs.build_arm64.outputs.digest_package }}
97106
dockerhub_tags_asan: "${{ needs.get_tags.outputs.dockerhub_tags_asan }}"
98107
dockerhub_tags_release: "${{ needs.get_tags.outputs.dockerhub_tags_release }}"
99108
ghcr_tags_asan: "${{ needs.get_tags.outputs.ghcr_tags_asan }}"
100109
ghcr_tags_release: "${{ needs.get_tags.outputs.ghcr_tags_release }}"
110+
ghcr_tags_package: "${{ needs.get_tags.outputs.ghcr_tags_package }}"
111+
dockerhub_tags_package: "${{ needs.get_tags.outputs.dockerhub_tags_package }}"
101112
secrets: inherit

.github/workflows/docker_build.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ on:
1717
digest_release:
1818
description: "Digest of the release image"
1919
value: ${{ jobs.docker_build.outputs.digest_release }}
20+
digest_package:
21+
description: "Digest of the package image"
22+
value: ${{ jobs.docker_build.outputs.digest_package }}
2023
tag:
2124
description: "Tag in rspamd repo to check out for tests"
2225
value: ${{ jobs.docker_build.outputs.tag }}
@@ -26,6 +29,7 @@ jobs:
2629
outputs:
2730
digest_asan: "${{ steps.build_asan.outputs.digest }}"
2831
digest_release: "${{ steps.build_release.outputs.digest }}"
32+
digest_package: "${{ steps.build_pkg.outputs.digest }}"
2933
tag: ${{ steps.save_output.outputs.tag }}
3034
runs-on: "${{ (inputs.platform == 'arm64') && 'ubuntu-22.04-arm' || 'ubuntu-22.04' }}"
3135
permissions:
@@ -73,6 +77,7 @@ jobs:
7377
echo "tag=${{ env.RSPAMD_GIT }}" >> $GITHUB_OUTPUT
7478
7579
- name: Build pkg image
80+
id: build_pkg
7681
uses: docker/build-push-action@v5
7782
with:
7883
build-args: |
@@ -104,6 +109,8 @@ jobs:
104109
ASAN_TAG=-asan
105110
PKG_IMG=ghcr.io/${{ github.repository }}
106111
PKG_TAG=pkg${{ env.PKG_TAG_SUFFIX }}
112+
labels: |
113+
com.rspamd.pkg-tag=pkg${{ env.PKG_TAG_SUFFIX }}
107114
file: Dockerfile
108115
push: true
109116
tags: ""

.github/workflows/promote.yml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,18 +9,27 @@ on:
99
dockerhub_tags_release:
1010
required: true
1111
type: string
12+
dockerhub_tags_package:
13+
required: true
14+
type: string
1215
ghcr_tags_asan:
1316
required: true
1417
type: string
1518
ghcr_tags_release:
1619
required: true
1720
type: string
21+
ghcr_tags_package:
22+
required: true
23+
type: string
1824
images:
1925
required: true
2026
type: string
2127
images_asan:
2228
required: true
2329
type: string
30+
images_package:
31+
required: true
32+
type: string
2433

2534
jobs:
2635
promote:
@@ -55,6 +64,17 @@ jobs:
5564
done
5665
docker buildx imagetools create ${TAGLIST} ${IMAGES}
5766
67+
- name: Push package image to GHCR
68+
run: |
69+
IFS=, read -a tags <<< "${{ inputs.ghcr_tags_package }}"
70+
IMAGES="${{ inputs.images_package }}"
71+
IMAGES="${IMAGES//,/ }"
72+
for tag in ${tags[@]}
73+
do
74+
TAGLIST+=" -t ${tag} "
75+
done
76+
docker buildx imagetools create ${TAGLIST} ${IMAGES}
77+
5878
- name: Check for Dockerhub secrets
5979
run: |
6080
if [ -n "${{ secrets.DOCKER_USERNAME }}" ]; then
@@ -91,3 +111,15 @@ jobs:
91111
TAGLIST+=" -t ${tag} "
92112
done
93113
docker buildx imagetools create ${TAGLIST} ${IMAGES}
114+
115+
- name: Push package image to Dockerhub
116+
if: ${{ env.HAVE_DOCKERHUB }}
117+
run: |
118+
IFS=, read -a tags <<< "${{ inputs.dockerhub_tags_package }}"
119+
IMAGES="${{ inputs.images_package }}"
120+
IMAGES="${IMAGES//,/ }"
121+
for tag in ${tags[@]}
122+
do
123+
TAGLIST+=" -t ${tag} "
124+
done
125+
docker buildx imagetools create ${TAGLIST} ${IMAGES}

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
ARG DEBIAN_RELEASE=bookworm
22
ARG PKG_IMG=ghcr.io/rspamd/rspamd-docker
3-
ARG PKG_TAG
3+
ARG PKG_TAG=pkg-latest
44

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

0 commit comments

Comments
 (0)