Ctor 816 add warp10 #278
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- 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.DOCKER_REGISTRY_ID }} | |
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} | |
steps: | |
- name: Checkout sources | |
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- 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@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 | |
- 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 }} |