From d9fcc7579268113242fe0b32fc27555f53a28068 Mon Sep 17 00:00:00 2001 From: Sharang Parnerkar Date: Sat, 7 Nov 2026 09:44:11 +0000 Subject: [PATCH] fix(nightly): start the agent in a step, not as a service (#938) --- .gitea/workflows/nightly.yml | 84 +++++++++++++++++++++++++----------- 1 file changed, 58 insertions(+), 26 deletions(-) diff --git a/.gitea/workflows/nightly.yml b/.gitea/workflows/nightly.yml index e0187d8..2de476f 100644 --- a/.gitea/workflows/nightly.yml +++ b/.gitea/workflows/nightly.yml @@ -51,30 +51,6 @@ jobs: env: MONGO_INITDB_ROOT_USERNAME: root MONGO_INITDB_ROOT_PASSWORD: example - # The image main deployed. Dev mode (no Keycloak): the harness talks to - # the unauthenticated dev tenant; source_only matches staging. - agent: - image: repo.breakpilot.com/pruefwerk/compliance-agent:latest - credentials: - username: ${{ secrets.REGISTRY_USERNAME }} - password: ${{ secrets.REGISTRY_PASSWORD }} - env: - APP_ENV: dev - MONGODB_URI: mongodb://root:example@mongo:27017/?authSource=admin - MONGODB_DATABASE: nightly - PW_FEATURES: source_only - # No chat model: LLM triage, code review and the control judge are - # off (LlmClient sends nothing without LITELLM_MODEL, #575). Their - # output never gates the run, and with the model on, ~600 calls of - # 11 s on average (p99 147 s) on the gateway prod also uses kept - # every scan past NIGHTLY_TIMEOUT_SECS from 2026-10-30 on (#573). - # Embeddings stay on: the gateway's embedding model. - LITELLM_URL: ${{ secrets.NIGHTLY_LITELLM_URL }} - LITELLM_API_KEY: ${{ secrets.NIGHTLY_LITELLM_API_KEY }} - LITELLM_EMBED_MODEL: bge-multilingual-gemma2 - # Optional. The CODESYS CVE match queries NVD, which rate-limits - # unauthenticated clients; a key keeps those CVEs from going missing. - NVD_API_KEY: ${{ secrets.NIGHTLY_NVD_API_KEY }} steps: - name: Checkout run: | @@ -149,10 +125,59 @@ jobs: env: RUSTC_WRAPPER: "" + # The image main deployed, started here rather than as a service: + # act_runner 0.6.1 hands a service's registry credentials to the job + # container's own pull (map order decides which service wins), so the + # Harbor login reached docker.io about every other night. mongo, the + # only service left, has no credentials. The agent shares this + # container's network: it reaches mongo by name and listens on + # localhost here. The login lands in this container's ~/.docker, which + # goes with it. + # Dev mode (no Keycloak): the harness talks to the unauthenticated dev + # tenant; source_only matches staging. + - name: Start the agent + run: | + curl -fsSL -o /tmp/docker.tgz \ + https://download.docker.com/linux/static/stable/x86_64/docker-27.5.1.tgz + echo "4f798b3ee1e0140eab5bf30b0edc4e84f4cdb53255a429dc3bbae9524845d640 /tmp/docker.tgz" \ + | sha256sum -c - + tar xzf /tmp/docker.tgz --strip-components=1 -C /usr/local/bin docker/docker + echo "$REGISTRY_PASSWORD" | docker login repo.breakpilot.com -u "$REGISTRY_USERNAME" --password-stdin + # -e NAME without a value passes this step's variable, so no secret + # appears on the command line. The container runs on the runner's + # daemon, outside the job's own limits, so it has its own; the label + # finds one a cancelled job left behind. + docker run -d --pull always --name "nightly-agent-${GITHUB_RUN_ID}" \ + --label pruefwerk-nightly --memory 4g --cpus 2 \ + --network "container:$(hostname)" \ + -e APP_ENV=dev \ + -e MONGODB_URI=mongodb://root:example@mongo:27017/?authSource=admin \ + -e MONGODB_DATABASE=nightly \ + -e PW_FEATURES=source_only \ + -e LITELLM_URL -e LITELLM_API_KEY \ + -e LITELLM_EMBED_MODEL=bge-multilingual-gemma2 \ + -e NVD_API_KEY \ + repo.breakpilot.com/pruefwerk/compliance-agent:latest + env: + RUSTC_WRAPPER: "" + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} + # No chat model: LLM triage, code review and the control judge are + # off (LlmClient sends nothing without LITELLM_MODEL, #575). Their + # output never gates the run, and with the model on, ~600 calls of + # 11 s on average (p99 147 s) on the gateway prod also uses kept + # every scan past NIGHTLY_TIMEOUT_SECS from 2026-10-30 on (#573). + # Embeddings stay on: the gateway's embedding model. + LITELLM_URL: ${{ secrets.NIGHTLY_LITELLM_URL }} + LITELLM_API_KEY: ${{ secrets.NIGHTLY_LITELLM_API_KEY }} + # Optional. The CODESYS CVE match queries NVD, which rate-limits + # unauthenticated clients; a key keeps those CVEs from going missing. + NVD_API_KEY: ${{ secrets.NIGHTLY_NVD_API_KEY }} + - name: Wait for the agent run: | for i in $(seq 1 90); do - curl -fsS http://agent:3001/api/v1/health && exit 0 + curl -fsS http://localhost:3001/api/v1/health && exit 0 sleep 2 done echo "agent did not become healthy" >&2 @@ -163,13 +188,20 @@ jobs: - name: Scan the corpus and compare with the baselines run: cargo test -p compliance-agent --test nightly -- --nocapture env: - NIGHTLY_AGENT_URL: http://agent:3001 + NIGHTLY_AGENT_URL: http://localhost:3001 NIGHTLY_CODESYS_SAMPLE: /tmp/csv-blackbox.projectarchive NIGHTLY_ZEPHYR_EXAMPLE: /tmp/zephyr-example.zip NIGHTLY_IOS_SAMPLE: /tmp/ios-sample.zip NIGHTLY_ANDROID_SAMPLE: /tmp/android-sample.zip NIGHTLY_BLESS: ${{ inputs.bless && '1' || '0' }} + # The agent is not a service, so the runner does not remove it. + - name: Stop the agent + if: always() + run: docker rm -f "nightly-agent-${GITHUB_RUN_ID}" || true + env: + RUSTC_WRAPPER: "" + # upload-artifact is a Node action and the Rust image has no node. - name: Install node for the artifact upload if: always()