Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update personality automatically #23

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions .github/workflows/run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
35 changes: 35 additions & 0 deletions .github/workflows/update.yaml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 2 additions & 0 deletions .shellcheckrc
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# disable "not following /etc/os-release" warning
disable=SC1091
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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"]
6 changes: 6 additions & 0 deletions test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
20 changes: 20 additions & 0 deletions update.sh
Original file line number Diff line number Diff line change
@@ -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