Skip to content

Commit f0656b8

Browse files
committed
CI: Use new container build workflow
Allow for more flexible container image builds. With this change even PRs are build as a container image and can be tested easily.
1 parent 0da055a commit f0656b8

1 file changed

Lines changed: 38 additions & 7 deletions

File tree

.github/workflows/container.yml

Lines changed: 38 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Build & Push Container Images
1+
name: Build and Push Container Images
22

33
on:
44
push:
@@ -16,16 +16,47 @@ on:
1616
description: "The ref to build a container image from. For example a tag v23.0.0."
1717
required: true
1818

19+
concurrency:
20+
group: ${{ github.workflow }}-${{ inputs.ref-name || github.ref }}
21+
cancel-in-progress: true
22+
1923
jobs:
2024
build:
21-
name: Build and Push to Greenbone Registry
22-
uses: greenbone/workflows/.github/workflows/container-build-push-2nd-gen.yml@main
25+
if: ${{ github.repository == 'greenbone/gvm-tools' }}
26+
name: Build and Push Container Images
27+
uses: greenbone/workflows/.github/workflows/container-build-push-gea.yml@main
2328
with:
24-
build-docker-file: .docker/Dockerfile
25-
image-url: community/gvm-tools
26-
image-labels: |
29+
ref: ${{ inputs.ref-name }}
30+
ref-name: ${{ inputs.ref-name }}
31+
dockerfile: .docker/Dockerfile
32+
images: |
33+
ghcr.io/${{ github.repository }},enable=true
34+
${{ vars.GREENBONE_REGISTRY }}/community/${{ github.event.repository.name }},enable=${{ github.event_name != 'pull_request' }}
35+
labels: |
2736
org.opencontainers.image.vendor=Greenbone
2837
org.opencontainers.image.documentation=https://greenbone.github.io/gvm-tools/
2938
org.opencontainers.image.base.name=debian/stable-slim
30-
ref-name: ${{ inputs.ref-name }}
3139
secrets: inherit
40+
41+
notify:
42+
needs:
43+
- build
44+
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.repository == 'greenbone/gvm-tools' }}
45+
uses: greenbone/workflows/.github/workflows/notify-mattermost-2nd-gen.yml@main
46+
with:
47+
status: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
48+
secrets: inherit
49+
50+
trigger-replication:
51+
needs:
52+
- build
53+
if: ${{ !cancelled() && github.event_name != 'pull_request' && github.repository == 'greenbone/gvm-tools' }}
54+
runs-on: self-hosted-generic
55+
steps:
56+
- name: Ensure all tags are replicated on the public registry
57+
uses: greenbone/actions/trigger-harbor-replication@v3
58+
if: ${{ github.event_name != 'pull_request' }}
59+
with:
60+
registry: ${{ vars.GREENBONE_REGISTRY }}
61+
token: ${{ secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN }}
62+
user: ${{ secrets.GREENBONE_REGISTRY_REPLICATION_USER }}

0 commit comments

Comments
 (0)