chore(packaging): package vmware-vsphere

This commit is contained in:
Kevin Duret 2023-05-29 11:53:00 +02:00
parent d8e2ec894b
commit b905c38edb
3 changed files with 223 additions and 3 deletions

View File

@ -20,11 +20,19 @@ on:
version:
type: string
description: The package version
required: true
required: false
release:
type: string
description: The release number
required: true
required: false
source_cache_key:
type: string
description: The source files cache key
required: false
source_cache_path:
type: string
description: The source files path
required: false
cache_key:
type: string
description: The package files cache key
@ -49,6 +57,14 @@ jobs:
run: echo -n "$RPM_GPG_SIGNING_KEY" > key.gpg
shell: bash
- if: ${{ inputs.source_cache_key != '' && inputs.source_cache_path != '' }}
name: Import source files
uses: actions/cache/restore@v3
with:
path: ${{ inputs.source_cache_path }}
key: ${{ inputs.source_cache_key }}
fail-on-cache-miss: true
- name: Build ${{ inputs.package_extension }} files
env:
RPM_GPG_SIGNING_KEY_ID: ${{ secrets.RPM_GPG_SIGNING_KEY_ID }}
@ -67,6 +83,9 @@ jobs:
export APACHE_GROUP="www-data"
fi
export PERL_SITELIB="$(eval "$(perl -V:installsitelib)"; echo $installsitelib)"
export PERL_VENDORLIB="$(eval "$(perl -V:installvendorlib)"; echo $installvendorlib)"
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"
@ -75,7 +94,11 @@ jobs:
DIRNAME=$(dirname $FILE)
BASENAME=$(basename $FILE)
cd $DIRNAME
sed -i "s/@COMMIT_HASH@/${{ github.sha }}/g" $BASENAME
sed -i \
"s/@COMMIT_HASH@/${{ github.sha }}/g" \
"s#@PERL_SITELIB@#${PERL_SITELIB}#g" \
"s#@PERL_VENDORLIB@#${PERL_VENDORLIB}#g" \
$BASENAME
nfpm package --config $BASENAME --packager ${{ inputs.package_extension }}
cd -
mv $DIRNAME/*.${{ inputs.package_extension }} ./

View File

@ -0,0 +1,128 @@
name: perl-vmware-vsphere
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
on:
workflow_dispatch:
pull_request:
paths:
- 'dependencies/perl-vmware-vsphere/**'
push:
branches:
- develop
- master
paths:
- 'dependencies/perl-vmware-vsphere/**'
tags:
- perl-vmware-vsphere-*
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
with:
version_file: connectors/vmware/src/centreon/script/centreon_vmware.pm
get-sources:
runs-on: ubuntu-22.04
steps:
- name: Download vsphere cli sources
run: |
wget https://gitlab.labexposed.com/centreon-lab/perl-VMware-vSphere/-/raw/master/storage/VMware-vSphere-Perl-SDK-7.0.0-17698549.x86_64.tar.gz
tar zxf VMware-vSphere-Perl-SDK-7.0.0-17698549.x86_64.tar.gz
shell: bash
- name: Build vsphere cli sources
run: |
cd vmware-vsphere-cli-distrib
perl Makefile.PL
make pure_install
shell: bash
- name: Cache vsphere cli sources
uses: actions/cache/save@v3
with:
path: vmware-vsphere-cli-distrib
key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
package:
needs:
- get-sources
strategy:
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:
nfpm_file_pattern: "dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
image_name: ${{ matrix.image }}
source_cache_key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
source_cache_path: vmware-vsphere-cli-distrib
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}
secrets: inherit
deliver-rpm:
needs:
- get-environment
- package
if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [el8, el9]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Delivery
uses: ./.github/actions/rpm-delivery
with:
module_name: connector-vmware
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}
update_repo_path: ${{ secrets.UPDATE_REPO_PATH }}
cloudfront_id: ${{ secrets.CLOUDFRONT_ID }}
yum_repo_address: ${{ secrets.YUM_REPO_ADDRESS }}
yum_repo_key: ${{ secrets.YUM_REPO_KEY }}
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
deliver-deb:
needs:
- get-environment
- package
if: ${{ contains(fromJson('["stable", "testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [bullseye]
steps:
- name: Checkout sources
uses: actions/checkout@v3
- name: Delivery
uses: ./.github/actions/deb-delivery
with:
distrib: ${{ matrix.distrib }}
nexus_username: ${{ secrets.NEXUS_USERNAME }}
nexus_password: ${{ secrets.NEXUS_PASSWORD }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}

View File

@ -0,0 +1,69 @@
name: "perl-VMware-vSphere"
arch: "amd64"
platform: "linux"
version_schema: "none"
version: "7.0.0"
release: "17698549${DIST}"
section: "default"
priority: "optional"
maintainer: "Centreon <contact@centreon.com>"
description: |
The vSphere SDK for Perl is a client-side Perl framework that provides an easy-to-use scripting interface to the vSphere API.
Administrators and developers who are familiar with Perl can use the vSphere SDK for Perl to automate a wide variety of administrative, provisioning, and monitoring tasks in the vSphere environment.
The vSphere SDK for Perl includes ready-to-use utility applications, which you can immediately put to use in your virtual datacenter.
The vSphere SDK for Perl installation includes the WS-Management Perl Library, which allows you to write scripts that retrieve CIM data from the ESX host using CIMOM, a service that provides standard CIM management functions over a WBEM (Web-Based Enterprise Management).
You can use the SDK to manage ESX 3.0.x, ESX/ESXi 3.5, ESX/ESXi 4.0, ESX/ESXi 4.1, ESXi 5.0, vCenter Server 2.5, vCenter Server 4.0, vCenter Server 4.1, and vCenter Server 5.0.
Commit: @COMMIT_HASH@
vendor: "vmware"
homepage: "https://vmware.com"
license: "GPLv2+"
contents:
- src: "../../vmware-vsphere-cli-distrib/VMware"
dst: "@PERL_SITELIB@/VMware"
packager: rpm
- src: "../../vmware-vsphere-cli-distrib/VMware"
dst: "/usr/share/perl5/VMware"
packager: deb
- src: "../../vmware-vsphere-cli-distrib/WSMan"
dst: "@PERL_SITELIB@/WSMan"
packager: rpm
- src: "../../vmware-vsphere-cli-distrib/WSMan"
dst: "/usr/share/perl5/WSMan"
packager: deb
overrides:
rpm:
provides:
- perl(VMware::VIRuntime)
depends:
- perl-XML-LibXML >= 1.58
- perl-libwww-perl >= 5.8.05
- perl-SOAP-Lite >= 0.67
- perl-UUID >= 0.03
- perl-Class-MethodMaker >= 2.08
deb:
depends:
- libstat-lsmode-perl
- libclass-methodmaker-perl
- libuuid-perl
- libconvert-binhex-perl
- libemail-date-format-perl
- libio-sessiondata-perl
- libmime-lite-perl
- libmime-types-perl
- libmime-tools-perl
- libmailtools-perl
- libnet-smtp-ssl-perl
- libsoap-lite-perl
- libtext-template-perl
rpm:
compression: zstd
signature:
key_file: ${RPM_SIGNING_KEY_FILE}
key_id: ${RPM_SIGNING_KEY_ID}