File: container.yml

package info (click to toggle)
gvm-libs 22.35.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 2,980 kB
  • sloc: ansic: 39,095; makefile: 26
file content (85 lines) | stat: -rw-r--r-- 2,867 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: Build and Push Container Images

on:
  push:
    branches:
      - main
    tags:
      - "v*"
  pull_request:
    branches:
      - main
  workflow_dispatch:
    inputs:
      ref-name:
        type: string
        description: "The ref to build a container image from. For example a tag v23.0.0."
        required: true

concurrency:
  group: ${{ github.workflow }}-${{ inputs.ref-name || github.ref }}
  cancel-in-progress: true

jobs:
  build:
    if: ${{ github.repository == 'greenbone/gvm-libs' }}
    strategy:
      fail-fast: false
      matrix:
        include:
          - build:
              name: stable
              dockerfile: .docker/prod.Dockerfile
              stable-name: stable
              edge-name: edge
          - build:
              name: testing
              dockerfile: .docker/prod-testing.Dockerfile
              stable-name: testing
              edge-name: testing-edge
          - build:
              name: oldstable
              dockerfile: .docker/prod-oldstable.Dockerfile
              stable-name: oldstable
              edge-name: oldstable-edge
    name: Build and Push Container Images (${{ matrix.build.name }})
    uses: greenbone/workflows/.github/workflows/container-build-push-gea.yml@main
    with:
      ref: ${{ inputs.ref-name }}
      ref-name: ${{ inputs.ref-name }}
      name: ${{ matrix.build.name }}
      dockerfile: ${{ matrix.build.dockerfile }}
      stable-name: ${{ matrix.build.stable-name }}
      edge-name: ${{ matrix.build.edge-name }}
      enable-latest: ${{ matrix.build.name == 'stable' }}
      enable-pr: ${{ matrix.build.name == 'stable' }}
      enable-version: ${{ matrix.build.name == 'stable' }}
      labels: |
        org.opencontainers.image.vendor=Greenbone
        org.opencontainers.image.base.name=debian:stable-slim
      build-args: ${{ matrix.build.build-args }}
      prefix: ${{ matrix.build.prefix }}
    secrets: inherit

  notify:
    needs:
      - build
    if: ${{ !cancelled() && github.event_name != 'pull_request' && github.repository == 'greenbone/gvm-libs' }}
    uses: greenbone/workflows/.github/workflows/notify-mattermost-2nd-gen.yml@main
    with:
      status: ${{ contains(needs.*.result, 'failure') && 'failure' || 'success' }}
    secrets: inherit

  trigger-replication:
    needs:
      - build
    if: ${{ !cancelled() && github.event_name != 'pull_request' && github.repository == 'greenbone/gvm-libs' }}
    runs-on: self-hosted-generic
    steps:
      - name: Ensure all tags are replicated on the public registry
        uses: greenbone/actions/trigger-harbor-replication@v3
        if: ${{ github.event_name != 'pull_request' }}
        with:
          registry: ${{ vars.GREENBONE_REGISTRY }}
          token: ${{ secrets.GREENBONE_REGISTRY_REPLICATION_TOKEN }}
          user: ${{ secrets.GREENBONE_REGISTRY_REPLICATION_USER }}