centreon-plugins/.github/workflows/perl-vmware-vsphere.yml

229 lines
7.6 KiB
YAML

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/**'
jobs:
get-environment:
uses: ./.github/workflows/get-environment.yml
with:
version_file: connectors/vmware/src/centreon/script/centreon_vmware.pm
get-sources:
needs: [get-environment]
if: ${{ needs.get-environment.outputs.stability != 'stable' }}
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
sudo make pure_install
shell: bash
- name: Cache vsphere cli sources
uses: actions/cache/save@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: vmware-vsphere-cli-distrib
key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
package:
needs: [get-environment, get-sources]
strategy:
matrix:
include:
- package_extension: rpm
image: packaging-plugins-alma8
distrib: el8
runner: ubuntu-22.04
arch: amd64
- package_extension: rpm
image: packaging-plugins-alma9
distrib: el9
runner: ubuntu-22.04
arch: amd64
- package_extension: deb
image: packaging-plugins-bullseye
distrib: bullseye
runner: ubuntu-22.04
arch: amd64
- package_extension: deb
image: packaging-plugins-bookworm
distrib: bookworm
runner: ubuntu-22.04
arch: amd64
- package_extension: deb
image: packaging-plugins-jammy
distrib: jammy
runner: ubuntu-22.04
arch: amd64
- package_extension: deb
image: packaging-plugins-bullseye-arm64
distrib: bullseye
runner: ["self-hosted", "collect-arm64"]
arch: arm64
runs-on: ${{ matrix.runner }}
container:
image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}
credentials:
username: ${{ secrets.DOCKER_REGISTRY_ID }}
password: ${{ secrets.DOCKER_REGISTRY_PASSWD }}
name: package ${{ matrix.distrib }} ${{ matrix.arch }}
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Import source files
uses: actions/cache/restore@13aacd865c20de90d75de3b17ebe84f7a17d57d2 # v4.0.0
with:
path: vmware-vsphere-cli-distrib
key: ${{ github.sha }}-${{ github.run_id }}-sources-perl-vmware-vsphere
fail-on-cache-miss: true
- name: Set paths according to distrib
run: |
PERL_VERSION=$(perl -E "say $^V" | sed -E "s/v([0-9]+\.[0-9]+).+/\1/g")
echo "Perl version is $PERL_VERSION"
if [[ "${{ matrix.package_extension }}" == "deb" ]]; then
if [ "${{ matrix.arch }}" = "amd64" ]; then
PERL_VENDORARCH="/usr/lib/x86_64-linux-gnu/perl/$PERL_VERSION"
else
PERL_VENDORARCH="/usr/lib/aarch64-linux-gnu/perl/$PERL_VERSION"
fi
else
if [ "${{ matrix.distrib }}" = "el8" ]; then
PERL_VENDORARCH="/usr/local/lib64/perl5"
else
PERL_VENDORARCH="/usr/local/lib64/perl5/$PERL_VERSION"
fi
fi
sed -i "s#@PERL_VENDORARCH@#$PERL_VENDORARCH#g" dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml
cat dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml
shell: bash
- name: Package
uses: ./.github/actions/package-nfpm
with:
nfpm_file_pattern: "dependencies/perl-vmware-vsphere/packaging/perl-vmware-vsphere.yaml"
distrib: ${{ matrix.distrib }}
package_extension: ${{ matrix.package_extension }}
arch: ${{ matrix.arch }}
commit_hash: ${{ github.sha }}
version: "7.0.1"
release: "17698549"
cache_key: ${{ github.sha }}-${{ github.run_id }}-${{ matrix.package_extension }}-${{ matrix.distrib }}-${{ matrix.arch }}
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:
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
distrib: [el8, el9]
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Delivery
uses: ./.github/actions/rpm-delivery
with:
module_name: perl-vmware-vsphere-amd64
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-rpm-${{ matrix.distrib }}-amd64
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
deliver-deb:
needs: [get-environment, package]
if: ${{ contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
include:
- distrib: bullseye
arch: amd64
- distrib: bullseye
arch: arm64
- distrib: bookworm
arch: amd64
- distrib: jammy
arch: amd64
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Delivery
uses: ./.github/actions/deb-delivery
with:
module_name: perl-vmware-vsphere-${{ matrix.arch }}
distrib: ${{ matrix.distrib }}
cache_key: ${{ github.sha }}-${{ github.run_id }}-deb-${{ matrix.distrib }}-${{ matrix.arch }}
stability: ${{ needs.get-environment.outputs.stability }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
promote:
needs: [get-environment]
if: ${{ contains(fromJson('["stable"]'), needs.get-environment.outputs.stability) }}
runs-on: [self-hosted, common]
strategy:
matrix:
include:
- distrib: el8
arch: amd64
- distrib: el9
arch: amd64
- distrib: bullseye
arch: amd64
- distrib: bookworm
arch: amd64
- distrib: bullseye
arch: arm64
steps:
- name: Checkout sources
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: Promote ${{ matrix.distrib }} ${{ matrix.arch }} to stable
uses: ./.github/actions/promote-to-stable
with:
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}
module: perl-vmware-vsphere-${{ matrix.arch }}
distrib: ${{ matrix.distrib }}
stability: ${{ needs.get-environment.outputs.stability }}