diff --git a/connectors/vmware/Jenkinsfile b/connectors/vmware/Jenkinsfile index afb63d9ae..c10b06388 100644 --- a/connectors/vmware/Jenkinsfile +++ b/connectors/vmware/Jenkinsfile @@ -27,14 +27,24 @@ try { sh 'rm -rf output' } }, - 'centos8': { + 'alma8': { node { sh 'setup_centreon_build.sh' - sh './centreon-build/jobs/vmware/vmware-package.sh centos8' - archiveArtifacts artifacts: 'rpms-centos8.tar.gz' - stash name: "rpms-centos8", includes: 'output/noarch/*.rpm' + sh './centreon-build/jobs/vmware/vmware-package.sh alma8' + archiveArtifacts artifacts: 'rpms-alma8.tar.gz' + stash name: "rpms-alma8", includes: 'output/noarch/*.rpm' sh 'rm -rf output' } + }, + 'Debian bullseye packaging and signing': { + node { + dir('centreon-vmware') { + checkout scm + } + sh 'docker run -i --entrypoint "/src/centreon-vmware/ci/scripts/vmware-deb-package.sh" -w "/src" -v "$PWD:/src" -e "DISTRIB=Debian11" -e "VERSION=$VERSION" -e "RELEASE=$RELEASE" registry.centreon.com/centreon-debian11-dependencies:22.04' + stash name: 'Debian11', includes: '*.deb' + archiveArtifacts artifacts: "*" + } } if ((currentBuild.result ?: 'SUCCESS') != 'SUCCESS') { error('Package stage failure.'); @@ -44,8 +54,17 @@ try { node { sh 'setup_centreon_build.sh' unstash "rpms-centos7" - unstash "rpms-centos8" + unstash "rpms-alma8" sh './centreon-build/jobs/vmware/vmware-delivery.sh' + withCredentials([usernamePassword(credentialsId: 'nexus-credentials', passwordVariable: 'NEXUS_PASSWORD', usernameVariable: 'NEXUS_USERNAME')]) { + checkout scm + unstash "Debian11" + sh '''for i in $(echo *.deb) + do + curl -u $NEXUS_USERNAME:$NEXUS_PASSWORD -H "Content-Type: multipart/form-data" --data-binary "@./$i" https://apt.centreon.com/repository/22.04-unstable/ + done + ''' + } } } } catch(e) { diff --git a/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.install b/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.install new file mode 100644 index 000000000..62e8bab0b --- /dev/null +++ b/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.install @@ -0,0 +1,4 @@ +centreon_vmware.pl usr/bin +debian/contrib/centreon_vmware lib/systemd/system +debian/contrib/centreon_vmware.pm etc/centreon +centreon/* usr/share/perl5/centreon diff --git a/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.postinst b/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.postinst new file mode 100644 index 000000000..93e80a677 --- /dev/null +++ b/connectors/vmware/ci/debian/centreon-plugin-virtualization-vmware-daemon.postinst @@ -0,0 +1,10 @@ +#!/bin/sh + +if [ "$1" = "configure" ] ; then + + systemctl daemon-reload + systemctl enable centreon_vmware.service + systemctl restart centreon_vmware.service + +fi +exit 0 \ No newline at end of file diff --git a/connectors/vmware/ci/debian/contrib/centreon_vmware b/connectors/vmware/ci/debian/contrib/centreon_vmware new file mode 120000 index 000000000..d2806142a --- /dev/null +++ b/connectors/vmware/ci/debian/contrib/centreon_vmware @@ -0,0 +1 @@ +../../../contrib/debian/centreon_vmware-systemd \ No newline at end of file diff --git a/connectors/vmware/ci/debian/contrib/centreon_vmware.pm b/connectors/vmware/ci/debian/contrib/centreon_vmware.pm new file mode 120000 index 000000000..2f0885ece --- /dev/null +++ b/connectors/vmware/ci/debian/contrib/centreon_vmware.pm @@ -0,0 +1 @@ +../../../contrib/config/centreon_vmware-conf.pm \ No newline at end of file diff --git a/connectors/vmware/ci/debian/control b/connectors/vmware/ci/debian/control new file mode 100644 index 000000000..f14c0aad7 --- /dev/null +++ b/connectors/vmware/ci/debian/control @@ -0,0 +1,18 @@ +Source: centreon-plugin-virtualization-vmware-daemon +Section: net +Priority: optional +Maintainer: Luiz Costa +Build-Depends: debhelper-compat (= 12) +Standards-Version: 4.5.0 +Homepage: https://www.centreon.com + +Package: centreon-plugin-virtualization-vmware-daemon +Architecture: all +Depends: ${misc:Depends}, + ${shlibs:Depends}, + libio-socket-inet6-perl, + libjson-xs-perl, + liblwp-protocol-https-perl, + libzmq-constants-perl, + zmq-libzmq4-perl +Description: Perl daemon to monitor VSphere Infrastructure diff --git a/connectors/vmware/ci/debian/copyright b/connectors/vmware/ci/debian/copyright new file mode 100644 index 000000000..9d1ae47d8 --- /dev/null +++ b/connectors/vmware/ci/debian/copyright @@ -0,0 +1,29 @@ +Format: https://www.debian.org/doc/packaging-manuals/copyright-format/1.0/ +Upstream-Name: centreon-plugin-virtualization-vmware-daemon +Upstream-Contact: Luiz Costa +Source: https://www.centreon.com + +Files: * +Copyright: 2022 Centreon +License: Apache-2.0 + +Files: debian/* +Copyright: 2022 Centreon +License: Apache-2.0 + +License: Apache-2.0 + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + . + https://www.apache.org/licenses/LICENSE-2.0 + . + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. + . + On Debian systems, the complete text of the Apache version 2.0 license + can be found in "/usr/share/common-licenses/Apache-2.0". + diff --git a/connectors/vmware/ci/debian/rules b/connectors/vmware/ci/debian/rules new file mode 100755 index 000000000..d8309f67d --- /dev/null +++ b/connectors/vmware/ci/debian/rules @@ -0,0 +1,6 @@ +#!/usr/bin/make -f + +export DEB_BUILD_MAINT_OPTIONS = hardening=+all + +%: + dh $@ diff --git a/connectors/vmware/ci/debian/source/format b/connectors/vmware/ci/debian/source/format new file mode 100644 index 000000000..163aaf8d8 --- /dev/null +++ b/connectors/vmware/ci/debian/source/format @@ -0,0 +1 @@ +3.0 (quilt) diff --git a/connectors/vmware/ci/scripts/vmware-deb-package.sh b/connectors/vmware/ci/scripts/vmware-deb-package.sh new file mode 100755 index 000000000..41440beb4 --- /dev/null +++ b/connectors/vmware/ci/scripts/vmware-deb-package.sh @@ -0,0 +1,35 @@ +#!/bin/sh +set -ex + +if [ -z "$VERSION" -o -z "$RELEASE" -o -z "$DISTRIB" ] ; then + echo "You need to specify VERSION / RELEASE / DISTRIB variables" + exit 1 +fi + +echo "################################################## PACKAGING COLLECT ##################################################" + +AUTHOR="Luiz Costa" +AUTHOR_EMAIL="me@luizgustavo.pro.br" + +if [ -d /build ]; then + rm -rf /build +fi +mkdir -p /build +cd /build +cp -rv /src/centreon-vmware /build/ +mv -v /build/centreon-vmware /build/centreon-plugin-virtualization-vmware-daemon +(cd /build && tar czvpf - centreon-plugin-virtualization-vmware-daemon) | dd of=centreon-plugin-virtualization-vmware-daemon-$VERSION.tar.gz +cp -rv /src/centreon-vmware/ci/debian /build/centreon-plugin-virtualization-vmware-daemon/ + +ls -lart +cd /build/centreon-plugin-virtualization-vmware-daemon +debmake -f "${AUTHOR}" -e "${AUTHOR_EMAIL}" -u "$VERSION" -y -r "$RELEASE" +debuild-pbuilder +cd /build + +if [ -d "$DISTRIB" ] ; then + rm -rf "$DISTRIB" +fi +mkdir $DISTRIB +mv /build/*.deb $DISTRIB/ +mv /build/$DISTRIB/*.deb /src diff --git a/connectors/vmware/ci/scripts/vmware-deliver-deb-package.sh b/connectors/vmware/ci/scripts/vmware-deliver-deb-package.sh new file mode 100755 index 000000000..2017d59cd --- /dev/null +++ b/connectors/vmware/ci/scripts/vmware-deliver-deb-package.sh @@ -0,0 +1,10 @@ +#!/bin/bash +set -ex + +BULLSEYEPACKAGES=`echo *.deb` + +for i in $BULLSEYEPACKAGES +do + echo "Sending $i" + curl -u \'$1:$2\' -H "Content-Type: multipart/form-data" --data-binary \"@/$i\" "https://apt.centreon.com/repository/22.04" +done