make webhook

This commit is contained in:
2026-07-13 18:50:38 +02:00
parent 2f128550fc
commit 40c822d3bf
67 changed files with 6286 additions and 2053 deletions
+22
View File
@@ -0,0 +1,22 @@
GITEA_SERVER_URL=https://git.example.com
GITEA_REPOSITORY=owner/repository
CI_AGENT_BOT_LOGIN=olixero-agent
# Configure at least one allowlist. Numeric Gitea user IDs are preferred.
CI_AGENT_ALLOWED_ACTOR_IDS=10,11
CI_AGENT_ALLOWED_ACTORS=
AGENT_CONTROLLER_IMAGE=olixero-agent-controller:2.0.0
AGENT_EXECUTOR_IMAGE=olixero-agent-executor:2.0.0
AGENT_LISTEN_ADDRESS=127.0.0.1
AGENT_HTTP_PORT=8080
# Use local filesystems; SQLite WAL is not supported on network filesystems.
AGENT_STATE_DIR=/srv/olixero-agent/state
AGENT_WORKSPACE_DIR=/srv/olixero-agent/workspaces
OPENCODE_DATA_DIR=/srv/olixero-agent/opencode
CACHE_DIR=/srv/olixero-agent/cache
GITEA_WRITE_TOKEN_FILE=./secrets/gitea-write-token
GITEA_READ_TOKEN_FILE=./secrets/gitea-read-token
GITEA_WEBHOOK_SECRET_FILE=./secrets/gitea-webhook-secret
+72
View File
@@ -0,0 +1,72 @@
# syntax=docker/dockerfile:1
FROM node:24-alpine AS app-build
WORKDIR /src/app
COPY app/package.json app/package-lock.json ./
COPY app/config/tsconfig.json ./config/tsconfig.json
RUN npm ci
COPY app/src ./src
RUN npm run build && npm prune --omit=dev
FROM node:24-alpine AS runtime
RUN apk add --no-cache ca-certificates coreutils git openssh-client \
&& addgroup -g 10001 ci-agent \
&& adduser -D -u 10001 -G ci-agent -h /home/ci-agent ci-agent \
&& install -d -o ci-agent -g ci-agent -m 0700 \
/var/lib/olixero-agent/state \
/var/lib/olixero-agent/workspaces \
/var/lib/opencode-agent/data \
/var/lib/opencode-agent/cache \
&& install -d -o root -g root -m 0555 \
/opt/ci-agents \
/opt/ci-agents/empty-config \
/opt/ci-agents/empty-config/opencode
COPY --from=app-build /src/app/dist /opt/ci-agents/dist
COPY --from=app-build /src/app/node_modules /opt/ci-agents/node_modules
COPY app/scripts/git-askpass.sh /opt/ci-agents/bin/git-askpass.sh
RUN chmod -R a-w /opt/ci-agents \
&& chmod 0555 /opt/ci-agents/bin/git-askpass.sh
ENV HOME=/home/ci-agent \
NODE_ENV=production \
AGENT_DB_PATH=/var/lib/olixero-agent/state/agent.db \
AGENT_WORKSPACE_ROOT=/var/lib/olixero-agent/workspaces
WORKDIR /opt/ci-agents
USER ci-agent
FROM runtime AS controller
EXPOSE 8080
CMD ["node", "/opt/ci-agents/dist/application/controller/main.js"]
FROM runtime AS executor
ARG TARGETARCH=amd64
ARG OPENCODE_VERSION=1.17.18
ARG GITEA_MCP_VERSION=1.3.0
USER root
RUN npm install --global --omit=dev "opencode-ai@${OPENCODE_VERSION}" \
&& case "${TARGETARCH}" in \
amd64) asset="gitea-mcp_Linux_x86_64.tar.gz"; sha="99e144ee9821c8ef26dfb05daa3351435ed55eb56bd1b7418c4f7b573cc92ce2" ;; \
arm64) asset="gitea-mcp_Linux_arm64.tar.gz"; sha="07dd4b6823c145baee817ad664043cc26ce5903d0358693949b0ee2da18d4b62" ;; \
*) echo "Unsupported TARGETARCH: ${TARGETARCH}" >&2; exit 1 ;; \
esac \
&& wget -q -O "/tmp/${asset}" "https://gitea.com/gitea/gitea-mcp/releases/download/v${GITEA_MCP_VERSION}/${asset}" \
&& printf '%s %s\n' "${sha}" "/tmp/${asset}" | sha256sum --check - \
&& tar -xzf "/tmp/${asset}" -C /tmp \
&& install -m 0755 /tmp/gitea-mcp /usr/local/bin/gitea-mcp \
&& rm -f "/tmp/${asset}" /tmp/gitea-mcp
COPY opencode /opt/ci-agents/opencode
RUN chmod -R a-w /opt/ci-agents
ENV XDG_DATA_HOME=/var/lib/opencode-agent/data \
XDG_CONFIG_HOME=/opt/ci-agents/empty-config \
XDG_CACHE_HOME=/var/lib/opencode-agent/cache \
OPENCODE_CONFIG_DIR=/opt/ci-agents/opencode \
OPENCODE_DISABLE_PROJECT_CONFIG=true \
OPENCODE_DISABLE_EXTERNAL_SKILLS=true
USER ci-agent
CMD ["node", "/opt/ci-agents/dist/application/execution/main.js"]
+88
View File
@@ -0,0 +1,88 @@
name: olixero-agent-server
x-common: &common
user: "10001:10001"
restart: unless-stopped
read_only: true
stop_grace_period: 2m
environment: &common-environment
GITEA_SERVER_URL: ${GITEA_SERVER_URL:?Set GITEA_SERVER_URL in .env}
GITEA_REPOSITORY: ${GITEA_REPOSITORY:?Set GITEA_REPOSITORY in .env}
CI_AGENT_BOT_LOGIN: ${CI_AGENT_BOT_LOGIN:?Set CI_AGENT_BOT_LOGIN in .env}
CI_AGENT_ALLOWED_ACTOR_IDS: ${CI_AGENT_ALLOWED_ACTOR_IDS:-}
CI_AGENT_ALLOWED_ACTORS: ${CI_AGENT_ALLOWED_ACTORS:-}
AGENT_DB_PATH: /var/lib/olixero-agent/state/agent.db
AGENT_WORKSPACE_ROOT: /var/lib/olixero-agent/workspaces
volumes:
- ${AGENT_STATE_DIR:-./state/server}:/var/lib/olixero-agent/state
- ${AGENT_WORKSPACE_DIR:-./state/workspaces}:/var/lib/olixero-agent/workspaces
tmpfs:
- /tmp:rw,nosuid,nodev,mode=1777
services:
controller:
<<: *common
build:
context: ..
dockerfile: deploy/Dockerfile
target: controller
image: ${AGENT_CONTROLLER_IMAGE:-olixero-agent-controller:2.0.0}
environment:
<<: *common-environment
AGENT_HTTP_HOST: 0.0.0.0
AGENT_HTTP_PORT: "8080"
GITEA_WRITE_TOKEN_FILE: /run/secrets/gitea_write_token
GITEA_WEBHOOK_SECRET_FILE: /run/secrets/gitea_webhook_secret
secrets:
- source: gitea_write_token
target: gitea_write_token
uid: "10001"
gid: "10001"
mode: 0400
- source: gitea_webhook_secret
target: gitea_webhook_secret
uid: "10001"
gid: "10001"
mode: 0400
ports:
- "${AGENT_LISTEN_ADDRESS:-127.0.0.1}:${AGENT_HTTP_PORT:-8080}:8080"
healthcheck:
test: ["CMD", "node", "-e", "fetch('http://127.0.0.1:8080/readyz').then(r=>{if(!r.ok)process.exit(1)})"]
interval: 10s
timeout: 3s
retries: 6
executor:
<<: *common
build:
context: ..
dockerfile: deploy/Dockerfile
target: executor
image: ${AGENT_EXECUTOR_IMAGE:-olixero-agent-executor:2.0.0}
environment:
<<: *common-environment
GITEA_READ_TOKEN_FILE: /run/secrets/gitea_read_token
XDG_DATA_HOME: /var/lib/opencode-agent/data
XDG_CACHE_HOME: /var/lib/opencode-agent/cache
secrets:
- source: gitea_read_token
target: gitea_read_token
uid: "10001"
gid: "10001"
mode: 0400
volumes:
- ${AGENT_STATE_DIR:-./state/server}:/var/lib/olixero-agent/state
- ${AGENT_WORKSPACE_DIR:-./state/workspaces}:/var/lib/olixero-agent/workspaces
- ${OPENCODE_DATA_DIR:-./state/opencode}:/var/lib/opencode-agent/data
- ${CACHE_DIR:-./state/cache}:/var/lib/opencode-agent/cache
depends_on:
controller:
condition: service_healthy
secrets:
gitea_write_token:
file: ${GITEA_WRITE_TOKEN_FILE:-./secrets/gitea-write-token}
gitea_read_token:
file: ${GITEA_READ_TOKEN_FILE:-./secrets/gitea-read-token}
gitea_webhook_secret:
file: ${GITEA_WEBHOOK_SECRET_FILE:-./secrets/gitea-webhook-secret}