From 6364819b3d8b52456ab1dcd6ccdcb5476646467a4b79fc080b6f31027cc37e80 Mon Sep 17 00:00:00 2001 From: Andrii Nikitin Date: Fri, 30 Jan 2026 02:30:32 +0100 Subject: [PATCH 1/2] Add make commands for pre-building workflow-pr --- .gitignore | 1 + Makefile | 57 ++++++++++++++++++++++++++++++++++++--- workflow-pr/entrypoint.sh | 2 +- 3 files changed, 55 insertions(+), 5 deletions(-) diff --git a/.gitignore b/.gitignore index f2ec759..d6ee9df 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,4 @@ rabbitmq-data workflow-pr-repos __pycache__/ /workflow-pr/workflow-pr +/build diff --git a/Makefile b/Makefile index 99d7223..d6b8f5a 100644 --- a/Makefile +++ b/Makefile @@ -1,12 +1,61 @@ -up: - podman-compose up +# We want to be able to test in four **modes**: +# A. bots are used from official package as defined in */Dockerfile.package +# B. bots are build from source of upstream gitea repo (aka bots-obs) +# C. bots are build from source of forked gitea repo (aka bots-ibs) +# D. bots are just build locally from custom gitea fork/branch +# +# Switching between modes may require command: podman-compose build workflow-pr (sometimes used below explicitly) + +# this will just use prebuilt containers, works for all modes +up: + podman-compose up -d + +# tear down in all modes should look thes same down: podman-compose down +# mode A +up-bots-package: + GIWTF_WORKFLOW_PR_IMAGE_SUFFIX=.package podman-compose up -d + +# modes B C D depending on pre-built binaries located in corresponding folder(s) +# as defined in */Dockerfile.local +up-bots-local: + GIWTF_WORKFLOW_PR_IMAGE_SUFFIX=.local podman-compose up -d + rmi: podman rmi -f $$(podman images --filter=reference='giwtf_*' -q) -up-local-bots: - GIWTF_WORKFLOW_PR_IMAGE_SUFFIX=.local podman-compose up --force-recreate --build +up-obs: down bots-obs-build up-bots-local +up-ibs: down bots-ibs-build up-bots-local + + +BOT_PRJ_ORG=git-workflow +BOT_PRJ_BRANCH=main + +# prepares binaries for mode B, will not rebuild it unless bots-obs-clean is used +bots-obs-build: bots-build +# make sure the binaries are rebuild on next run for mode B +bots-obs-clean: bots-clean + +# this just defines some variables, do not use explicitly +bots-ibs%: BOT_PRJ_ORG=adrianSuSe +bots-ibs%: BOT_PRJ_BRANCH=ibs_state + +# prepares binaries for mode C, will not rebuild it unless bots-ibs-clean is used +bots-ibs-build: bots-build +# make sure the binaries are rebuild on next run for mode B +bots-ibs-clean: bots-clean + + +bots-build: + mkdir -p build/${BOT_PRJ_ORG} + if test -d build/${BOT_PRJ_ORG}/autogits; then :; else git clone https://src.opensuse.org/${BOT_PRJ_ORG}/autogits -b ${BOT_PRJ_BRANCH} build/${BOT_PRJ_ORG}/autogits; fi + ( cd build/${BOT_PRJ_ORG}/autogits/workflow-pr; go build ) + cp build/${BOT_PRJ_ORG}/autogits/workflow-pr/workflow-pr workflow-pr + GIWTF_WORKFLOW_PR_IMAGE_SUFFIX=.local podman-compose build workflow-pr + +bots-clean: + rm -rf --interactive=once build/${BOT_PRJ_ORG}/autogits diff --git a/workflow-pr/entrypoint.sh b/workflow-pr/entrypoint.sh index 583b4cb..bc073a7 100644 --- a/workflow-pr/entrypoint.sh +++ b/workflow-pr/entrypoint.sh @@ -60,6 +60,6 @@ exe=${exe:-/usr/local/bin/workflow-pr} package=$(rpm -qa | grep autogits-workflow-pr) || : -echo !!!!!!!!!!!!!!!! using binary $exe; installed package: $package +echo "!!!!!!!!!!!!!!!! using binary $exe; installed package: $package" exec "$exe" "$@" -- 2.51.1 From 175845f7c6bbebba7bdb990d8780af802aea357275ac3510f42adffb97a2f599 Mon Sep 17 00:00:00 2001 From: Andrii Nikitin Date: Fri, 30 Jan 2026 17:26:55 +0100 Subject: [PATCH 2/2] workflow-pr now prints info about build when available So the log will include output like following: !!!!!!!!!!!!!!!! using binary /usr/local/bin/workflow-pr; installed package: build vcs.revision=23d06b9f6b07ade27eda90473f67fe4101b528f49420d325f80cce77a5047f90 build vcs.time=2026-01-29T07:54:35Z build vcs.modified=false --- workflow-pr/Dockerfile.local | 2 +- workflow-pr/entrypoint.sh | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/workflow-pr/Dockerfile.local b/workflow-pr/Dockerfile.local index 09dbcc6..de7c3a8 100644 --- a/workflow-pr/Dockerfile.local +++ b/workflow-pr/Dockerfile.local @@ -6,7 +6,7 @@ COPY rabbitmq-config/certs/cert.pem /usr/share/pki/trust/anchors/gitea-rabbitmq- RUN update-ca-certificates # Install git and ssh -RUN zypper -n in git-core openssh-clients +RUN zypper -n in git-core openssh-clients binutils # Copy the pre-built binary into the container COPY workflow-pr/workflow-pr /usr/local/bin/workflow-pr diff --git a/workflow-pr/entrypoint.sh b/workflow-pr/entrypoint.sh index bc073a7..04b3361 100644 --- a/workflow-pr/entrypoint.sh +++ b/workflow-pr/entrypoint.sh @@ -61,5 +61,6 @@ exe=${exe:-/usr/local/bin/workflow-pr} package=$(rpm -qa | grep autogits-workflow-pr) || : echo "!!!!!!!!!!!!!!!! using binary $exe; installed package: $package" +which strings > /dev/null 2>&1 && strings "$exe" | grep -A 2 vcs.revision= | head -4 || : exec "$exe" "$@" -- 2.51.1