ai-software-factory
An AI software factory that runs on Kubernetes/OpenShift, using Tekton pipelines to schedule agents for completing development tasks.
Introduction
A self-hosted "software factory" that turns GitHub issues and comments into pull requests. GitHub events are received by Tekton Triggers, executed as Tekton pipelines, and handled by a coding agent (OpenCode) that talks to an open model served by vLLM on GPU nodes in the same cluster. Nothing leaves the cluster except the calls to GitHub.
*The factory at a glance: two ways in (a GitHub event, or the hourly scan of requirements issues), Tekton on OpenShift, the coding agent, the model on vLLM, the pull request with human approval, and the loop back: a merged pull request closes its task issue and the next scan releases the tasks that were waiting.*
GitHub (issue, comment, review)
│ webhook
▼
OpenShift Route ──► EventListener (Tekton Triggers)
├─ github interceptor (HMAC signature check)
└─ cel interceptor (who / what / which event is allowed)
│
TriggerBinding ─► TriggerTemplate ─► PipelineRun
│
┌─────────────────────────────────────────┘
▼
print-event ─► fetch-skills ─► prepare ─► plan ─► agent ─► verify ─► publish
│ │ │ │ │ │
OCI artifact clone + plan as OpenCode build, commit, push,
(skills, agents) branch comment + vLLM test, fix PR, reply
(Qwen)
What it does
| Pipeline | Triggered by | What happens |
|---|---|---|
issue-agent | a new issue (issues / opened) | Posts a checklist plan as an issue comment, implements the issue on a new branch, opens a pull request, enables auto-merge and replies with a summary. |
issue-comment-agent | an issue comment starting with @ai | Treats the comment as an instruction. A question gets an answer; a change request gets a plan, a branch and a pull request. |
pr-comment-agent | a pull request review or review comment | Reads the whole PR conversation, pushes the requested change to the PR branch (or answers a question) and replies on the PR. |
requirements-agent | the hourly requirements-scan CronJob, for open issues labeled requirements | Compares the requirements with the code and creates the task issues in dependency order, at most 3 open at a time (section 6.9). Each task issue then runs through issue-agent. |
Every trigger only accepts events from users whose author_association is OWNER, MEMBER or COLLABORATOR. New issues are also accepted from the GitHub App itself (the task issues that the requirements agent creates), and are skipped when labeled manual or requirements. Comment and review triggers ignore bots. Forks and closed issues or pull requests are skipped, so an issue opened by a stranger on a public repository does nothing.
Why these technologies
| Technology | Why |
|---|---|
| Kubernetes / OpenShift | One platform for everything: pipelines, agents and models. Each agent run is an isolated pod, so many agents run in parallel and the scheduler places them. GPU nodes, secrets, RBAC and network policies come built in. |
| Tekton | Kubernetes-native CI. Tekton Triggers turn a GitHub webhook straight into a PipelineRun, with signature checks and CEL filters. Every run is a recorded object that can be retried, logged and timed. |
| vLLM | High-throughput inference with continuous batching, so parallel agents share one GPU deployment. It serves an OpenAI-compatible API, supports tool calling and tensor parallelism, and runs open models in the cluster. |
| Open model (Qwen) | Code and issue text never leave the cluster, there is no per-token cost, and you can swap the model by changing one config entry. |
| OpenCode | Open-source coding agent that works with any OpenAI-compatible endpoint, so it does not tie the factory to a single model vendor. Permissions are declared in a config file. |
| GitHub App | Short-lived installation tokens instead of personal access tokens, with fine-grained permissions and its own bot identity. |
| OCI artifact for skills | Skills and subagents are versioned and pulled from the same registry as images, with no extra infrastructure. |
Showcase
The approach described here is in use in a sample application repository: piomin/ai-software-factory-showcase. The GitHub App from this guide is installed there, and the repository has an AGENTS.md with the rules the agent follows. Browse its closed issues and merged pull requests to see the factory at work: the plan comment on a new issue, the pull request opened by the bot, the human approval and the auto-merge. The GitHub screenshots in this README come from that repository.
Event flows
Each diagram follows one event from GitHub through the OpenShift cluster (Route, EventListener, PipelineRun in the agents namespace) to the model on vLLM (ai namespace) and back to GitHub. The numbers show the order of the main interactions. The orange-framed steps (plan, agent) are where the coding agent runs: OpenCode, which the pipelines use, or the optional Claude Code image. Quay.io only serves the skills artifact. The OpenCode and Claude Code icons are simplified drawings, not the official logos.
Scenario 1: new issue
Scenario 2: comment on an issue
Scenario 3: review of a pull request
Repository layout
.
├── agents/ the agent: images and shared configuration
│ ├── Dockerfile.opencode reference Dockerfile of the agent image (the pipelines pull it from Quay)
│ ├── Dockerfile same tooling with Claude Code (optional, not used by the pipelines)
│ ├── configmap-agent-config.yaml OpenCode config (model, permissions), the GitHub App token script and the requirements helpers
│ └── skills/ skills delivered as a ConfigMap (requirements-breakdown), built with `oc apply -k agents/skills`
├── tekton/ pipelines and everything that triggers them
│ ├── pipeline-*.yaml the three Tekton pipelines
│ ├── triggerbinding-*.yaml map webhook payloads to pipeline parameters
│ ├── triggertemplate-*.yaml create the PipelineRuns
│ ├── eventlistener-new-issue.yaml the single EventListener with four triggers and their filters
│ ├── task-*.yaml shared tasks: fetch-skills, verify-build, report-failure, create-issues
│ ├── pipeline-requirements-agent.yaml, cronjob-requirements-scan.yaml, role/rolebinding/serviceaccount-requirements-scheduler.yaml
│ │ the requirements agent and the CronJob that starts it (section 6.9)
│ ├── resourcequota-agents.yaml optional cap on parallel runs
│ ├── route-new-issue.yaml public HTTPS endpoint for the GitHub webhook
│ └── serviceaccount-*.yaml, rolebinding-*.yaml service account and RBAC for the EventListener
├── secrets/ secret skeletons with placeholders only (never commit real values)
│ └── secret-github-app.yaml, secret-github-webhook-secret.yaml, secret-hf-token.yaml, ...
├── ai/ the model: cache volume, Deployment and Service for qwen38-flash and qwen3-coder
└── docs/
├── diagrams/ SVG diagrams of the three event flows
└── images/ screenshots used in this README
Namespaces used: ai for models and agents for pipelines and triggers.
1. Prerequisites
1.1 Cluster and GPU nodes
- An OpenShift cluster (the setup was built on ROSA) with permissions to install operators.
- At least one GPU machine pool. Each model deployment in
ai/requests 2 GPUs (--tensor-parallel-size=2), 180 GiB of memory and a 300 GiB cache volume. Both deployments ship withreplicas: 0; run only one at a time unless you have 4 GPUs. - The model manifests tolerate the
nvidia.com/gpu:NoScheduletaint. If you taint your GPU nodes differently, change thetolerationsinai/. - The checkpoints are NVFP4 quantized. Check the vLLM release notes for the GPU generation you use, because FP4 kernels are primarily aimed at Blackwell GPUs.
- A default
StorageClassthat supportsReadWriteOnce(the manifests usegp3-csi). - Access to
registry.redhat.iofor the vLLM images (the cluster pull secret normally covers it).
1.2 Operators
Install from OperatorHub, in this order:
- Node Feature Discovery Operator. After installing, create a
NodeFeatureDiscoveryinstance (the defaults are fine). It labels nodes that have NVIDIA hardware. - NVIDIA GPU Operator. After installing, create the default
ClusterPolicy. It installs the driver, container toolkit and device plugin on GPU nodes. - Red Hat OpenShift Pipelines (Tekton Pipelines and Tekton Triggers). It provides the
githubandcelcluster interceptors and thepipelineservice account.
*Installed Operators: Node Feature Discovery, NVIDIA GPU Operator and Red Hat OpenShift Pipelines.*
Verify:
# GPU nodes are discovered and advertise GPUs
oc get nodes -l feature.node.kubernetes.io/pci-10de.present=true
oc describe node | grep -A2 'nvidia.com/gpu'
# Tekton is running
oc get pods -n openshift-pipelines
oc get clusterinterceptors
*A GPU node with the nvidia.com/gpu resource in its capacity and allocatable lists.*
Tekton setting for current OpenShift Pipelines (1.24 and newer). The pipelines in this repository give one task two volumes (skills and work). By default Tekton schedules such pods with an affinity assistant that refuses more than one volume per task: the run fails with TaskRunValidationFailed: more than one PersistentVolumeClaim is bound. Turn the affinity assistant off (a cluster-wide setting of the Tekton operator; each task then waits for its volume to move between pods, usually well under a minute):
oc patch tektonconfig config --type merge -p '{"spec":{"pipeline":{"coschedule":"disabled"}}}'
oc get cm feature-flags -n openshift-pipelines -o jsonpath='{.data.coschedule}{"\n"}' # disabled
1.3 Local tools
oc, optionally tkn and gh. podman and oras are only needed if you build your own agent image or publish your own skills artifact (section 4).
1.4 Namespaces
oc new-project ai
oc new-project agents
2. GitHub
2.1 Create the GitHub App
Create a GitHub App (Settings, Developer settings, GitHub Apps) with:
- Repository permissions: Contents *read and write*, Pull requests *read and write*, Issues *read and write*, Metadata *read-only*.
- Subscribe to events: Issues, Issue comment, Pull request review, Pull request review comment.
- Webhook: leave it for later (section 7); you need the route host first. Set a webhook secret now (you will store it as
github-webhook-secret).
*Repository permissions of the GitHub App: Contents, Pull requests and Issues set to read and write.*
*Events the app subscribes to: Issues, Issue comment, Pull request review and Pull request review comment.*
The app acts as its own bot user. The pipelines authenticate as the app by minting short-lived installation tokens, so no personal access token is needed.
2.2 Install the app and collect identifiers
- Install the app on the repository (or repositories) the factory should work on.
- Collect:
- App ID: shown on the app's settings page.
- Installation ID: the number at the end of
https://github.com/settings/installations/after you open the installation. - Private key: generate one on the app's settings page and keep the
.pemfile.
*The app's settings page: the App ID is shown under About.*
2.3 Repository settings
- Enable Allow auto-merge in the repository settings. The pipelines call
gh pr merge --auto. Auto-merge only waits for something if branch protection requires reviews or checks, so configure branch protection on the default branch. Without it a pull request is merged right away.
*Repository settings: Allow auto-merge enabled and a branch protection rule requiring a review and status checks.*
- Put an
AGENTS.mdin each target repository. The agent follows it. Typical content: coding conventions, "do not edittarget/", how to build and test the project, and an instruction to run the tests and report the result honestly. Nothing verifies the code after the agent finishes, so these rules are the quality gate.
2.4 Commit identity
The pipelines set the commit author to ai-software-factory-agent[bot] with an email like 5642464+ai-software-factory-agent[bot]@users.noreply.github.com. Replace the name and the number in the GIT_AUTHOR_* and GIT_COMMITTER_* variables of the publish steps with your app's slug and bot user id:
gh api "/users/%5Bbot%5D" --jq .id
3. Secrets on OpenShift
The secrets/ directory holds secret skeletons with placeholders only. Never commit real values: fill in a local copy (or use oc create secret instead) and apply it.
GitHub App credentials (secrets/secret-github-app.yaml). They are used to mint short-lived installation tokens. Keep the private key as a multi-line block:
apiVersion: v1
kind: Secret
metadata:
name: github-app
namespace: agents
type: Opaque
stringData:
app-id: ""
installation-id: ""
private-key.pem: |
-----BEGIN RSA PRIVATE KEY-----
-----END RSA PRIVATE KEY-----
oc apply -f secrets/secret-github-app.yaml
Webhook secret (secrets/secret-github-webhook-secret.yaml). The same value must be set as the webhook secret in the GitHub App. The EventListener uses it to verify every delivery:
apiVersion: v1
kind: Secret
metadata:
name: github-webhook-secret
namespace: agents
type: Opaque
stringData:
secret: ""
oc apply -f secrets/secret-github-webhook-secret.yaml
Hugging Face token (secrets/secret-hf-token.yaml). The model deployment uses it to download the weights:
apiVersion: v1
kind: Secret
metadata:
name: hf-token
namespace: ai
type: Opaque
stringData:
token: ""
oc apply -f secrets/secret-hf-token.yaml
The same secrets can be created without a file, for example:
oc create secret generic github-app -n agents \
--from-literal=app-id= \
--from-literal=installation-id= \
--from-file=private-key.pem=./.pem
secrets/secret-claude-github-secrets.yaml (ANTHROPIC_API_KEY, GH_TOKEN) is only needed if you run a Claude Code based variant. The OpenCode pipelines do not use it.
The default agent image and skills artifact are pulled from quay.io/pminkows. If you host your own copies in private Quay repositories, create an image pull secret and link it:
oc create secret docker-registry quay-pull -n agents \
--docker-server=quay.io --docker-username= --docker-password=
oc secrets link pipeline quay-pull --for=pull -n agents
4. Container images and skills
4.1 Agent image
The pipelines pull a ready-made agent image from Quay, quay.io/pminkows/opencode:latest, so you do not have to build anything to follow this guide. It runs in the prepare, plan, agent and publish steps. agents/Dockerfile.opencode is included for reference, to show what the image contains: OpenCode, the GitHub CLI, a JDK, Maven, skaffold and kubectl.
FROM registry.access.redhat.com/ubi9/nodejs-22
USER 0
RUN dnf install -y git jq tar gzip \
&& dnf clean all
RUN npm install -g opencode-ai
# GitHub CLI
ARG GH_VERSION=2.83.2
RUN curl -fsSL \
"https://github.com/cli/cli/releases/download/v${GH_VERSION}/gh_${GH_VERSION}_linux_amd64.tar.gz" \
-o /tmp/gh.tar.gz \
&& tar -xzf /tmp/gh.tar.gz -C /tmp \
&& cp /tmp/gh_${GH_VERSION}_linux_amd64/bin/gh /usr/local/bin/gh \
&& rm -rf /tmp/gh*
# Skaffold (build and deploy an application to Kubernetes)
ARG SKAFFOLD_VERSION=2.25.0
RUN curl -fsSL \
"https://storage.googleapis.com/skaffold/releases/v${SKAFFOLD_VERSION}/skaffold-linux-amd64" \
-o /usr/local/bin/skaffold \
&& chmod +x /usr/local/bin/skaffold
# kubectl (used by skaffold when it deploys)
ARG KUBECTL_VERSION=1.37.2
RUN curl -fsSL \
"https://dl.k8s.io/release/v${KUBECTL_VERSION}/bin/linux/amd64/kubectl" \
-o /usr/local/bin/kubectl \
&& chmod +x /usr/local/bin/kubectl
# OpenJDK 25 (Eclipse Temurin)
RUN mkdir -p /opt/java \
&& curl -fsSL \
"https://api.adoptium.net/v3/binary/latest/25/ga/linux/x64/jdk/hotspot/normal/eclipse" \
| tar -xz -C /opt/java --strip-components=1
ENV JAVA_HOME=/opt/java
# Maven
ARG MAVEN_VERSION=3.9.11
RUN mkdir -p /opt/maven \
&& curl -fsSL \
"https://repo.maven.apache.org/maven2/org/apache/maven/apache-maven/${MAVEN_VERSION}/apache-maven-${MAVEN_VERSION}-bin.tar.gz" \
| tar -xz -C /opt/maven --strip-components=1
ENV MAVEN_HOME=/opt/maven
ENV PATH="${JAVA_HOME}/bin:${MAVEN_HOME}/bin:${PATH}"
USER 1001
agents/Dockerfile is a variant with Claude Code (npm install -g @anthropic-ai/claude-code) instead of OpenCode, and without the JDK and Maven. It is optional and not used by the pipelines.
Only if you need a different configuration (another JDK, extra CLIs, another toolchain), adapt the Dockerfile, build and push your own image, and point the pipelines at it:
podman build -f agents/Dockerfile.opencode -t quay.io//opencode: agents/
podman push quay.io//opencode:
sed -i 's#quay.io/pminkows/opencode:latest#quay.io//opencode:#g' tekton/pipeline-*.yaml
skaffold and kubectl are in the image so that an agent can deploy an application to Kubernetes. They do nothing by default: the agent pods have no kubeconfig or RBAC. Granting that is a separate and security-sensitive step, and skaffold also needs a builder (Jib, buildpacks or Kaniko) and a registry to push to.
4.2 Skills artifact
Skills and subagents are distributed as an OCI artifact: one tar.gz with skills/ and agents/ directories in OpenCode format. The fetch-skills task pulls it with oras, unpacks it to /skills/opencode, and the prepare step copies it to ~/.config/opencode.
The pipelines pull quay.io/pminkows/claude-ai-spring-boot:1.3.2 by default (the skills-artifact parameter), so there is nothing to publish to get started.
Only if you want your own skills, publish them as an artifact and set the skills-artifact parameter of the pipelines to it:
tar -czf skills.tar.gz skills agents
oras push quay.io//: skills.tar.gz
5. The AI model (vLLM)
The manifests in ai/ run vllm serve for Qwen3.8 Flash (qwen38-flash) and Qwen3 Coder (qwen3-coder). The pipelines use Qwen3.8 Flash, served as qwen38_flash, with tool calling enabled and a 128k context.
Cache volume (ai/pvc-qwen38-flash-cache.yaml). The Hugging Face cache lives on a persistent volume so the weights are downloaded only once:
apiVersion: v1
kind: PersistentVolumeClaim
metadata:
name: qwen38-flash-cache
namespace: ai
spec:
accessModes:
- ReadWriteOnce
resources:
requests:
storage: 300Gi
storageClassName: gp3-csi
oc apply -f ai/pvc-qwen38-flash-cache.yaml
Deployment (ai/deployment-qwen38-flash.yaml, shortened). The arguments that matter are the served model name, tensor parallelism over two GPUs, the context length and the tool-calling parser, which OpenCode relies on: