-
Notifications
You must be signed in to change notification settings - Fork 24
181 lines (161 loc) · 6.93 KB
/
stream-connectors.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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
name: stream-connectors
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- centreon-certified/**
push:
branches:
- develop
- master
paths:
- centreon-certified/**
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
detect-changes:
runs-on: ubuntu-22.04
outputs:
connectors: ${{ steps.list-connectors.outputs.connectors }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
id: filter
with:
base: ${{ github.ref }}
list-files: shell
filters: |
connectors:
- added|modified: centreon-certified/**
- name: transform to directories
id: list-connectors
run: |
folders=()
for f in ${{ steps.filter.outputs.connectors_files }}; do
DIR_NAME=($(dirname $f))
BASE_NAME=($(basename $DIR_NAME))
echo "Adding $BASE_NAME to folders"
folders+=($BASE_NAME)
done
unique_folders=($(printf "%s\n" "${folders[@]}" | sort -u | tr '\n' ' '))
echo "connectors=$(jq --compact-output --null-input '$ARGS.positional' --args -- ${unique_folders[@]})" >> $GITHUB_OUTPUT
shell: bash
package:
if: ${{ needs.detect-changes.outputs.connectors != '[]' }}
needs: [get-environment, detect-changes]
runs-on: ubuntu-22.04
strategy:
matrix:
distrib: [el8, el9, bullseye, bookworm, jammy]
connector_path: ${{ fromJson(needs.detect-changes.outputs.connectors) }}
include:
- distrib: el8
image: packaging-stream-connectors-nfpm-alma8
package_extension: rpm
- distrib: el9
image: packaging-stream-connectors-nfpm-alma9
package_extension: rpm
- distrib: bullseye
image: packaging-stream-connectors-nfpm-bullseye
package_extension: deb
- distrib: bookworm
image: packaging-stream-connectors-nfpm-bookworm
package_extension: deb
- distrib: jammy
image: packaging-stream-connectors-nfpm-jammy
package_extension: deb
name: package ${{ matrix.distrib }} ${{ matrix.connector_path }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest
credentials:
username: ${{ secrets.HARBOR_CENTREON_PULL_USERNAME }}
password: ${{ secrets.HARBOR_CENTREON_PULL_TOKEN }}
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Replace package and connector name variables
run: |
package_name="centreon-stream-connector-`basename ${{ matrix.connector_path }}`"
sed -i "s/@PACKAGE_NAME@/$package_name/g" ./packaging/connectors/centreon-stream-connectors.yaml
connector_name="`basename ${{ matrix.connector_path }}`"
sed -i "s/@CONNECTOR_NAME@/$connector_name/g" ./packaging/connectors/centreon-stream-connectors.yaml
shell: bash
- name: Add specific dependencies
run: |
DEB_DEPENDENCIES=""
RPM_DEPENDENCIES=""
if [ "${{ matrix.connector_path }}" = "kafka" ]; then
DEB_DEPENDENCIES="librdkafka1,lua-cffi"
RPM_DEPENDENCIES="librdkafka,lua-cffi"
elif [ "${{ matrix.connector_path }}" = "pagerduty" ]; then
DEB_DEPENDENCIES="lua-tz"
RPM_DEPENDENCIES="lua-tz"
elif [ "${{ matrix.connector_path }}" = "splunk" ]; then
DEB_DEPENDENCIES="lua-tz"
RPM_DEPENDENCIES="lua-tz"
fi
sed -i "s/@RPM_DEPENDENCIES@/$RPM_DEPENDENCIES/g;" ./packaging/connectors/centreon-stream-connectors.yaml
sed -i "s/@DEB_DEPENDENCIES@/$DEB_DEPENDENCIES/g;" ./packaging/connectors/centreon-stream-connectors.yaml
shell: bash
- name: Export package version
id: package-version
run: echo "package_version=`date '+%Y%m%d'`" >> $GITHUB_OUTPUT
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "packaging/connectors/centreon-stream-connectors.yaml"
distrib: ${{ matrix.distrib }}
version: ${{ steps.package-version.outputs.package_version }}
release: "1"
package_extension: ${{ matrix.package_extension }}
arch: all
commit_hash: ${{ github.sha }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.connector_path }}-${{ matrix.distrib }}
rpm_gpg_key: ${{ secrets.RPM_GPG_SIGNING_KEY }}
rpm_gpg_signing_key_id: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
rpm_gpg_signing_passphrase: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
stability: ${{ needs.get-environment.outputs.stability }}
deliver-rpm:
if: ${{ contains(fromJson('["unstable", "testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, detect-changes, package]
runs-on: ubuntu-22.04
strategy:
matrix:
distrib: [el8, el9]
connector_path: ${{ fromJson(needs.detect-changes.outputs.connectors) }}
name: deliver ${{ matrix.distrib }} ${{ matrix.connector_path }}
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Publish RPM packages
uses: ./.github/actions/rpm-delivery
with:
module_name: stream-connectors
distrib: ${{ matrix.distrib }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.connector_path }}-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
deliver-deb:
if: ${{ contains(fromJson('["unstable", "testing", "stable"]'), needs.get-environment.outputs.stability) }}
needs: [get-environment, detect-changes, package]
runs-on: ubuntu-22.04
strategy:
matrix:
distrib: [bullseye, bookworm, jammy]
connector_path: ${{ fromJson(needs.detect-changes.outputs.connectors) }}
name: deliver ${{ matrix.distrib }} ${{ matrix.connector_path }}
steps:
- name: Checkout sources
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Publish DEB packages
uses: ./.github/actions/deb-delivery
with:
module_name: stream-connectors
distrib: ${{ matrix.distrib }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.connector_path }}-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}