From 373f1ef0172f9703de7c70be12be4d9f1c9726cf Mon Sep 17 00:00:00 2001 From: Kevin Duret Date: Tue, 27 Aug 2024 13:16:13 +0200 Subject: [PATCH] fix(ci): move files from ci directory to .github (#1644) --- .../docker/Dockerfile.collect-alma8 | 0 .../docker/Dockerfile.collect-centos7 | 0 .../docker/Dockerfile.collect-debian-bullseye | 0 .../scripts/collect-deb-package.sh | 0 .../scripts/collect-rpm-package.sh | 0 {ci => .github}/scripts/collect-unit-tests.sh | 0 .github/workflows/centreon-collect.yml | 2 +- .github/workflows/docker-builder.yml | 6 +- .github/workflows/package-collect.yml | 4 +- ci/release/collect-release.sh | 29 -------- ci/scripts/collect-rpm-delivery.sh | 66 ------------------- ci/scripts/collect-sources-delivery.sh | 49 -------------- ci/scripts/collect-test-robot.sh | 66 ------------------- 13 files changed, 6 insertions(+), 216 deletions(-) rename {ci => .github}/docker/Dockerfile.collect-alma8 (100%) rename {ci => .github}/docker/Dockerfile.collect-centos7 (100%) rename {ci => .github}/docker/Dockerfile.collect-debian-bullseye (100%) rename {ci => .github}/scripts/collect-deb-package.sh (100%) rename {ci => .github}/scripts/collect-rpm-package.sh (100%) rename {ci => .github}/scripts/collect-unit-tests.sh (100%) delete mode 100755 ci/release/collect-release.sh delete mode 100755 ci/scripts/collect-rpm-delivery.sh delete mode 100755 ci/scripts/collect-sources-delivery.sh delete mode 100755 ci/scripts/collect-test-robot.sh diff --git a/ci/docker/Dockerfile.collect-alma8 b/.github/docker/Dockerfile.collect-alma8 similarity index 100% rename from ci/docker/Dockerfile.collect-alma8 rename to .github/docker/Dockerfile.collect-alma8 diff --git a/ci/docker/Dockerfile.collect-centos7 b/.github/docker/Dockerfile.collect-centos7 similarity index 100% rename from ci/docker/Dockerfile.collect-centos7 rename to .github/docker/Dockerfile.collect-centos7 diff --git a/ci/docker/Dockerfile.collect-debian-bullseye b/.github/docker/Dockerfile.collect-debian-bullseye similarity index 100% rename from ci/docker/Dockerfile.collect-debian-bullseye rename to .github/docker/Dockerfile.collect-debian-bullseye diff --git a/ci/scripts/collect-deb-package.sh b/.github/scripts/collect-deb-package.sh similarity index 100% rename from ci/scripts/collect-deb-package.sh rename to .github/scripts/collect-deb-package.sh diff --git a/ci/scripts/collect-rpm-package.sh b/.github/scripts/collect-rpm-package.sh similarity index 100% rename from ci/scripts/collect-rpm-package.sh rename to .github/scripts/collect-rpm-package.sh diff --git a/ci/scripts/collect-unit-tests.sh b/.github/scripts/collect-unit-tests.sh similarity index 100% rename from ci/scripts/collect-unit-tests.sh rename to .github/scripts/collect-unit-tests.sh diff --git a/.github/workflows/centreon-collect.yml b/.github/workflows/centreon-collect.yml index 7c576bba73f..f5eaddd61ab 100644 --- a/.github/workflows/centreon-collect.yml +++ b/.github/workflows/centreon-collect.yml @@ -78,7 +78,7 @@ jobs: uses: ./.github/actions/runner-docker with: registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} - script_name: /src/ci/scripts/collect-unit-tests + script_name: /src/.github/scripts/collect-unit-tests image_name: centreon-collect-${{ matrix.image }} image_version: ${{ needs.get-version.outputs.img_version }} diff --git a/.github/workflows/docker-builder.yml b/.github/workflows/docker-builder.yml index ec7e9c15cc8..d7121d7e90b 100644 --- a/.github/workflows/docker-builder.yml +++ b/.github/workflows/docker-builder.yml @@ -11,10 +11,10 @@ on: - develop - dev-[2-9][0-9].[0-9][0-9].x paths: - - 'ci/docker/**' + - '.github/docker/**' pull_request: paths: - - 'ci/docker/**' + - '.github/docker/**' jobs: get-version: @@ -56,7 +56,7 @@ jobs: - uses: docker/build-push-action@15560696de535e4014efeff63c48f16952e52dd1 # v6.2.0 with: - file: ci/docker/Dockerfile.${{ matrix.project }}-${{ matrix.distrib }} + file: .github/docker/Dockerfile.${{ matrix.project }}-${{ matrix.distrib }} context: . build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" pull: true diff --git a/.github/workflows/package-collect.yml b/.github/workflows/package-collect.yml index 085d534bcce..17ebf353c39 100644 --- a/.github/workflows/package-collect.yml +++ b/.github/workflows/package-collect.yml @@ -48,7 +48,7 @@ jobs: - name: package rpm ${{ matrix.image }} run: | - docker run -i --entrypoint ./ci/scripts/collect-rpm-package.sh \ + docker run -i --entrypoint ./.github/scripts/collect-rpm-package.sh \ -v "$PWD:/src" \ -e DISTRIB="${{ matrix.distrib }}" \ -e VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}" \ @@ -113,7 +113,7 @@ jobs: uses: ./centreon-collect/.github/actions/runner-docker with: registry_url: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} - script_name: centreon-collect/ci/scripts/collect-deb-package + script_name: centreon-collect/.github/scripts/collect-deb-package image_name: centreon-collect-${{ matrix.image }} image_version: ${{ inputs.img_version }} env_variable: -e DISTRIB="${{ matrix.distrib }}" -e VERSION="${{ inputs.major_version }}.${{ inputs.minor_version }}" -e RELEASE="${{ inputs.release }}" diff --git a/ci/release/collect-release.sh b/ci/release/collect-release.sh deleted file mode 100755 index eb5ef26da08..00000000000 --- a/ci/release/collect-release.sh +++ /dev/null @@ -1,29 +0,0 @@ -#!/bin/bash -set -e -set -x - -source common.sh - -# Check arguments -if [ -z "$VERSION" -o -z "$RELEASE" ] ; then - echo "You need to specify VERSION / RELEASE variables" - exit 1 -fi - -MAJOR=`echo $VERSION | cut -d . -f 1,2` - -# Move sources to the stable directory. -ssh -o StrictHostKeyChecking=no ubuntu@srvi-repo.int.centreon.com cp -r "/srv/sources/standard/testing/centreon-collect/centreon-collect-$VERSION-$RELEASE" "/srv/sources/standard/stable/" - -# Put sources online. -upload_tarball_for_download "centreon-collect" "$VERSION" "/srv/sources/standard/stable/centreon-collect-$VERSION-$RELEASE/centreon-collect-$VERSION-$RELEASE.tar.gz" "s3://centreon-download/public/centreon-collect/centreon-collect-$VERSION.tar.gz" "$1" - -# Move RPMs to the stable repository. -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el7" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el8" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el7" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el8" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el7" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el8" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el7" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" -promote_rpms_from_testing_to_stable "standard" "$MAJOR" "el8" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" diff --git a/ci/scripts/collect-rpm-delivery.sh b/ci/scripts/collect-rpm-delivery.sh deleted file mode 100755 index 46967a02f91..00000000000 --- a/ci/scripts/collect-rpm-delivery.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -e -set -x - -source common.sh - -# Check arguments -if [ -z "$VERSION" -o -z "$RELEASE" ] ; then - echo "You need to specify VERSION / RELEASE variables" - exit 1 -fi - -MAJOR=`echo $VERSION | cut -d . -f 1,2` -COLLECTEL7RPMS=`echo output/*collect*.el7.*.rpm` -COLLECTEL8RPMS=`echo output/*collect*.el8.*.rpm` -ENGINEEL7RPMS=`echo output/*engine*.el7.*.rpm` -ENGINEEL8RPMS=`echo output/*engine*.el8.*.rpm` -BROKEREL7RPMS=`echo output/*broker*.el7.*.rpm` -BROKEREL8RPMS=`echo output/*broker*.el8.*.rpm` -CLIBEL7RPMS=`echo output/*clib*.el7.*.rpm` -CLIBEL8RPMS=`echo output/*clib*.el8.*.rpm` -CONNECTOREL7RPMS=`echo output/*connector*.el7.*.rpm` -CONNECTOREL8RPMS=`echo output/*connector*.el8.*.rpm` - -# Publish RPMs -if [ "$BUILD" '=' 'QA' ] -then - put_rpms "standard" "$MAJOR" "el7" "unstable" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "unstable" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "unstable" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "unstable" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "unstable" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL7RPMS - - put_rpms "standard" "$MAJOR" "el8" "unstable" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "unstable" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "unstable" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "unstable" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "unstable" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL8RPMS -elif [ "$BUILD" '=' 'RELEASE' ] -then - copy_internal_source_to_testing "standard" "centreon-collect" "centreon-collect-$VERSION-$RELEASE" - put_rpms "standard" "$MAJOR" "el7" "testing" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "testing" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "testing" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "testing" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "testing" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL7RPMS - - put_rpms "standard" "$MAJOR" "el8" "testing" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "testing" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "testing" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "testing" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "testing" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL8RPMS - -else - put_rpms "standard" "$MAJOR" "el7" "canary" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "canary" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL7RPMS - put_rpms "standard" "$MAJOR" "el7" "canary" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "canary" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL7RPMS - put_rpms "standard" "$MAJOR" "el7" "canary" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL7RPMS - - put_rpms "standard" "$MAJOR" "el8" "canary" "x86_64" "collect" "centreon-collect-$VERSION-$RELEASE" $COLLECTEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "canary" "x86_64" "engine" "centreon-engine-$VERSION-$RELEASE" $ENGINEEL8RPMS - put_rpms "standard" "$MAJOR" "el8" "canary" "x86_64" "broker" "centreon-broker-$VERSION-$RELEASE" $BROKEREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "canary" "x86_64" "connector" "centreon-connector-$VERSION-$RELEASE" $CONNECTOREL8RPMS - put_rpms "standard" "$MAJOR" "el8" "canary" "x86_64" "clib" "centreon-clib-$VERSION-$RELEASE" $CLIBEL8RPMS -fi diff --git a/ci/scripts/collect-sources-delivery.sh b/ci/scripts/collect-sources-delivery.sh deleted file mode 100755 index 47d0f2827d8..00000000000 --- a/ci/scripts/collect-sources-delivery.sh +++ /dev/null @@ -1,49 +0,0 @@ -#!/bin/bash -set -e -set -x -. ./common.sh - - -echo -n "#####The Delivered project is centreon-collect#####" -echo -n "#####GET centreon-collect VERSION#####" - -cmakelists=CMakeLists.txt - -major=`grep 'set(COLLECT_MAJOR' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1` -minor=`grep 'set(COLLECT_MINOR' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1` -patch=`grep 'set(COLLECT_PATCH' CMakeLists.txt | cut -d ' ' -f 2 | cut -d ')' -f 1` - -export VERSION="$major.$minor.$patch" -export MAJOR="$major.$minor" - - -echo -n "#####GET centreon-collect RELEASE#####" - -COMMIT=`git log -1 HEAD --pretty=format:%h` -now=`date +%s` -if [ "$BUILD" '=' 'RELEASE' ] ; then - export RELEASE="$BUILD_NUMBER" -else - export RELEASE="$now.$COMMIT" -fi - -echo -n "#####GET centreon-collect COMMITER#####" -COMMITTER=`git show --format='%cN <%cE>' HEAD | head -n 1` - - -echo -n "#####ARCHIVING centreon-collect#####" -rm -rf centreon-collect-$VERSION-$RELEASE.tar.gz -tar czf "centreon-collect-$VERSION-$RELEASE.tar.gz" * - -echo -n "#####DELIVER centreon-collect SOURCES#####" -put_internal_source "centreon-collect" "centreon-collect-$VERSION-$RELEASE" "centreon-collect-$VERSION-$RELEASE.tar.gz" - -echo -n "#####EXPORTING centreon-collect GLOBAL VARIABLES#####" -cat > source.properties << EOF -PROJECT=centreon-collect -VERSION=$VERSION -RELEASE=$RELEASE -COMMIT=$COMMIT -COMMITTER=$COMMITTER -MAJOR=$MAJOR -EOF diff --git a/ci/scripts/collect-test-robot.sh b/ci/scripts/collect-test-robot.sh deleted file mode 100755 index 4e384ad2744..00000000000 --- a/ci/scripts/collect-test-robot.sh +++ /dev/null @@ -1,66 +0,0 @@ -#!/bin/bash -set -e -set -x - -export RUN_ENV=docker - -echo "########################### Configure and start sshd ###########################" -ssh-keygen -t rsa -f /etc/ssh/ssh_host_rsa_key -P "" -ssh-keygen -t ecdsa -f /etc/ssh/ssh_host_ecdsa_key -P "" -ssh-keygen -t ed25519 -f /etc/ssh/ssh_host_ed25519_key -P "" -/usr/sbin/sshd > /dev/null 2>&1 & - -echo "########################### Start MariaDB ######################################" -mariadbd --user=root > /dev/null 2>&1 & -sleep 5 - -echo "########################### Init centreon database ############################" - -mysql -e "CREATE USER IF NOT EXISTS 'centreon'@'localhost' IDENTIFIED BY 'centreon';" - -mysql -e "GRANT SELECT,UPDATE,DELETE,INSERT,CREATE,DROP,INDEX,ALTER,LOCK TABLES,CREATE TEMPORARY TABLES, EVENT,CREATE VIEW ON *.* TO 'centreon'@'localhost';" -mysql -e "CREATE USER IF NOT EXISTS 'root_centreon'@'localhost' IDENTIFIED BY 'centreon';" -mysql -e "GRANT ALL PRIVILEGES ON *.* TO 'root_centreon'@'localhost'" - -cat resources/centreon.sql | sed "s/DBNameConf/centreon/g" > /tmp/centreon.sql - -mysql -u centreon -pcentreon < resources/centreon_storage.sql -mysql -u centreon -pcentreon < resources/centreon.sql - -echo "########################## Install centreon collect ###########################" - -echo "Installation..." -/usr/bin/rpm -Uvvh --force --nodeps *.rpm - -echo "########################### Install Robot Framework ###########################" -yum groupinstall "Development Tools" -y -yum install python3-devel -y - -cd /src/tests/ -pip3 install -U robotframework robotframework-databaselibrary pymysql python-dateutil psutil - -# Get OS version id -VERSION_ID=$(grep '^VERSION_ID' /etc/os-release | sed -En 's/^VERSION_ID="([[:digit:]])\.[[:digit:]]"/\1/p') - -# Force version for el7 only -if [ -f /etc/os-release ]; then - case "$VERSION_ID" in - 8) - pip3 install grpcio grpcio_tools - ;; - *) - pip3 install grpcio==1.33.2 grpcio_tools==1.33.2 - ;; - esac -fi - -./init-proto.sh - -echo "####################### Run Centreon Collect Robot Tests #######################" -cd /src/tests/ -robot --nostatusrc . - -echo "########################### Generate Folder Report #############################" -mkdir reports -cp log.html output.xml report.html reports -