chore(ci): add workflow to package centreon vmware connector
This commit is contained in:
parent
14b4494f1a
commit
b5bd43e74f
|
@ -2,9 +2,15 @@ ARG REGISTRY_URL
|
||||||
|
|
||||||
FROM ${REGISTRY_URL}/almalinux:8
|
FROM ${REGISTRY_URL}/almalinux:8
|
||||||
|
|
||||||
RUN <<EOF
|
RUN bash -e <<EOF
|
||||||
|
|
||||||
dnf -y install git gettext rpm-build dos2unix python3 epel-release
|
echo '[goreleaser]
|
||||||
|
name=GoReleaser
|
||||||
|
baseurl=https://repo.goreleaser.com/yum/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo
|
||||||
|
|
||||||
|
dnf -y install git gettext rpm-build dos2unix python3 epel-release nfpm
|
||||||
dnf -y install perl-App-cpanminus perl-JSON
|
dnf -y install perl-App-cpanminus perl-JSON
|
||||||
cpanm App::FatPacker
|
cpanm App::FatPacker
|
||||||
cpanm File::Copy::Recursive
|
cpanm File::Copy::Recursive
|
||||||
|
|
|
@ -2,9 +2,15 @@ ARG REGISTRY_URL
|
||||||
|
|
||||||
FROM ${REGISTRY_URL}/almalinux:9
|
FROM ${REGISTRY_URL}/almalinux:9
|
||||||
|
|
||||||
RUN <<EOF
|
RUN bash -e <<EOF
|
||||||
|
|
||||||
dnf -y install git gettext rpm-build dos2unix python3 epel-release
|
echo '[goreleaser]
|
||||||
|
name=GoReleaser
|
||||||
|
baseurl=https://repo.goreleaser.com/yum/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo
|
||||||
|
|
||||||
|
dnf -y install git gettext rpm-build dos2unix python3 epel-release nfpm
|
||||||
dnf -y install perl-App-cpanminus perl-JSON
|
dnf -y install perl-App-cpanminus perl-JSON
|
||||||
cpanm App::FatPacker
|
cpanm App::FatPacker
|
||||||
cpanm File::Copy::Recursive
|
cpanm File::Copy::Recursive
|
||||||
|
|
|
@ -2,8 +2,10 @@ ARG REGISTRY_URL
|
||||||
|
|
||||||
FROM ${REGISTRY_URL}/debian:bullseye
|
FROM ${REGISTRY_URL}/debian:bullseye
|
||||||
|
|
||||||
|
ENV DEBIAN_FRONTEND noninteractive
|
||||||
|
|
||||||
# fix locale
|
# fix locale
|
||||||
RUN <<EOF
|
RUN bash -e <<EOF
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
apt-get install -y locales
|
apt-get install -y locales
|
||||||
|
@ -15,12 +17,14 @@ EOF
|
||||||
|
|
||||||
ENV LANG en_US.utf8
|
ENV LANG en_US.utf8
|
||||||
|
|
||||||
RUN <<EOF
|
RUN bash -e <<EOF
|
||||||
|
|
||||||
apt-get update
|
apt-get update
|
||||||
|
|
||||||
apt-get install -y \
|
apt-get install -y \
|
||||||
dh-make \
|
dh-make \
|
||||||
aptitude \
|
aptitude \
|
||||||
|
ca-certificates \
|
||||||
lintian \
|
lintian \
|
||||||
pbuilder \
|
pbuilder \
|
||||||
quilt \
|
quilt \
|
||||||
|
@ -35,6 +39,11 @@ apt-get install -y \
|
||||||
libapp-fatpacker-perl \
|
libapp-fatpacker-perl \
|
||||||
libfile-copy-recursive-perl \
|
libfile-copy-recursive-perl \
|
||||||
jq
|
jq
|
||||||
|
|
||||||
|
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' | tee /etc/apt/sources.list.d/goreleaser.list
|
||||||
|
apt-get update
|
||||||
|
apt-get install -y nfpm
|
||||||
|
|
||||||
apt-get clean
|
apt-get clean
|
||||||
|
|
||||||
EOF
|
EOF
|
||||||
|
|
|
@ -2,9 +2,15 @@ ARG REGISTRY_URL
|
||||||
|
|
||||||
FROM ${REGISTRY_URL}/centos:7
|
FROM ${REGISTRY_URL}/centos:7
|
||||||
|
|
||||||
RUN <<EOF
|
RUN bash -e <<EOF
|
||||||
|
|
||||||
yum -y install git gettext rpm-build dos2unix python3 epel-release
|
echo '[goreleaser]
|
||||||
|
name=GoReleaser
|
||||||
|
baseurl=https://repo.goreleaser.com/yum/
|
||||||
|
enabled=1
|
||||||
|
gpgcheck=0' | tee /etc/yum.repos.d/goreleaser.repo
|
||||||
|
|
||||||
|
yum -y install git gettext rpm-build dos2unix python3 epel-release nfpm
|
||||||
yum -y install perl-App-FatPacker perl-File-Copy-Recursive perl-JSON
|
yum -y install perl-App-FatPacker perl-File-Copy-Recursive perl-JSON
|
||||||
yum clean all
|
yum clean all
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,57 @@
|
||||||
|
name: connector-vmware
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
on:
|
||||||
|
workflow_dispatch:
|
||||||
|
pull_request:
|
||||||
|
paths:
|
||||||
|
- 'connectors/vmware/src'
|
||||||
|
- 'connectors/vmware/packaging'
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- develop
|
||||||
|
- master
|
||||||
|
paths:
|
||||||
|
- 'connectors/vmware/src'
|
||||||
|
- 'connectors/vmware/packaging'
|
||||||
|
tags:
|
||||||
|
- centreon-connector-vmware-*
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
get-environment:
|
||||||
|
uses: ./.github/workflows/get-environment.yml
|
||||||
|
with:
|
||||||
|
version_file: connectors/vmware/src/centreon/script/centreon_vmware.pm
|
||||||
|
|
||||||
|
package:
|
||||||
|
needs:
|
||||||
|
- get-environment
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
include:
|
||||||
|
- package_extension: rpm
|
||||||
|
image: packaging-plugins-alma8
|
||||||
|
distrib: el8
|
||||||
|
- package_extension: rpm
|
||||||
|
image: packaging-plugins-alma9
|
||||||
|
distrib: el9
|
||||||
|
- package_extension: deb
|
||||||
|
image: packaging-plugins-bullseye
|
||||||
|
distrib: bullseye
|
||||||
|
name: package ${{ matrix.distrib }}
|
||||||
|
|
||||||
|
uses: ./.github/workflows/package.yml
|
||||||
|
with:
|
||||||
|
module_directory: centreon-license-manager
|
||||||
|
nfpm_file_pattern: "centreon-license-manager/packaging/*.yaml"
|
||||||
|
distrib: ${{ matrix.distrib }}
|
||||||
|
package_extension: ${{ matrix.package_extension }}
|
||||||
|
image_name: ${{ matrix.image }}
|
||||||
|
version: ${{ needs.get-environment.outputs.version }}
|
||||||
|
release: ${{ needs.get-environment.outputs.release }}
|
||||||
|
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
|
||||||
|
secrets: inherit
|
|
@ -1,5 +1,9 @@
|
||||||
on:
|
on:
|
||||||
workflow_call:
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
version_file:
|
||||||
|
required: false
|
||||||
|
type: string
|
||||||
outputs:
|
outputs:
|
||||||
stability:
|
stability:
|
||||||
description: "branch stability (stable, testing, unstable, canary)"
|
description: "branch stability (stable, testing, unstable, canary)"
|
||||||
|
@ -45,9 +49,13 @@ jobs:
|
||||||
|
|
||||||
echo "stability=$STABILITY" >> $GITHUB_OUTPUT
|
echo "stability=$STABILITY" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
VERSION=`date '+%Y%m%d'`
|
if [[ "${{ inputs.version_file }}" == "" ]]; then
|
||||||
|
VERSION=$(date '+%Y%m%d')
|
||||||
|
else
|
||||||
|
VERSION=$(grep VERSION ${{ inputs.version_file }} | cut -d "'" -f 2)
|
||||||
|
fi
|
||||||
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
|
echo "version=$(echo $VERSION)" >> $GITHUB_OUTPUT
|
||||||
|
|
||||||
RELEASE=`date '+%H%M%S'`
|
RELEASE=$(date '+%H%M%S')
|
||||||
echo "release=$(echo $RELEASE)" >> $GITHUB_OUTPUT
|
echo "release=$(echo $RELEASE)" >> $GITHUB_OUTPUT
|
||||||
shell: bash
|
shell: bash
|
||||||
|
|
|
@ -0,0 +1,139 @@
|
||||||
|
on:
|
||||||
|
workflow_call:
|
||||||
|
inputs:
|
||||||
|
module_directory:
|
||||||
|
type: string
|
||||||
|
description: The module directory
|
||||||
|
required: true
|
||||||
|
nfpm_file_pattern:
|
||||||
|
type: string
|
||||||
|
description: The pattern of the nfpm configuration file(s)
|
||||||
|
required: true
|
||||||
|
distrib:
|
||||||
|
type: string
|
||||||
|
description: The distrib
|
||||||
|
required: true
|
||||||
|
package_extension:
|
||||||
|
type: string
|
||||||
|
description: The package extension (deb or rpm)
|
||||||
|
required: true
|
||||||
|
image_name:
|
||||||
|
type: string
|
||||||
|
description: The image name
|
||||||
|
required: true
|
||||||
|
version:
|
||||||
|
type: string
|
||||||
|
description: The package version
|
||||||
|
required: true
|
||||||
|
release:
|
||||||
|
type: string
|
||||||
|
description: The release number
|
||||||
|
required: true
|
||||||
|
cache_key:
|
||||||
|
type: string
|
||||||
|
description: The package files cache key
|
||||||
|
required: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
package:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
container:
|
||||||
|
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ inputs.image_name }}
|
||||||
|
credentials:
|
||||||
|
username: ${{ secrets.DOCKER_REGISTRY_ID }}
|
||||||
|
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout sources
|
||||||
|
uses: actions/checkout@v3
|
||||||
|
|
||||||
|
- name: Replace git sources by encoded files
|
||||||
|
if: "${{ inputs.encode_cache_key != '' }}"
|
||||||
|
run: |
|
||||||
|
rm -rf ${{ inputs.module_directory }}
|
||||||
|
tar zxf ${{ inputs.module_directory }}-${{ inputs.major_version }}.${{ inputs.minor_version }}.tar.gz
|
||||||
|
rm -f ${{ inputs.module_directory }}-${{ inputs.major_version }}.${{ inputs.minor_version }}.tar.gz
|
||||||
|
mv ${{ inputs.module_directory }}-${{ inputs.major_version }}.${{ inputs.minor_version }} ${{ inputs.module_directory }}
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Restore static directory cache
|
||||||
|
if: "${{ inputs.frontend_static_directory != '' && inputs.frontend_static_cache_key != '' }}"
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.frontend_static_directory }}
|
||||||
|
key: ${{ inputs.frontend_static_cache_key }}
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
|
- name: Restore translation directory cache
|
||||||
|
if: "${{ inputs.translation_directory != '' && inputs.translation_cache_key != '' }}"
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ${{ inputs.translation_directory }}
|
||||||
|
key: ${{ inputs.translation_cache_key }}
|
||||||
|
fail-on-cache-miss: true
|
||||||
|
|
||||||
|
- name: Import gpg key
|
||||||
|
env:
|
||||||
|
RPM_GPG_SIGNING_KEY: ${{ secrets.RPM_GPG_SIGNING_KEY }}
|
||||||
|
run: echo -n "$RPM_GPG_SIGNING_KEY" > key.gpg
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Build ${{ inputs.package_extension }} files
|
||||||
|
env:
|
||||||
|
RPM_GPG_SIGNING_KEY_ID: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
|
||||||
|
RPM_GPG_SIGNING_PASSPHRASE: ${{ secrets.RPM_GPG_SIGNING_PASSPHRASE }}
|
||||||
|
run: |
|
||||||
|
export MAJOR_VERSION="${{ inputs.major_version }}"
|
||||||
|
export VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}"
|
||||||
|
export RELEASE="${{ inputs.release }}"
|
||||||
|
|
||||||
|
if [ "${{ inputs.package_extension }}" = "rpm" ]; then
|
||||||
|
export DIST=".${{ inputs.distrib }}"
|
||||||
|
export APACHE_USER="apache"
|
||||||
|
export APACHE_GROUP="apache"
|
||||||
|
else
|
||||||
|
export DIST=""
|
||||||
|
export APACHE_USER="www-data"
|
||||||
|
export APACHE_GROUP="www-data"
|
||||||
|
fi
|
||||||
|
|
||||||
|
MAJOR_LEFT=$( echo $MAJOR_VERSION | cut -d "." -f1 )
|
||||||
|
MAJOR_RIGHT=$( echo $MAJOR_VERSION | cut -d "-" -f1 | cut -d "." -f2 )
|
||||||
|
BUMP_MAJOR_RIGHT=$(( MAJOR_RIGHT_PART + 1 ))
|
||||||
|
if [ "$MAJOR_RIGHT" = "04" ]; then
|
||||||
|
BUMP_MAJOR_LEFT="$MAJOR_LEFT"
|
||||||
|
BUMP_MAJOR_RIGHT="10"
|
||||||
|
else
|
||||||
|
BUMP_MAJOR_LEFT=$(( $MAJOR_LEFT + 1 ))
|
||||||
|
BUMP_MAJOR_RIGHT="04"
|
||||||
|
fi
|
||||||
|
|
||||||
|
export NEXT_MAJOR_VERSION="$BUMP_MAJOR_LEFT.$BUMP_MAJOR_RIGHT"
|
||||||
|
|
||||||
|
export RPM_SIGNING_KEY_FILE="$(pwd)/key.gpg"
|
||||||
|
export RPM_SIGNING_KEY_ID="$RPM_GPG_SIGNING_KEY_ID"
|
||||||
|
export NFPM_RPM_PASSPHRASE="$RPM_GPG_SIGNING_PASSPHRASE"
|
||||||
|
|
||||||
|
for FILE in ${{ inputs.nfpm_file_pattern }}; do
|
||||||
|
DIRNAME=$(dirname $FILE)
|
||||||
|
BASENAME=$(basename $FILE)
|
||||||
|
cd $DIRNAME
|
||||||
|
sed -i "s/@COMMIT_HASH@/${{ github.sha }}/g" $BASENAME
|
||||||
|
nfpm package --config $BASENAME --packager ${{ inputs.package_extension }}
|
||||||
|
cd -
|
||||||
|
mv $DIRNAME/*.${{ inputs.package_extension }} ./
|
||||||
|
done
|
||||||
|
shell: bash
|
||||||
|
|
||||||
|
- name: Upload package artifacts
|
||||||
|
uses: actions/upload-artifact@v3
|
||||||
|
with:
|
||||||
|
name: packages-${{ inputs.package_extension }}
|
||||||
|
path: ./*.${{ inputs.package_extension }}
|
||||||
|
retention-days: 1
|
||||||
|
|
||||||
|
- name: Cache packages
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: ./*.${{ inputs.package_extension }}
|
||||||
|
key: ${{ inputs.cache_key }}
|
|
@ -0,0 +1,93 @@
|
||||||
|
name: "centreon-plugin-Virtualization-VMWare-daemon"
|
||||||
|
arch: "all"
|
||||||
|
platform: "linux"
|
||||||
|
version_schema: "none"
|
||||||
|
version: "${VERSION}"
|
||||||
|
release: "${RELEASE}${DIST}"
|
||||||
|
section: "default"
|
||||||
|
priority: "optional"
|
||||||
|
maintainer: "Centreon <contact@centreon.com>"
|
||||||
|
description: |
|
||||||
|
Centreon VMWare connector to interact from centreon plugins to vmware sdk.
|
||||||
|
Commit: @COMMIT_HASH@
|
||||||
|
vendor: "Centreon"
|
||||||
|
homepage: "https://centreon.com"
|
||||||
|
license: "Apache-2.0"
|
||||||
|
|
||||||
|
replaces:
|
||||||
|
- ces-plugins-Virtualization-VMWare-daemon
|
||||||
|
- centreon-plugin-Virtualisation-VMWare-daemon
|
||||||
|
conflicts:
|
||||||
|
- ces-plugins-Virtualization-VMWare-daemon
|
||||||
|
- centreon-plugin-Virtualisation-VMWare-daemon
|
||||||
|
provides:
|
||||||
|
- ces-plugins-Virtualization-VMWare-daemon
|
||||||
|
- centreon-plugin-Virtualisation-VMWare-daemon
|
||||||
|
|
||||||
|
contents:
|
||||||
|
- src: "../src/centreon/vmware"
|
||||||
|
dst: "/usr/share/perl5/vendor_perl/centreon/vmware"
|
||||||
|
packager: rpm
|
||||||
|
- src: "../src/centreon/vmware"
|
||||||
|
dst: "/usr/share/perl5/centreon/vmware"
|
||||||
|
packager: deb
|
||||||
|
|
||||||
|
- src: "../src/centreon/script/centreon_vmware.pm"
|
||||||
|
dst: "/usr/share/perl5/vendor_perl/centreon/script/centreon_vmware.pm"
|
||||||
|
packager: rpm
|
||||||
|
- src: "../src/centreon/script/centreon_vmware.pm"
|
||||||
|
dst: "/usr/share/perl5/centreon/script/centreon_vmware.pm"
|
||||||
|
packager: deb
|
||||||
|
|
||||||
|
- src: "../src/centreon_vmware.pl"
|
||||||
|
dst: "/usr/bin/centreon_vmware.pl"
|
||||||
|
file_info:
|
||||||
|
mode: 0755
|
||||||
|
|
||||||
|
- src: "../redhat/centreon_vmware-systemd"
|
||||||
|
dst: "/etc/systemd/system/centreon_vmware.service"
|
||||||
|
file_info:
|
||||||
|
mode: 0755
|
||||||
|
packager: rpm
|
||||||
|
- src: "../debian/centreon_vmware-systemd"
|
||||||
|
dst: "/lib/systemd/system/centreon_vmware.service"
|
||||||
|
file_info:
|
||||||
|
mode: 0755
|
||||||
|
packager: deb
|
||||||
|
|
||||||
|
- src: "../redhat/centreon_vmware-sysconfig"
|
||||||
|
dst: "/etc/sysconfig/centreon_vmware"
|
||||||
|
packager: rpm
|
||||||
|
- src: "../debian/centreon_vmware-default"
|
||||||
|
dst: "/etc/default/centreon_vmware"
|
||||||
|
packager: deb
|
||||||
|
|
||||||
|
- src: "../config/centreon_vmware-conf.pm"
|
||||||
|
dst: "/etc/centreon/centreon_vmware.pm"
|
||||||
|
type: config|noreplace
|
||||||
|
|
||||||
|
overrides:
|
||||||
|
rpm:
|
||||||
|
depends:
|
||||||
|
- perl-VMware-vSphere >= 5.1
|
||||||
|
- perl(ZMQ::LibZMQ4)
|
||||||
|
- perl(ZMQ::Constants)
|
||||||
|
- perl(LWP::Protocol::https)
|
||||||
|
- perl(IO::Socket::INET6)
|
||||||
|
- perl(JSON::XS)
|
||||||
|
- perl-Net-Curl
|
||||||
|
deb:
|
||||||
|
depends:
|
||||||
|
- perl-vmware-vsphere
|
||||||
|
- zmq-libzmq4-perl
|
||||||
|
- libzmq-constants-perl
|
||||||
|
- liblwp-protocol-https-perl
|
||||||
|
- libio-socket-inet6-perl
|
||||||
|
- libjson-xs-perl
|
||||||
|
- libnet-curl-perl
|
||||||
|
- libtext-template-perl
|
||||||
|
|
||||||
|
rpm:
|
||||||
|
signature:
|
||||||
|
key_file: ${RPM_SIGNING_KEY_FILE}
|
||||||
|
key_id: ${RPM_SIGNING_KEY_ID}
|
|
@ -1,9 +1,2 @@
|
||||||
# Configuration for /etc/init.d/centreon_vmware
|
# centreon_vmware command line options
|
||||||
|
|
||||||
# If run centcore at startup default: YES
|
|
||||||
RUN_AT_STARTUP="YES"
|
|
||||||
|
|
||||||
# Centreon user default: root
|
|
||||||
CENTREON_USER="root"
|
|
||||||
|
|
||||||
OPTIONS="--logfile=/var/log/centreon_vmware.log --severity=error"
|
OPTIONS="--logfile=/var/log/centreon_vmware.log --severity=error"
|
Loading…
Reference in New Issue