From 56e9ca6b6db8a09c221ccabc01971029a9ceb41f Mon Sep 17 00:00:00 2001 From: Jean Christophe Roques Date: Fri, 19 Jul 2024 14:11:19 +0200 Subject: [PATCH] add collect package --- .github/scripts/wsl-collect-test-robot.sh | 19 ++++ .../workflows/windows-agent-robot-test.yml | 92 +++++++++++++------ tests/resources/import.resource | 8 +- 3 files changed, 89 insertions(+), 30 deletions(-) create mode 100755 .github/scripts/wsl-collect-test-robot.sh diff --git a/.github/scripts/wsl-collect-test-robot.sh b/.github/scripts/wsl-collect-test-robot.sh new file mode 100755 index 00000000000..716c58a7141 --- /dev/null +++ b/.github/scripts/wsl-collect-test-robot.sh @@ -0,0 +1,19 @@ +#!/bin/bash +set -e +set -x + +export RUN_ENV=docker + + +#remove git dubious ownership +/usr/bin/git config --global --add safe.directory $PWD + +echo "###### git clone opentelemetry-proto #######" +git clone --depth=1 --single-branch https://github.com/open-telemetry/opentelemetry-proto.git opentelemetry-proto + +echo "##### Starting tests #####" +cd tests +./init-proto.sh + +echo "####################### Run Centreon Collect Robot Tests #######################" +robot ccc/ccc.robot diff --git a/.github/workflows/windows-agent-robot-test.yml b/.github/workflows/windows-agent-robot-test.yml index 8bcc8185bb9..8e8fe062a22 100644 --- a/.github/workflows/windows-agent-robot-test.yml +++ b/.github/workflows/windows-agent-robot-test.yml @@ -13,8 +13,44 @@ jobs: with: version_file: CMakeLists.txt - build-agent: + build-collect: needs: [get-version] + runs-on: [self-hosted, collect] + + env: + SCCACHE_PATH: "/usr/bin/sccache" + SCCACHE_BUCKET: "centreon-github-sccache" + SCCACHE_REGION: "eu-west-1" + AWS_ACCESS_KEY_ID: ${{ secrets.COLLECT_S3_ACCESS_KEY }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.COLLECT_S3_SECRET_KEY }} + + container: + image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/centreon-collect-debian-bullseye:${{ needs.get-version.outputs.img_version }} + credentials: + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + steps: + - name: Checkout sources + uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 + + - name: compile and package collect + uses: ./.github/actions/compile-package + with: + major_version: ${{ needs.get-version.outputs.major_version }} + minor_version: ${{ needs.get-version.outputs.minor_version }} + distrib: bullseye + package_extension: deb + arch: amd64 + release: ${{ needs.get-version.outputs.release }} + commit_hash: ${{ github.sha }} + stability: ${{ needs.get-version.outputs.stability }} + 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 }} + + build-agent: + needs: [build-collect] runs-on: windows-latest steps: - name: distrib availables @@ -25,7 +61,7 @@ jobs: with: distribution: Debian use-cache: 'true' - # update: 'true' + update: 'true' additional-packages: mariadb-server libmariadb3 @@ -35,14 +71,14 @@ jobs: python3-pip rrdtool - - name: check install - run: | - Write-Host installed - wsl --list --verbose - - name: nocrlf conversion run: git config --system core.autocrlf false + - name: install robot framework + run: | + wsl pip3 install -U robotframework robotframework-databaselibrary robotframework-examples + wsl pip3 install pymysql python-dateutil grpcio grpcio_tools psutil + - name: Checkout sources uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7 @@ -50,25 +86,8 @@ jobs: run: | $current_dir = (pwd).Path $wsl_path = "/mnt/" + $current_dir.SubString(0,1).ToLower() + "/" + $current_dir.SubString(3).replace('\','/') - [System.Environment]::SetEnvironmentVariable("WSL_COLLECT_DIR", $wsl_path) - Write-Host "collect is there: " $env:WSL_COLLECT_DIR Write-Host "install mariadb" - wsl cd $env:WSL_COLLECT_DIR `&`& .github/scripts/collect-setup-database.sh - - - name: compile and package collect - uses: ./.github/actions/compile-package - with: - major_version: ${{ needs.get-version.outputs.major_version }} - minor_version: ${{ needs.get-version.outputs.minor_version }} - distrib: bullseye - package_extension: deb - arch: amd64 - release: ${{ needs.get-version.outputs.release }} - commit_hash: ${{ github.sha }} - stability: ${{ needs.get-version.outputs.stability }} - 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 }} + wsl cd $wsl_path `&`& .github/scripts/collect-setup-database.sh - name: Restore packages uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 @@ -76,4 +95,25 @@ jobs: path: ./*.deb key: ${{ github.run_id }}-${{ github.sha }}-deb-centreon-collect-bullseye-amd64-${{ github.head_ref || github.ref_name }} fail-on-cache-miss: true - \ No newline at end of file + enableCrossOsArchive: true + + - name: list packages + run: | + $current_dir = (pwd).Path + $wsl_path = "/mnt/" + $current_dir.SubString(0,1).ToLower() + "/" + $current_dir.SubString(3).replace('\','/') + wsl ls -l $wsl_path + + - name: install collect packages + run: | + $current_dir = (pwd).Path + $wsl_path = "/mnt/" + $current_dir.SubString(0,1).ToLower() + "/" + $current_dir.SubString(3).replace('\','/') + wsl cd $wsl_path `&`& dpkg -i --force-all ./*.deb + + - name: robot tests + run: | + $current_dir = (pwd).Path + $wsl_path = "/mnt/" + $current_dir.SubString(0,1).ToLower() + "/" + $current_dir.SubString(3).replace('\','/') + wsl cd $wsl_path `&`& .github/scripts/wsl-collect-test-robot.sh + + - name: collect binaries + run: wsl ls -l /usr/sbin/cbd /usr/sbin/centengine /usr/lib64/centreon-engine/ /usr/share/centreon/lib/centreon-broker \ No newline at end of file diff --git a/tests/resources/import.resource b/tests/resources/import.resource index 3114d95ce4a..ffc8672a0f2 100644 --- a/tests/resources/import.resource +++ b/tests/resources/import.resource @@ -2,19 +2,19 @@ Documentation Importation of all resources # Collection -Library Telnet +# Library Telnet Library String Library DateTime Library Collections Library DatabaseLibrary Library Examples -Library HttpCtrl.Server -Library RequestsLibrary +# Library HttpCtrl.Server +# Library RequestsLibrary # Creation Resource resources.resource # Python Library Library Engine.py Library Broker.py -Library Bench.py +# Library Bench.py Library Common.py Library specific-duplication.py