From 567775fbf134a2332dd72eda3d5a88f6471e5cd9 Mon Sep 17 00:00:00 2001 From: Sophie Depassio Date: Wed, 27 Mar 2024 17:55:42 +0100 Subject: [PATCH] Adding docker images for tests --- .../Dockerfile.packaging-plugins-alma8 | 0 .../Dockerfile.packaging-plugins-alma9 | 0 .../Dockerfile.packaging-plugins-bookworm | 0 .../Dockerfile.packaging-plugins-bullseye | 0 .../Dockerfile.packaging-plugins-centos7 | 0 .../Dockerfile.packaging-plugins-jammy | 0 .../testing/Dockerfile.testing-plugins-alma8 | 86 +++++++++++++++++++ .../testing/Dockerfile.testing-plugins-alma9 | 86 +++++++++++++++++++ .../Dockerfile.testing-plugins-bookworm | 63 ++++++++++++++ .../Dockerfile.testing-plugins-bullseye | 61 +++++++++++++ .../testing/Dockerfile.testing-plugins-jammy | 61 +++++++++++++ .../docker-builder-packaging-plugins.yml | 6 +- .../docker-builder-testing-plugins.yml | 76 ++++++++++++++++ 13 files changed, 436 insertions(+), 3 deletions(-) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma8 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-alma9 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bookworm (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-bullseye (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-centos7 (100%) rename .github/docker/{ => packaging}/Dockerfile.packaging-plugins-jammy (100%) create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma8 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-alma9 create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bookworm create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-bullseye create mode 100644 .github/docker/testing/Dockerfile.testing-plugins-jammy create mode 100644 .github/workflows/docker-builder-testing-plugins.yml diff --git a/.github/docker/Dockerfile.packaging-plugins-alma8 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma8 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma8 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma8 diff --git a/.github/docker/Dockerfile.packaging-plugins-alma9 b/.github/docker/packaging/Dockerfile.packaging-plugins-alma9 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-alma9 rename to .github/docker/packaging/Dockerfile.packaging-plugins-alma9 diff --git a/.github/docker/Dockerfile.packaging-plugins-bookworm b/.github/docker/packaging/Dockerfile.packaging-plugins-bookworm similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bookworm rename to .github/docker/packaging/Dockerfile.packaging-plugins-bookworm diff --git a/.github/docker/Dockerfile.packaging-plugins-bullseye b/.github/docker/packaging/Dockerfile.packaging-plugins-bullseye similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-bullseye rename to .github/docker/packaging/Dockerfile.packaging-plugins-bullseye diff --git a/.github/docker/Dockerfile.packaging-plugins-centos7 b/.github/docker/packaging/Dockerfile.packaging-plugins-centos7 similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-centos7 rename to .github/docker/packaging/Dockerfile.packaging-plugins-centos7 diff --git a/.github/docker/Dockerfile.packaging-plugins-jammy b/.github/docker/packaging/Dockerfile.packaging-plugins-jammy similarity index 100% rename from .github/docker/Dockerfile.packaging-plugins-jammy rename to .github/docker/packaging/Dockerfile.packaging-plugins-jammy diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma8 b/.github/docker/testing/Dockerfile.testing-plugins-alma8 new file mode 100644 index 0000000000..ebef31e77f --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma8 @@ -0,0 +1,86 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:8 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +# Install perl dependencies +dnf install -y \ + perl-Digest-MD5 \ + perl-Pod-Parser \ + perl-Net-Curl \ + perl-URI-Encode \ + perl-LWP-UserAgent-Determined \ + perl-LWP-Protocol-https \ + perl-IO-Socket-SSL \ + perl-URI \ + perl-HTTP-ProxyAutoConfig \ + perl-CryptX \ + perl-MIME-Base64 \ + perl-JSON-XS \ + perl-JSON-Path \ + perl-KeePass-Reader \ + perl-Storable \ + perl-POSIX-strftime-Compiler \ + perl-Encode + +dnf clean all + +EOF + +WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-alma9 b/.github/docker/testing/Dockerfile.testing-plugins-alma9 new file mode 100644 index 0000000000..0b064f1258 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-alma9 @@ -0,0 +1,86 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/almalinux:9 + +RUN bash -e <> /etc/yum.repos.d/centreon-plugins.repo + +# Install perl dependencies +dnf install -y \ + perl-Digest-MD5 \ + perl-Pod-Parser \ + perl-Net-Curl \ + perl-URI-Encode \ + perl-LWP-UserAgent-Determined \ + perl-LWP-Protocol-https \ + perl-IO-Socket-SSL \ + perl-URI \ + perl-HTTP-ProxyAutoConfig \ + perl-CryptX \ + perl-MIME-Base64 \ + perl-JSON-XS \ + perl-JSON-Path \ + perl-KeePass-Reader \ + perl-Storable \ + perl-POSIX-strftime-Compiler \ + perl-Encode + +dnf clean all + +EOF + +WORKDIR /tests diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bookworm b/.github/docker/testing/Dockerfile.testing-plugins-bookworm new file mode 100644 index 0000000000..26774d89fe --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bookworm @@ -0,0 +1,63 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bookworm + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +# Install perl dependencies +apt-get install -y \ + libpod-parser-perl \ + libnet-curl-perl \ + liburi-encode-perl \ + libwww-perl \ + liblwp-protocol-https-perl \ + libhttp-cookies-perl \ + libio-socket-ssl-perl \ + liburi-perl \ + libhttp-proxypac-perl \ + libcryptx-perl \ + libjson-xs-perl \ + libjson-path-perl \ + libcrypt-argon2-perl \ + libkeepass-reader-perl \ + libdatetime-perl + +apt-get update +apt-get clean + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-bullseye b/.github/docker/testing/Dockerfile.testing-plugins-bullseye new file mode 100644 index 0000000000..886ec04c74 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-bullseye @@ -0,0 +1,61 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/debian:bullseye + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +# Install perl dependencies +apt-get install -y \ + libpod-parser-perl \ + libnet-curl-perl \ + liburi-encode-perl \ + libwww-perl \ + liblwp-protocol-https-perl \ + libhttp-cookies-perl \ + libio-socket-ssl-perl \ + liburi-perl \ + libhttp-proxypac-perl \ + libcryptx-perl \ + libjson-xs-perl \ + libjson-path-perl \ + libcrypt-argon2-perl \ + libkeepass-reader-perl \ + libdatetime-perl + +apt-get update +apt-get clean + +EOF diff --git a/.github/docker/testing/Dockerfile.testing-plugins-jammy b/.github/docker/testing/Dockerfile.testing-plugins-jammy new file mode 100644 index 0000000000..ff1c5cdb51 --- /dev/null +++ b/.github/docker/testing/Dockerfile.testing-plugins-jammy @@ -0,0 +1,61 @@ +ARG REGISTRY_URL + +FROM ${REGISTRY_URL}/ubuntu:jammy + +ENV DEBIAN_FRONTEND noninteractive + +# fix locale +RUN bash -e < /dev/null 2>&1 +apt-get update + +# Install perl dependencies +apt-get install -y \ + libpod-parser-perl \ + libnet-curl-perl \ + liburi-encode-perl \ + libwww-perl \ + liblwp-protocol-https-perl \ + libhttp-cookies-perl \ + libio-socket-ssl-perl \ + liburi-perl \ + libhttp-proxypac-perl \ + libcryptx-perl \ + libjson-xs-perl \ + libjson-path-perl \ + libcrypt-argon2-perl \ + libkeepass-reader-perl \ + libdatetime-perl + +apt-get update +apt-get clean + +EOF diff --git a/.github/workflows/docker-builder-packaging-plugins.yml b/.github/workflows/docker-builder-packaging-plugins.yml index f55989d4b5..99cdb0da5e 100644 --- a/.github/workflows/docker-builder-packaging-plugins.yml +++ b/.github/workflows/docker-builder-packaging-plugins.yml @@ -11,11 +11,11 @@ on: - develop paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" pull_request: paths: - ".github/workflows/docker-builder-packaging-plugins.yml" - - ".github/docker/*" + - ".github/docker/packaging/*" jobs: create-and-push-docker: @@ -68,7 +68,7 @@ jobs: - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 with: - file: .github/docker/Dockerfile.${{ matrix.dockerfile }} + file: .github/docker/packaging/Dockerfile.${{ matrix.dockerfile }} context: . build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" pull: true diff --git a/.github/workflows/docker-builder-testing-plugins.yml b/.github/workflows/docker-builder-testing-plugins.yml new file mode 100644 index 0000000000..d2960ed481 --- /dev/null +++ b/.github/workflows/docker-builder-testing-plugins.yml @@ -0,0 +1,76 @@ +name: docker-builder-packaging-plugins + +concurrency: + group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + +on: + workflow_dispatch: + push: + branches: + - develop + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + pull_request: + paths: + - ".github/workflows/docker-builder-testing-plugins.yml" + - ".github/docker/testing/*" + +jobs: + create-and-push-docker: + strategy: + matrix: + include: + - runner: ubuntu-22.04 + dockerfile: centos7 + image: centos7 + - runner: ubuntu-22.04 + dockerfile: alma8 + image: alma8 + - runner: ubuntu-22.04 + dockerfile: alma9 + image: alma9 + - runner: ubuntu-22.04 + dockerfile: bullseye + image: bullseye + - runner: ["self-hosted", "collect-arm64"] + dockerfile: bullseye + image: bullseye-arm64 + - runner: ubuntu-22.04 + dockerfile: bookworm + image: bookworm + - runner: ubuntu-22.04 + dockerfile: jammy + image: jammy + + runs-on: ${{ matrix.runner }} + + steps: + - name: Checkout sources + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Login to Registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - name: Login to proxy registry + uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 + with: + registry: ${{ vars.DOCKER_PROXY_REGISTRY_URL }} + username: ${{ secrets.DOCKER_REGISTRY_ID }} + password: ${{ secrets.DOCKER_REGISTRY_PASSWD }} + + - uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 + + - uses: docker/build-push-action@4a13e500e55cf31b7a5d59a38ab2040ab0f42f56 # v5.1.0 + with: + file: .github/docker/testing/Dockerfile.testing-plugins-${{ matrix.dockerfile }} + context: . + build-args: "REGISTRY_URL=${{ vars.DOCKER_PROXY_REGISTRY_URL }}" + pull: true + push: true + tags: ${{ vars.DOCKER_INTERNAL_REGISTRY_URL }}/testing-plugins-${{ matrix.image }}:latest