diff --git a/.github/scripts/collect-test-robot.sh b/.github/scripts/collect-test-robot.sh index cd0ec5f1bff..78899257e65 100755 --- a/.github/scripts/collect-test-robot.sh +++ b/.github/scripts/collect-test-robot.sh @@ -73,7 +73,6 @@ git config --global --add safe.directory $PWD echo "########################### Install Robot Framework ###########################" cd tests -pip3 install -U robotframework robotframework-databaselibrary robotframework-httpctrl robotframework-examples pymysql python-dateutil psutil if [ "$distrib" = "ALMALINUX" ]; then dnf groupinstall -y "Development Tools" @@ -84,7 +83,6 @@ else apt-get install -y python3-dev fi -pip3 install grpcio grpcio_tools py-cpuinfo cython unqlite gitpython boto3 echo "########################## Install centreon collect ###########################" cd .. diff --git a/.github/workflows/package-collect.yml b/.github/workflows/package-collect.yml index 1f295db5e35..9d7bfddfca1 100644 --- a/.github/workflows/package-collect.yml +++ b/.github/workflows/package-collect.yml @@ -23,26 +23,26 @@ jobs: fail-fast: false matrix: include: - - image: centreon-collect-alma8 - distrib: el8 - package_extension: rpm - runner: collect - arch: amd64 + # - image: centreon-collect-alma8 + # distrib: el8 + # package_extension: rpm + # runner: collect + # arch: amd64 - image: centreon-collect-alma9 distrib: el9 package_extension: rpm runner: collect arch: amd64 - - image: centreon-collect-debian-bullseye - distrib: bullseye - package_extension: deb - runner: collect - arch: amd64 - - image: centreon-collect-debian-bullseye-arm64 - distrib: bullseye - package_extension: deb - runner: collect-arm64 - arch: arm64 + # - image: centreon-collect-debian-bullseye + # distrib: bullseye + # package_extension: deb + # runner: collect + # arch: amd64 + # - image: centreon-collect-debian-bullseye-arm64 + # distrib: bullseye + # package_extension: deb + # runner: collect-arm64 + # arch: arm64 runs-on: ${{ fromJson(format('["self-hosted", "{0}"]', matrix.runner)) }} diff --git a/.github/workflows/robot-nightly.yml b/.github/workflows/robot-nightly.yml index f26f59d07b2..88db44b67f3 100644 --- a/.github/workflows/robot-nightly.yml +++ b/.github/workflows/robot-nightly.yml @@ -35,13 +35,17 @@ jobs: package: needs: [get-version] - uses: ./.github/workflows/package-collect.yml - with: - version: ${{ needs.get-version.outputs.version }}.${{ needs.get-version.outputs.patch }} - img_version: ${{ needs.get-version.outputs.img_version }} - release: ${{ needs.get-version.outputs.release }} - commit_hash: ${{ github.sha }} - secrets: inherit +# uses: ./.github/workflows/package-collect.yml + runs-on: ubuntu-22.04 + steps: + - run: | + echo fdsdfsdf + # with: + # version: ${{ needs.get-version.outputs.version }}.${{ needs.get-version.outputs.patch }} + # img_version: ${{ needs.get-version.outputs.img_version }} + # release: ${{ needs.get-version.outputs.release }} + # commit_hash: ${{ github.sha }} + # secrets: inherit robot-test: needs: [get-version, package] @@ -54,16 +58,16 @@ jobs: package_extension: rpm arch: amd64 database_type: mariadb - - distrib: el9 - image: centreon-collect-mysql-alma9-test - package_extension: rpm - arch: amd64 - database_type: mysql - - distrib: bullseye - image: centreon-collect-debian-bullseye-arm64-test - package_extension: deb - arch: arm64 - database_type: mariadb + # - distrib: el9 + # image: centreon-collect-mysql-alma9-test + # package_extension: rpm + # arch: amd64 + # database_type: mysql + # - distrib: bullseye + # image: centreon-collect-debian-bullseye-arm64-test + # package_extension: deb + # arch: arm64 + # database_type: mariadb name: robot test ${{ matrix.database_type }} ${{ matrix.distrib }} ${{ matrix.arch }} uses: ./.github/workflows/robot-test.yml diff --git a/.github/workflows/robot-test.yml b/.github/workflows/robot-test.yml index 11799b7baf3..cde98868fe0 100644 --- a/.github/workflows/robot-test.yml +++ b/.github/workflows/robot-test.yml @@ -37,30 +37,40 @@ jobs: load-test-image: runs-on: ubuntu-22.04 steps: - - name: Pull image - run: | - docker image pull ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:latest - save-image-in-cache: - runs-on: ubuntu-22.04 - steps: + - name: Login to Registry + uses: docker/login-action@v2 + with: + registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} + username: ${{ secrets.registry_username }} + password: ${{ secrets.registry_password }} + + - name: Login to Proxy Registry + uses: docker/login-action@v2 + with: + registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} + username: ${{ secrets.registry_username }} + password: ${{ secrets.registry_password }} + + - name: Download image run: | - docker save --output /tmp/${{inputs.image}} ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:${{ inputs.image_version }} + docker pull ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}} shell: bash - - name: compress image + - name: Image to disk run: | - 7z a /tmp/${{inputs.image}}.7z /tmp/${{inputs.image}} + docker save --output /tmp/${{inputs.image}} ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:latest shell: bash - - name: cache compressed image + - name: image to cache uses: actions/cache/save@v3 with: - path: /tmp/${{inputs.image}}.7z + path: /tmp/${{inputs.image}} key: ${{inputs.image}} robot-test-list: + needs: [load-test-image] runs-on: ubuntu-22.04 outputs: features: ${{ steps.list-features.outputs.features }} @@ -78,12 +88,12 @@ jobs: robot-test: needs: [robot-test-list] runs-on: ${{ contains(inputs.image, 'arm') && fromJson('["self-hosted", "collect-arm64"]') || 'ubuntu-22.04' }} - container: - image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:latest - options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined - credentials: - username: ${{ secrets.registry_username }} - password: ${{ secrets.registry_password }} + # container: + # image: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}}:latest + # options: --privileged --ulimit core=-1 --security-opt seccomp=unconfined + # credentials: + # username: ${{ secrets.registry_username }} + # password: ${{ secrets.registry_password }} strategy: fail-fast: false @@ -105,13 +115,50 @@ jobs: key: ${{ inputs.package_cache_key }} fail-on-cache-miss: true + - name: Restore image + uses: actions/cache@v3 + with: + path: /tmp/${{inputs.image}} + key: ${{inputs.image}} + fail-on-cache-miss: true + + - name: load image + run: | + docker load --input /tmp/${{inputs.image}} + # docker tag ${{inputs.image}} ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}} + + #- name: Test ${{ matrix.feature }} + # run: bash ./.github/scripts/collect-test-robot.sh ${{ matrix.feature }} ${{inputs.database_type}} + # shell: bash + # env: + # AWS_ACCESS_KEY_ID: ${{ secrets.collect_s3_access_key }} + # AWS_SECRET_ACCESS_KEY: ${{ secrets.collect_s3_secret_key }} + # AWS_BUCKET: centreon-collect-robot-report + + - name: Test1 ${{ matrix.feature }} + run: | + ls -al + + - name: Test2 ${{ matrix.feature }} + run: | + echo $(pwd) + - name: Test ${{ matrix.feature }} - run: bash ./.github/scripts/collect-test-robot.sh ${{ matrix.feature }} ${{inputs.database_type}} - shell: bash + run: | + docker run --rm -v $(pwd):/test_collect \ + --env AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID \ + --env AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY \ + --env AWS_BUCKET=centreon-collect-robot-report \ + --workdir /test_collect \ + ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/${{inputs.image}} \ + ./.github/scripts/collect-test-robot.sh \ + ${{ matrix.feature }} ${{inputs.database_type}} + + env: AWS_ACCESS_KEY_ID: ${{ secrets.collect_s3_access_key }} AWS_SECRET_ACCESS_KEY: ${{ secrets.collect_s3_secret_key }} - AWS_BUCKET: centreon-collect-robot-report + - name: Move reports if: ${{ !cancelled() }}