diff --git a/.gitignore b/.gitignore index a5ba94c..f2ec759 100644 --- a/.gitignore +++ b/.gitignore @@ -3,3 +3,4 @@ gitea-logs rabbitmq-data workflow-pr-repos __pycache__/ +/workflow-pr/workflow-pr diff --git a/Makefile b/Makefile new file mode 100644 index 0000000..99d7223 --- /dev/null +++ b/Makefile @@ -0,0 +1,12 @@ +up: + podman-compose up + +down: + podman-compose down + +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 + diff --git a/podman-compose.yml b/podman-compose.yml index 7a0f967..8ca7e08 100644 --- a/podman-compose.yml +++ b/podman-compose.yml @@ -73,7 +73,7 @@ services: workflow-pr: build: context: . - dockerfile: workflow-pr/Dockerfile + dockerfile: workflow-pr/Dockerfile${GIWTF_WORKFLOW_PR_IMAGE_SUFFIX} container_name: workflow-pr networks: - gitea-network diff --git a/tests/__pycache__/test_pr_workflow.cpython-313-pytest-9.0.2.pyc b/tests/__pycache__/test_pr_workflow.cpython-313-pytest-9.0.2.pyc deleted file mode 100644 index f1fdc50..0000000 Binary files a/tests/__pycache__/test_pr_workflow.cpython-313-pytest-9.0.2.pyc and /dev/null differ diff --git a/workflow-pr/Dockerfile b/workflow-pr/Dockerfile deleted file mode 100644 index 09dbcc6..0000000 --- a/workflow-pr/Dockerfile +++ /dev/null @@ -1,17 +0,0 @@ -# Use the same base image as the Gitea container -FROM registry.suse.com/bci/bci-base:15.7 - -# Add the custom CA to the trust store -COPY rabbitmq-config/certs/cert.pem /usr/share/pki/trust/anchors/gitea-rabbitmq-ca.crt -RUN update-ca-certificates - -# Install git and ssh -RUN zypper -n in git-core openssh-clients - -# Copy the pre-built binary into the container -COPY workflow-pr/workflow-pr /usr/local/bin/workflow-pr -COPY workflow-pr/entrypoint.sh /usr/local/bin/entrypoint.sh -RUN chmod +4755 /usr/local/bin/entrypoint.sh - -# Set the entrypoint for the container -ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/workflow-pr/Dockerfile b/workflow-pr/Dockerfile new file mode 120000 index 0000000..c090283 --- /dev/null +++ b/workflow-pr/Dockerfile @@ -0,0 +1 @@ +Dockerfile.package \ No newline at end of file diff --git a/workflow-pr/Dockerfile.local b/workflow-pr/Dockerfile.local new file mode 100644 index 0000000..09dbcc6 --- /dev/null +++ b/workflow-pr/Dockerfile.local @@ -0,0 +1,17 @@ +# Use the same base image as the Gitea container +FROM registry.suse.com/bci/bci-base:15.7 + +# Add the custom CA to the trust store +COPY rabbitmq-config/certs/cert.pem /usr/share/pki/trust/anchors/gitea-rabbitmq-ca.crt +RUN update-ca-certificates + +# Install git and ssh +RUN zypper -n in git-core openssh-clients + +# Copy the pre-built binary into the container +COPY workflow-pr/workflow-pr /usr/local/bin/workflow-pr +COPY workflow-pr/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +4755 /usr/local/bin/entrypoint.sh + +# Set the entrypoint for the container +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/workflow-pr/Dockerfile.package b/workflow-pr/Dockerfile.package new file mode 100644 index 0000000..5d20025 --- /dev/null +++ b/workflow-pr/Dockerfile.package @@ -0,0 +1,22 @@ +# Use the same base image as the Gitea container +FROM registry.suse.com/bci/bci-base:15.7 + +# Add the custom CA to the trust store +COPY rabbitmq-config/certs/cert.pem /usr/share/pki/trust/anchors/gitea-rabbitmq-ca.crt +RUN update-ca-certificates + +RUN zypper ar -f http://download.opensuse.org/repositories/devel:/Factory:/git-workflow/15.7/devel:Factory:git-workflow.repo +RUN zypper --gpg-auto-import-keys ref + + + +# Install git and ssh +RUN zypper -n in git-core openssh-clients autogits-workflow-pr + +# Copy the pre-built binary into the container +# COPY workflow-pr/workflow-pr /usr/local/bin/workflow-pr +COPY workflow-pr/entrypoint.sh /usr/local/bin/entrypoint.sh +RUN chmod +4755 /usr/local/bin/entrypoint.sh + +# Set the entrypoint for the container +ENTRYPOINT ["/usr/local/bin/entrypoint.sh"] diff --git a/workflow-pr/entrypoint.sh b/workflow-pr/entrypoint.sh index 1be0a63..583b4cb 100644 --- a/workflow-pr/entrypoint.sh +++ b/workflow-pr/entrypoint.sh @@ -55,4 +55,11 @@ for i in {1..10}; do done chmod 644 /root/.ssh/known_hosts -exec /usr/local/bin/workflow-pr "$@" +exe=$(which workflow-pr) +exe=${exe:-/usr/local/bin/workflow-pr} + +package=$(rpm -qa | grep autogits-workflow-pr) || : + +echo !!!!!!!!!!!!!!!! using binary $exe; installed package: $package + +exec "$exe" "$@" diff --git a/workflow-pr/workflow-pr b/workflow-pr/workflow-pr deleted file mode 100755 index 70c7a6c..0000000 Binary files a/workflow-pr/workflow-pr and /dev/null differ