diff --git a/.github/workflows/docker-integration-tests.yaml b/.github/workflows/docker-integration-tests.yaml new file mode 100644 index 00000000..e091866d --- /dev/null +++ b/.github/workflows/docker-integration-tests.yaml @@ -0,0 +1,80 @@ +name: Docker images for integration tests + +on: +# push: +# branches: +# - master + workflow_dispatch: + +env: + PLATFORMS: "linux/amd64" + +jobs: + list-dockerfiles: + name: Create list of existing dockerfiles + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Get file list + id: set-matrix + run: | + # lists all Dockerfile_* and ignore (grep) files with extension (e.g. *.md5) + # tranforms the file list in JSON array (StackOverflow#10234327) + # converts the list into objects of dockerfile and image name + ls integration-tests/Dockerfile_* | + grep -Ev "\..{0,3}$" | + jq -R -s 'split("\n")[:-1]' | + jq '. | map({dockerfile: ., image: sub(".*_"; "")})' > filelist.json + echo "matrix=$(jq -c . filelist.json)" >> "$GITHUB_OUTPUT" + outputs: + matrix: ${{ steps.set-matrix.outputs.matrix }} + + docker: + needs: [list-dockerfiles] + name: Build and push Docker image + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + include: ${{ fromJson(needs.list-dockerfiles.outputs.matrix) }} + permissions: + packages: write + contents: read + + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Login to GHCR + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: | + ghcr.io/${{ github.repository_owner }}/${{ matrix.image }} + + - name: Build and push tag + uses: docker/build-push-action@v5 + with: + context: . + file: ${{ matrix.dockerfile }} + push: true + tags: | + ghcr.io/${{ github.repository_owner }}/${{ matrix.image }}:latest + labels: ${{ steps.meta.outputs.labels }} + platforms: ${{ env.PLATFORMS }} diff --git a/integration-tests/Dockerfile_arch b/integration-tests/Dockerfile_arch index 67833345..0f0627cd 100644 --- a/integration-tests/Dockerfile_arch +++ b/integration-tests/Dockerfile_arch @@ -1,7 +1,6 @@ -FROM base/archlinux +FROM archlinux:base MAINTAINER @siddharthist -RUN pacman -Sy --noconfirm systemd-sysvcompat RUN ln -s /does_not_exist /foo && \ chmod 700 ~root RUN mkfifo /pipe diff --git a/integration-tests/Dockerfile_arch.md5 b/integration-tests/Dockerfile_arch.md5 index 368bc9e8..aa80cc1d 100644 --- a/integration-tests/Dockerfile_arch.md5 +++ b/integration-tests/Dockerfile_arch.md5 @@ -1 +1 @@ -7743af2cd089e92858eca1715db25949 Dockerfile_arch +8fc3ce0c000f89ab09488cccb3ba8e66 Dockerfile_arch diff --git a/integration-tests/Dockerfile_wheezy b/integration-tests/Dockerfile_wheezy index 9c83d08c..f3c76e36 100644 --- a/integration-tests/Dockerfile_wheezy +++ b/integration-tests/Dockerfile_wheezy @@ -4,7 +4,9 @@ LABEL org.opencontainers.image.authors="Ahmed" RUN echo 'deb http://archive.debian.org/debian wheezy main' > /etc/apt/sources.list RUN echo 'deb http://archive.debian.org/debian-security wheezy/updates main' >> /etc/apt/sources.list -RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install -y apache2 apache2-doc apache2-utils chkconfig vim-tiny ca-certificates tinyproxy && apt-get remove -y vim-tiny && apt-get clean +RUN apt-get -o Acquire::Check-Valid-Until=false update && apt-get install --yes --force-yes \ + apache2 apache2-doc apache2-utils chkconfig vim-tiny ca-certificates tinyproxy && \ + apt-get remove -y vim-tiny && apt-get clean RUN chkconfig apache2 on RUN chkconfig tinyproxy on diff --git a/integration-tests/Dockerfile_wheezy.md5 b/integration-tests/Dockerfile_wheezy.md5 index 84e9e5dd..fd678787 100644 --- a/integration-tests/Dockerfile_wheezy.md5 +++ b/integration-tests/Dockerfile_wheezy.md5 @@ -1 +1 @@ -557a19e04e66f0a9afb6035952b5ca18 Dockerfile_wheezy +3775dbcd23497095da8f5b7ddb62a540 Dockerfile_wheezy diff --git a/integration-tests/goss/rockylinux9/goss-aa-expected.yaml b/integration-tests/goss/rockylinux9/goss-aa-expected.yaml index 38c05599..a5e1aa63 100644 --- a/integration-tests/goss/rockylinux9/goss-aa-expected.yaml +++ b/integration-tests/goss/rockylinux9/goss-aa-expected.yaml @@ -2,7 +2,7 @@ package: httpd: installed: true versions: - - 2.4.57-11.el9_4 + - 2.4.57-11.el9_4.1 port: tcp:80: listening: true diff --git a/integration-tests/goss/rockylinux9/goss-expected.yaml b/integration-tests/goss/rockylinux9/goss-expected.yaml index 9a1bacb1..0e950c20 100644 --- a/integration-tests/goss/rockylinux9/goss-expected.yaml +++ b/integration-tests/goss/rockylinux9/goss-expected.yaml @@ -15,7 +15,7 @@ package: httpd: installed: true versions: - - 2.4.57-11.el9_4 + - 2.4.57-11.el9_4.1 vim-tiny: installed: false addr: diff --git a/integration-tests/goss/vars.yaml b/integration-tests/goss/vars.yaml index 23b0c3b0..0686fd1a 100644 --- a/integration-tests/goss/vars.yaml +++ b/integration-tests/goss/vars.yaml @@ -16,7 +16,7 @@ centos7: rockylinux9: proxy: http://127.0.0.1:8888 packages: - httpd: "2.4.57-11.el9_4" + httpd: "2.4.57-11.el9_4.1" services: httpd: [] trusty: