Files
poimen-memory/k8s/tekton/poimen-pipeline.yaml
T

141 lines
3.5 KiB
YAML
Raw Normal View History

---
# Tekton Pipeline: Poimen Memory Service CI/CD
#
# Orchestrates:
# 1. integration-test-task: Run integration tests against image
# 2. (Future) build-task: Build Docker image
# 3. (Future) promote-task: Promote image to :latest
#
# Parameters:
# - image: Docker image with SHA to test
# - registry-user: Registry credentials
# - registry-token: Registry credentials
apiVersion: tekton.dev/v1
kind: Pipeline
metadata:
name: poimen-ci
namespace: poimen
spec:
params:
- name: image
type: string
description: "Docker image SHA to test (e.g., forgejo.riotpiao.com/riotpiao-poimen/poimen-memory:abc123)"
- name: registry-user
type: string
description: "Registry username"
default: ""
- name: registry-token
type: string
description: "Registry token/password"
default: ""
workspaces:
- name: source
description: "Git source repository with migrations"
tasks:
# Task 0: Apply Agent Memory Migrations
- name: agent-memory-migration
taskRef:
name: agent-memory-migration
params:
- name: migration-version
value: "004"
- name: database-name
value: "memory"
workspaces:
- name: source
workspace: source
# Task 1: Integration Tests (runs after migration)
- name: integration-tests
runAfter:
- agent-memory-migration
taskRef:
name: poimen-integration-test
params:
- name: image
value: $(params.image)
# Task 2: Gate on test results
- name: gate-on-tests
runAfter:
- integration-tests
taskSpec:
steps:
- name: check-results
image: alpine:latest
script: |
#!/bin/sh
set -e
echo "✓ Integration tests passed, proceeding with promotion"
# Task 3: Promote image (placeholder - will be implemented)
- name: promote-image
runAfter:
- gate-on-tests
taskSpec:
params:
- name: image
type: string
- name: registry-user
type: string
- name: registry-token
type: string
steps:
- name: promote
image: docker:latest
env:
- name: IMAGE
value: $(params.image)
- name: REGISTRY_USER
value: $(params.registry-user)
- name: REGISTRY_TOKEN
value: $(params.registry-token)
script: |
#!/bin/sh
set -e
echo "Promoting image to :latest..."
# Extract registry and repo from image
# e.g., forgejo.riotpiao.com/riotpiao-poimen/poimen-memory:abc123
REGISTRY=$(echo $IMAGE | cut -d/ -f1)
REPO=$(echo $IMAGE | cut -d: -f1)
SHA=$(echo $IMAGE | cut -d: -f2)
echo "Registry: $REGISTRY"
echo "Repo: $REPO"
echo "SHA: $SHA"
echo ""
# Login and promote
echo "$REGISTRY_TOKEN" | docker login -u "$REGISTRY_USER" --password-stdin "$REGISTRY"
docker pull "$IMAGE"
docker tag "$IMAGE" "${REPO}:latest"
docker push "${REPO}:latest"
echo "✓ Promoted to :latest"
params:
- name: image
value: $(params.image)
- name: registry-user
value: $(params.registry-user)
- name: registry-token
value: $(params.registry-token)
finally:
- name: cleanup
taskSpec:
steps:
- name: cleanup-tasks
image: alpine:latest
script: |
#!/bin/sh
echo "Pipeline execution complete"