From 0261e4f32a5f5ee547fbd43689e074c977670361 Mon Sep 17 00:00:00 2001 From: Viktor Ashirov Date: Wed, 5 Feb 2025 20:21:04 +0100 Subject: [PATCH] Issue 6583 - Fix CI on older branches Bug Description: Test execution on older branches (1.4.x, some 2.x) fails. We use the same Fedora base image across all branches, but it contains newer toolchain and doesn't have some build dependencies. Fix Description: Use appropriate images: EL8 for 1.4.x, EL9 for 2.x, EL10/Fedora for 3.x. Fixes: https://github.com/389ds/389-ds-base/issues/6583 --- .github/scripts/generate_matrix.py | 3 + .github/workflows/compile.yml | 15 ++-- .github/workflows/lmdbpytest.yml | 124 ----------------------------- .github/workflows/npm.yml | 7 +- .github/workflows/pytest.yml | 4 +- .github/workflows/release.yml | 7 +- .github/workflows/validate.yml | 7 +- 7 files changed, 33 insertions(+), 134 deletions(-) delete mode 100644 .github/workflows/lmdbpytest.yml diff --git a/.github/scripts/generate_matrix.py b/.github/scripts/generate_matrix.py index 584374597b..52a2be6c4c 100644 --- a/.github/scripts/generate_matrix.py +++ b/.github/scripts/generate_matrix.py @@ -24,6 +24,9 @@ # Filter out snmp as it is an empty directory: suites.remove('snmp') + # Filter out webui because of broken tests + suites.remove('webui') + # Run each replication test module separately to speed things up suites.remove('replication') repl_tests = glob.glob('dirsrvtests/tests/suites/replication/*_test.py') diff --git a/.github/workflows/compile.yml b/.github/workflows/compile.yml index d46f5bf8ae..982ef6c79e 100644 --- a/.github/workflows/compile.yml +++ b/.github/workflows/compile.yml @@ -3,6 +3,11 @@ on: - pull_request - push +permissions: + actions: read + packages: read + contents: read + jobs: compile: runs-on: ubuntu-latest @@ -18,13 +23,13 @@ jobs: include: - name: GCC - image: quay.io/389ds/ci-images:fedora + image: quay.io/389ds/ci-images:el9test compiler: gcc cpp-compiler: g++ cflags: "-O2 -g" - name: GCC strict - image: quay.io/389ds/ci-images:fedora + image: quay.io/389ds/ci-images:el9test compiler: gcc cpp-compiler: g++ cflags: "-O2 -g -Wall -Wextra -Wundef -Wpointer-arith -Wfloat-equal \ @@ -32,19 +37,19 @@ jobs: -Wuninitialized -Wno-sign-compare -Wshadow -Wformat-security" - name: GCC Static Analyzer - image: quay.io/389ds/ci-images:fedora + image: quay.io/389ds/ci-images:el9test compiler: gcc cpp-compiler: g++ cflags: "-O2 -g -fanalyzer" - name: Clang - image: quay.io/389ds/ci-images:fedora + image: quay.io/389ds/ci-images:el9test compiler: clang cpp-compiler: clang++ cflags: "-O2 -g -Qunused-arguments" - name: Clang -Weverything - image: quay.io/389ds/ci-images:fedora + image: quay.io/389ds/ci-images:el9test compiler: clang cpp-compiler: clang++ cflags: "-O2 -g -Weverything -Qunused-arguments" diff --git a/.github/workflows/lmdbpytest.yml b/.github/workflows/lmdbpytest.yml deleted file mode 100644 index dae65e2238..0000000000 --- a/.github/workflows/lmdbpytest.yml +++ /dev/null @@ -1,124 +0,0 @@ -name: LMDB Test - -on: - push: - pull_request: - schedule: - - cron: '0 0 * * *' - workflow_dispatch: - inputs: - pytest_tests: - description: 'Run only specified suites or test modules delimited by space, for example "basic/basic_test.py replication"' - required: false - default: false - debug_enabled: - description: 'Set to "true" to enable debugging with tmate (https://github.com/marketplace/actions/debugging-with-tmate)' - required: false - default: false - -permissions: - actions: read - packages: read - contents: read - -jobs: - build: - name: Build - runs-on: ubuntu-22.04 - container: - image: quay.io/389ds/ci-images:test - outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Add GITHUB_WORKSPACE as a safe directory - run: git config --global --add safe.directory "$GITHUB_WORKSPACE" - - - name: Get a list of all test suites - id: set-matrix - run: echo "matrix=$(python3 .github/scripts/generate_matrix.py ${{ github.event.inputs.pytest_tests }})" >>$GITHUB_OUTPUT - - - name: Build RPMs - run: SKIP_AUDIT_CI=1 make -f rpm.mk dist-bz2 rpms - - - name: Tar build artifacts - run: tar -cvf dist.tar dist/ - - - name: Upload RPMs - uses: actions/upload-artifact@v4 - with: - name: rpms - path: dist.tar - - test: - name: LMDB Test - runs-on: ubuntu-22.04 - needs: build - strategy: - fail-fast: false - matrix: ${{ fromJson(needs.build.outputs.matrix) }} - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup tmate session - uses: mxschmitt/action-tmate@v3 - with: - limit-access-to-actor: true - if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.debug_enabled }} - - - name: Install dependencies - run: | - sudo apt update -y - sudo apt install -y docker.io containerd runc - sudo cp .github/daemon.json /etc/docker/daemon.json - sudo systemctl unmask docker - sudo systemctl start docker - - - name: Download RPMs - uses: actions/download-artifact@v4 - with: - name: rpms - - - name: Extract RPMs - run: tar xvf dist.tar - - - name: Run pytest in a container - run: | - set -x - CID=$(sudo docker run -d -h server.example.com --ulimit core=-1 --cap-add=SYS_PTRACE --privileged --rm --shm-size=4gb -v ${PWD}:/workspace quay.io/389ds/ci-images:test) - until sudo docker exec $CID sh -c "systemctl is-system-running" - do - echo "Waiting for container to be ready..." - done - sudo docker exec $CID sh -c "dnf install -y -v dist/rpms/*rpm" - export PASSWD=$(openssl rand -base64 32) - sudo docker exec $CID sh -c "echo \"${PASSWD}\" | passwd --stdin root" - sudo docker exec $CID sh -c "systemctl start dbus.service" - sudo docker exec $CID sh -c "systemctl enable --now cockpit.socket" - sudo docker exec $CID sh -c "mkdir -p /workspace/assets/cores && chmod 777 /workspace{,/assets{,/cores}}" - sudo docker exec $CID sh -c "echo '/workspace/assets/cores/core.%e.%P' > /proc/sys/kernel/core_pattern" - sudo docker exec -e WEBUI=1 -e NSSLAPD_DB_LIB=mdb -e DEBUG=pw:api -e PASSWD="${PASSWD}" $CID py.test --suppress-no-test-exit-code -m "not flaky" --junit-xml=pytest.xml --html=pytest.html --browser=firefox --browser=chromium -v dirsrvtests/tests/suites/${{ matrix.suite }} - - - name: Make the results file readable by all - if: always() - run: | - sudo chmod -f -v -R a+r pytest.*ml assets - sudo chmod -f -v a+x assets - - name: Sanitize filename - if: always() - run: echo "PYTEST_SUITE=$(echo ${{ matrix.suite }} | sed -e 's#\/#-#g')" >> $GITHUB_ENV - - - name: Upload pytest test results - if: always() - uses: actions/upload-artifact@v4 - with: - name: pytest-${{ env.PYTEST_SUITE }} - path: | - pytest.xml - pytest.html - assets - diff --git a/.github/workflows/npm.yml b/.github/workflows/npm.yml index 8c3b8fedc5..04dedcf560 100644 --- a/.github/workflows/npm.yml +++ b/.github/workflows/npm.yml @@ -6,12 +6,17 @@ on: schedule: - cron: '0 0 * * *' +permissions: + actions: read + packages: read + contents: read + jobs: npm-audit-ci: name: npm-audit-ci runs-on: ubuntu-latest container: - image: quay.io/389ds/ci-images:test + image: quay.io/389ds/ci-images:el9test steps: - name: Checkout uses: actions/checkout@v4 diff --git a/.github/workflows/pytest.yml b/.github/workflows/pytest.yml index a2a6f3224f..0374945153 100644 --- a/.github/workflows/pytest.yml +++ b/.github/workflows/pytest.yml @@ -26,7 +26,7 @@ jobs: name: Build runs-on: ubuntu-22.04 container: - image: quay.io/389ds/ci-images:test + image: quay.io/389ds/ci-images:el9test outputs: matrix: ${{ steps.set-matrix.outputs.matrix }} steps: @@ -89,7 +89,7 @@ jobs: - name: Run pytest in a container run: | set -x - CID=$(sudo docker run -d -h server.example.com --ulimit core=-1 --cap-add=SYS_PTRACE --privileged --rm --shm-size=4gb -v ${PWD}:/workspace quay.io/389ds/ci-images:test) + CID=$(sudo docker run -d -h server.example.com --ulimit core=-1 --cap-add=SYS_PTRACE --privileged --rm --shm-size=4gb -v ${PWD}:/workspace quay.io/389ds/ci-images:el9test) until sudo docker exec $CID sh -c "systemctl is-system-running" do echo "Waiting for container to be ready..." diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 64b6c01e0c..4e972597ba 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,11 +14,16 @@ on: type: boolean default: false +permissions: + actions: read + packages: read + contents: write + jobs: build: runs-on: ubuntu-latest container: - image: quay.io/389ds/ci-images:test + image: quay.io/389ds/ci-images:el9test steps: - name: Get the version id: get_version diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index e57019f581..254a8432df 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -4,11 +4,16 @@ on: push: pull_request: +permissions: + actions: read + packages: read + contents: read + jobs: validate: runs-on: ubuntu-latest container: - image: quay.io/389ds/ci-images:test + image: quay.io/389ds/ci-images:el9test steps: - name: Checkout uses: actions/checkout@v4