From fd2a5a150a13a40c9e4aed9576f2f5f082cb4c5c Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Wed, 22 May 2024 20:54:41 +0200 Subject: [PATCH 1/2] Update personality manually --- .github/workflows/update.yaml | 35 +++++++++++++++++++++++++++++++++++ .shellcheckrc | 2 ++ Dockerfile | 1 + test.sh | 6 ++++++ update.sh | 20 ++++++++++++++++++++ 5 files changed, 64 insertions(+) create mode 100644 .github/workflows/update.yaml create mode 100644 .shellcheckrc create mode 100755 update.sh diff --git a/.github/workflows/update.yaml b/.github/workflows/update.yaml new file mode 100644 index 0000000..ff06a43 --- /dev/null +++ b/.github/workflows/update.yaml @@ -0,0 +1,35 @@ +name: Update personality + +on: + workflow_dispatch: + +jobs: + update: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + builder: + - autoconf + - meson + name: Update personality (${{ matrix.builder }}) + steps: + - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@d70bba72b1f3fd22344832f00baa16ece964efeb # v3.3.0 + - name: Build Dockerfile + uses: docker/build-push-action@2cdde995de11925a030ce8070c3d77a52ffcf1c0 # v5.3.0 + with: + context: . + load: true + push: false + tags: buildfarm-client:alpine + - name: Update OS and Compiler versions + run: | + docker run --rm \ + -e ANIMAL=${{ matrix.builder == 'autoconf' && vars.AUTOCONF_ANIMAL || vars.MESON_ANIMAL }} \ + -e SECRET=${{ matrix.builder == 'autoconf' && secrets.AUTOCONF_SECRET || secrets.MESON_SECRET }} \ + --entrypoint "" \ + buildfarm-client:alpine \ + ./update.sh \ + --config ${{ matrix.builder }}.conf diff --git a/.shellcheckrc b/.shellcheckrc new file mode 100644 index 0000000..fe24a7e --- /dev/null +++ b/.shellcheckrc @@ -0,0 +1,2 @@ +# disable "not following /etc/os-release" warning +disable=SC1091 diff --git a/Dockerfile b/Dockerfile index 2aa7f49..676a9b8 100644 --- a/Dockerfile +++ b/Dockerfile @@ -53,6 +53,7 @@ RUN git apply client.patch COPY docker-entrypoint.sh / COPY *.conf /usr/src +COPY update.sh /usr/src ENTRYPOINT ["/sbin/tini", "--", "/docker-entrypoint.sh"] CMD ["--test", "--config", "autoconf.conf"] diff --git a/test.sh b/test.sh index 8ba70db..38a27ca 100755 --- a/test.sh +++ b/test.sh @@ -5,6 +5,12 @@ set -eu docker build . +docker run --rm \ + --entrypoint "" \ + "$(docker build -q .)" \ + ./update.sh \ + --config autoconf.conf + rm -rf source git clone --depth 1 https://github.com/postgres/postgres.git source diff --git a/update.sh b/update.sh new file mode 100755 index 0000000..ed24660 --- /dev/null +++ b/update.sh @@ -0,0 +1,20 @@ +#!/usr/bin/env sh +set -e + +# This script is run to update the OS and Compiler versions automatically. +# It depends on the server-side making those requests idempotent. +# This runs inside the docker container. + +. /etc/os-release +OS_VERSION="$VERSION_ID" +COMPILER_VERSION="$(gcc -dumpfullversion)" + +echo "OS: $OS_VERSION" +echo "Compiler: $COMPILER_VERSION" + +if [ -n "$SECRET" ]; then + echo ./update_personality.pl \ + --os-version="$OS_VERSION" \ + --compiler-version="$COMPILER_VERSION" \ + "$@" +fi From f1529236d2022d2e7934a5b87b434301a377d5bf Mon Sep 17 00:00:00 2001 From: Wolfgang Walther Date: Fri, 29 Mar 2024 13:15:50 +0100 Subject: [PATCH 2/2] Update personality automatically --- .github/workflows/run.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/run.yaml b/.github/workflows/run.yaml index 6b2c6cb..293229c 100644 --- a/.github/workflows/run.yaml +++ b/.github/workflows/run.yaml @@ -39,6 +39,16 @@ jobs: load: true push: false tags: buildfarm-client:alpine + - name: Update OS and Compiler versions + if: matrix.branch == 'HEAD' + run: | + docker run --rm \ + -e ANIMAL=${{ matrix.builder == 'autoconf' && vars.AUTOCONF_ANIMAL || vars.MESON_ANIMAL }} \ + -e SECRET=${{ matrix.builder == 'autoconf' && secrets.AUTOCONF_SECRET || secrets.MESON_SECRET }} \ + --entrypoint "" \ + buildfarm-client:alpine \ + ./update.sh \ + --config ${{ matrix.builder }}.conf - uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6 with: repository: postgres/postgres