-
Notifications
You must be signed in to change notification settings - Fork 6
137 lines (124 loc) · 5.54 KB
/
docker-builder.yml
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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
name: docker-builder
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
push:
branches:
- develop
- dev-[2-9][0-9].[0-9][0-9].x
paths:
- '.github/docker/Dockerfile.centreon-collect-*'
pull_request:
paths:
- '.github/docker/Dockerfile.centreon-collect-*'
jobs:
get-environment:
if: github.repository == 'centreon/centreon-collect'
uses: ./.github/workflows/get-environment.yml
with:
version_file: CMakeLists.txt
dockerize:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
include:
- runner: collect
dockerfile: centreon-collect-alma8
image: centreon-collect-alma8
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-alma9
image: centreon-collect-alma9
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-alma9-test
image: centreon-collect-alma9-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
- runner: collect
dockerfile: centreon-collect-mysql-alma9
image: centreon-collect-mysql-alma9
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-mysql-alma9-test
image: centreon-collect-mysql-alma9-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bullseye
image: centreon-collect-debian-bullseye
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bullseye-test
image: centreon-collect-debian-bullseye-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bookworm
image: centreon-collect-debian-bookworm
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect
dockerfile: centreon-collect-debian-bookworm-test
image: centreon-collect-debian-bookworm-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
# - runner: collect
# dockerfile: centreon-collect-ubuntu-jammy
# image: centreon-collect-ubuntu-jammy
# tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bullseye
image: centreon-collect-debian-bullseye-arm64
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bullseye-test
image: centreon-collect-debian-bullseye-arm64-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bookworm
image: centreon-collect-debian-bookworm-arm64
tag: ${{ needs.get-environment.outputs.img_version }}
- runner: collect-arm64
dockerfile: centreon-collect-debian-bookworm-test
image: centreon-collect-debian-bookworm-arm64-test
tag: ${{ needs.get-environment.outputs.test_img_version }}
runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.runner)) }}
name: build container ${{ matrix.image }}
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Login to Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
- name: Login to Proxy Registry
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }}
username: ${{ secrets.HARBOR_CENTREON_PUSH_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PUSH_TOKEN }}
- uses: docker/setup-buildx-action@6524bf65af31da8d45b59e8c27de4bd072b392f5 # v3.8.0
- name: Build image ${{ matrix.image }}:${{ matrix.tag }}
uses: docker/build-push-action@48aba3b46d1b1fec4febb7c5d0c644b249a11355 # v6.10.0
with:
file: .github/docker/Dockerfile.${{ matrix.dockerfile }}
context: .
build-args: |
"REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}"
"TRIPLET=${{ contains(matrix.runner, 'arm') && 'arm64-linux' || 'x64-linux' }}"
platforms: ${{ contains(matrix.runner, 'arm') && 'linux/arm64' || 'linux/amd64' }}
pull: true
push: true
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:${{ matrix.tag }}
set-skip-label:
needs: [get-environment, dockerize]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml