Skip to content

Commit

Permalink
Release 20250114 (#5391)
Browse files Browse the repository at this point in the history
  • Loading branch information
pkippes authored Jan 14, 2025
2 parents 5cd1988 + 47cf7c9 commit e34d52c
Show file tree
Hide file tree
Showing 151 changed files with 91,664 additions and 517 deletions.
5 changes: 3 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ publicly and we'll get in touch with you by private message if this information
- [ ] I have provide data or shown output displaying the result of this code in the plugin area concerned.

------------------------------------------------------------------------------------------------------
# Centreon team
# Centreon team (internal PR)

## Description

Expand Down Expand Up @@ -75,8 +75,9 @@ Mention the automated tests included in this FOR (what they test like mode/optio
- [ ] I have **rebased** my development branch on the base branch (develop).
- [ ] In case of a new plugin, I have created the new packaging directory accordingly.
- [ ] I have implemented automated tests related to my commits.
- [ ] Data used for automated tests are anonymized.
- [ ] I have reviewed all the help messages in all the .pm files I have modified.
- [ ] All sentences begin with a capital letter.
- [ ] All sentences are terminated by a period.
- [ ] All sentences end with a period.
- [ ] I am able to understand all the help messages, if not, exchange with the PO or TW to rewrite them.
- [ ] After having created the PR, I will make sure that all the tests provided in this PR have run and passed.
23 changes: 14 additions & 9 deletions .github/actions/package-delivery/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,6 @@ runs:
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
with:
script: |
const warningNoPromote = 'No packages are promoted because push is not related to a hotfix/release pull request.';
const commitSha = context.sha;
const pulls = await github.rest.pulls.list({
Expand All @@ -123,25 +122,31 @@ runs:
per_page: 100
});
const pr = pulls.data.find(p => p.merge_commit_sha === commitSha);
core.startGroup(`Checking pull request linked to commit ${commitSha}`);
const pr = pulls.data.find(p => {
console.log(`Checking pull request ${p.number}("${p.title}") with merge commit ${p.merge_commit_sha}`);
return p.merge_commit_sha === commitSha;
});
core.endGroup();
if (!pr) {
core.warning(warningNoPromote);
core.error(`No pull request found for merge commit ${commitSha}`);
return;
}
const prBaseRef = pr?.base?.ref || 'unknown';
const prHeadRef = pr?.head?.ref || 'unknown';
let releaseType = '';
switch (true) {
case /^release.+/.test(prBaseRef):
case /^release.+/.test(prHeadRef):
releaseType = 'release';
break;
case /^hotfix.+/.test(prBaseRef):
case /^hotfix.+/.test(prHeadRef):
releaseType = 'hotfix';
break;
default:
core.warning(warningNoPromote);
core.error(`No packages are promoted because push of branch ${prHeadRef} is not related to a hotfix/release pull request.`);
return;
}
console.log(`Release type: ${releaseType}`);
let fromStabilitySubdirectory = 'testing';
if (releaseType === 'hotfix' ) {
Expand All @@ -154,11 +159,11 @@ runs:
);
} else if ('${{ steps.parse-distrib.outputs.distrib_family }}' === 'ubuntu') {
await exec.exec(
`jf rt download "ubuntu-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${{ inputs.release_type }}" --flat`
`jf rt download "ubuntu-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${releaseType}" --flat`
);
} else if ('${{ steps.parse-distrib.outputs.distrib_family }}' === 'debian') {
await exec.exec(
`jf rt download "apt-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${{ inputs.release_type }}" --flat`
`jf rt download "apt-plugins-testing/pool/${{ inputs.module_name }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb" --props "release_type=${releaseType}" --flat`
);
}
Expand Down
12 changes: 9 additions & 3 deletions .github/actions/promote-to-stable/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,15 +66,21 @@ runs:
shell: bash

- name: Promote DEB package to stable
if: ${{ contains(fromJSON('["bullseye", "bookworm"]'), inputs.distrib) }}
if: ${{ contains(fromJSON('["bullseye", "bookworm", "jammy"]'), inputs.distrib) }}
run: |
set -eux
echo "[DEBUG] - Distrib: ${{ inputs.distrib }}"
echo "[DEBUG] - Distrib: ${{ inputs.module }}"
if [[ "${{ inputs.distrib }}" == "jammy" ]]; then
repo="ubuntu-plugins"
else
repo="apt-plugins"
fi
echo "[DEBUG] - Get path of testing DEB packages to promote to stable."
SRC_PATHS=$(jf rt search --include-dirs apt-plugins-testing/pool/${{ inputs.module }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path')
SRC_PATHS=$(jf rt search --include-dirs $repo-testing/pool/${{ inputs.module }}/*${{ steps.parse-distrib.outputs.package_distrib_name }}*.deb | jq -r '.[].path')
if [[ ${SRC_PATHS[@]} ]]; then
for SRC_PATH in ${SRC_PATHS[@]}; do
Expand All @@ -86,7 +92,7 @@ runs:
fi
echo "[DEBUG] - Build target path."
TARGET_PATH="apt-plugins-${{ inputs.stability }}/pool/${{ inputs.module }}/"
TARGET_PATH="$repo-${{ inputs.stability }}/pool/${{ inputs.module }}/"
echo "[DEBUG] - Target path: $TARGET_PATH"
echo "[DEBUG] - Promoting DEB testing artifacts to stable."
Expand Down
8 changes: 6 additions & 2 deletions .github/docker/testing/Dockerfile.testing-plugins-bookworm
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG REGISTRY_URL=docker.io

FROM ${REGISTRY_URL}/debian:bookworm

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# fix locale
RUN bash -e <<EOF
Expand All @@ -15,9 +15,13 @@ apt-get clean

EOF

ENV LANG en_US.utf8
ENV LANG=en_US.utf8

RUN bash -e <<EOF

# Avoid apt to clean packages cache directory
rm -f /etc/apt/apt.conf.d/docker-clean

apt-get update
# Install Robotframework
apt-get install -y python3-dev python3-pip
Expand Down
8 changes: 6 additions & 2 deletions .github/docker/testing/Dockerfile.testing-plugins-bullseye
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG REGISTRY_URL=docker.io

FROM ${REGISTRY_URL}/debian:bullseye

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# fix locale
RUN bash -e <<EOF
Expand All @@ -15,9 +15,13 @@ apt-get clean

EOF

ENV LANG en_US.utf8
ENV LANG=en_US.utf8

RUN bash -e <<EOF

# Avoid apt to clean packages cache directory
rm -f /etc/apt/apt.conf.d/docker-clean

apt-get update
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip
Expand Down
8 changes: 6 additions & 2 deletions .github/docker/testing/Dockerfile.testing-plugins-jammy
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ ARG REGISTRY_URL=docker.io

FROM ${REGISTRY_URL}/ubuntu:jammy

ENV DEBIAN_FRONTEND noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# fix locale
RUN bash -e <<EOF
Expand All @@ -15,9 +15,13 @@ apt-get clean

EOF

ENV LANG en_US.utf8
ENV LANG=en_US.utf8

RUN bash -e <<EOF

# Avoid apt to clean packages cache directory
rm -f /etc/apt/apt.conf.d/docker-clean

apt-get update
# Install Robotframework
apt-get install -y python3 python3-dev python3-pip
Expand Down
57 changes: 48 additions & 9 deletions .github/scripts/pod_spell_check.t
Original file line number Diff line number Diff line change
@@ -1,23 +1,62 @@
use strict;
use warnings;

use Test::More;
use Test::Spelling;
use List::MoreUtils qw(uniq);

# the command must have at least one argument
if (!@ARGV) {
die "Usage: perl pod_spell_check.t module.pm stopwords.t";
}
# the first argument is the module to check
my $module_to_check = $ARGV[0];

# the second (optional) argument is the additional dictionary
my $stopword_filename='tests/resources/spellcheck/stopwords.txt';
if(defined($ARGV[1])){
$stopword_filename=$ARGV[1];
}
open(FILE, "<", $stopword_filename)
or die "Could not open $stopword_filename";
printf("Using dictionary: ".$stopword_filename." \n");

add_stopwords(<FILE>);
close(FILE);
set_spell_cmd('hunspell -l');
all_pod_files_spelling_ok($ARGV[0]);
# get_stopwords(): reads the text file and returns its content as an array or strings
sub get_stopwords {
my ($file) = @_;

open(FILE, "<", $stopword_filename)
or die "Could not open $stopword_filename";
printf("Using dictionary: ".$stopword_filename." \n");
my @stop_words;
for my $line (<FILE>) {
chomp $line;
push @stop_words, $line;
}
close(FILE);

return @stop_words;
}

# get_module_options(): reads the Perl module file's POD and returns all the encountered --options
sub get_module_options {
my ($module) = @_;

my @cmd_result = `perldoc -T $module_to_check`;
my @new_words;

for my $pod_line (@cmd_result) {
chomp $pod_line;
my @parsed_options = $pod_line =~ /(--[\w-]+){1,}\s?/mg or next;
push @new_words, @parsed_options;
}

return uniq(sort(@new_words));
}

my @known_words = get_stopwords($stopword_filename);
my @module_options = get_module_options($module_to_check);

# take all words from the text file and the module's options as valid words
add_stopwords(@known_words, @module_options);

# prepare the spelling check command
set_spell_cmd('hunspell -d en_US -l');

# check that all is correct in the Perl module file given as an argument
all_pod_files_spelling_ok($module_to_check);
8 changes: 4 additions & 4 deletions .github/scripts/test-all-plugins.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,8 @@ def install_plugin(plugin, archi):
"apt-get install -o 'Binary::apt::APT::Keep-Downloaded-Packages=1;' -y ./" + plugin.lower() + "*.deb",
shell=True, check=False, stderr=subprocess.STDOUT, stdout=outfile)).returncode
elif archi == "rpm":
outfile.write("dnf install -y ./" + plugin + "*.rpm\n")
output_status = (subprocess.run("dnf install -y ./" + plugin + "*.rpm", shell=True, check=False,
outfile.write("dnf install --setopt=keepcache=True -y ./" + plugin + "*.rpm\n")
output_status = (subprocess.run("dnf install --setopt=keepcache=True -y ./" + plugin + "*.rpm", shell=True, check=False,
stderr=subprocess.STDOUT, stdout=outfile)).returncode
else:
print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.")
Expand All @@ -95,8 +95,8 @@ def remove_plugin(plugin, archi):
# 'autoremove', contrary to 'remove' all dependancy while removing the original package.

elif archi == "rpm":
outfile.write("dnf remove -y " + plugin + "\n")
output_status = (subprocess.run("dnf remove -y " + plugin, shell=True, check=False,
outfile.write("dnf remove --setopt=keepcache=True -y " + plugin + "\n")
output_status = (subprocess.run("dnf remove --setopt=keepcache=True -y " + plugin, shell=True, check=False,
stderr=subprocess.STDOUT, stdout=outfile)).returncode
else:
print(f"Unknown architecture, expected deb or rpm, got {archi}. Exiting.")
Expand Down
13 changes: 13 additions & 0 deletions .github/workflows/as400.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ jobs:

package:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-22.04
strategy:
fail-fast: false
Expand Down Expand Up @@ -107,6 +110,7 @@ jobs:
deliver-packages:
needs: [get-environment, package]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
(contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
Expand Down Expand Up @@ -141,3 +145,12 @@ jobs:
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}

set-skip-label:
needs: [get-environment, deliver-packages]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml
14 changes: 13 additions & 1 deletion .github/workflows/connector-vmware.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,9 @@ jobs:

package:
needs: [get-environment]
if: ${{ needs.get-environment.outputs.stability != 'stable' }}
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
runs-on: ubuntu-22.04
strategy:
matrix:
Expand Down Expand Up @@ -84,6 +86,7 @@ jobs:
deliver-packages:
needs: [get-environment, package]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
(contains(fromJson('["testing", "unstable"]'), needs.get-environment.outputs.stability) || ( needs.get-environment.outputs.stability == 'stable' && github.event_name != 'workflow_dispatch')) &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
Expand Down Expand Up @@ -118,3 +121,12 @@ jobs:
stability: ${{ needs.get-environment.outputs.stability }}
release_type: ${{ needs.get-environment.outputs.release_type }}
artifactory_token: ${{ secrets.ARTIFACTORY_ACCESS_TOKEN }}

set-skip-label:
needs: [get-environment, deliver-packages]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml
18 changes: 17 additions & 1 deletion .github/workflows/docker-builder-packaging-plugins.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,14 @@ on:
- ".github/docker/packaging/*"

jobs:
create-and-push-docker:
get-environment:
uses: ./.github/workflows/get-environment.yml

dockerize:
needs: [get-environment]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
needs.get-environment.outputs.stability != 'stable'
strategy:
fail-fast: false
matrix:
Expand Down Expand Up @@ -87,3 +94,12 @@ jobs:
pull: true
push: true
tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{ matrix.image }}:latest

set-skip-label:
needs: [get-environment, dockerize]
if: |
needs.get-environment.outputs.skip_workflow == 'false' &&
! cancelled() &&
! contains(needs.*.result, 'failure') &&
! contains(needs.*.result, 'cancelled')
uses: ./.github/workflows/set-pull-request-skip-label.yml
Loading

0 comments on commit e34d52c

Please sign in to comment.