Add new infra architecture 6
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
# Tekton Kaniko Build Task for Bakery-IA CI/CD
|
||||
# This task builds and pushes container images using Kaniko
|
||||
# Supports environment-configurable base images via build-args
|
||||
|
||||
apiVersion: tekton.dev/v1beta1
|
||||
kind: Task
|
||||
@@ -21,10 +22,18 @@ spec:
|
||||
description: Comma-separated list of services to build
|
||||
- name: registry
|
||||
type: string
|
||||
description: Container registry URL
|
||||
description: Container registry URL for pushing built images
|
||||
- name: git-revision
|
||||
type: string
|
||||
description: Git revision to tag images with
|
||||
- name: base-registry
|
||||
type: string
|
||||
description: Base image registry URL (e.g., docker.io, ghcr.io/org)
|
||||
default: "docker.io"
|
||||
- name: python-image
|
||||
type: string
|
||||
description: Python base image name and tag
|
||||
default: "python:3.11-slim"
|
||||
results:
|
||||
- name: build-status
|
||||
description: Status of the build operation
|
||||
@@ -37,24 +46,51 @@ spec:
|
||||
script: |
|
||||
#!/bin/bash
|
||||
set -e
|
||||
|
||||
|
||||
echo "==================================================================="
|
||||
echo "Kaniko Build Configuration"
|
||||
echo "==================================================================="
|
||||
echo "Target Registry: $(params.registry)"
|
||||
echo "Base Registry: $(params.base-registry)"
|
||||
echo "Python Image: $(params.python-image)"
|
||||
echo "Git Revision: $(params.git-revision)"
|
||||
echo "==================================================================="
|
||||
|
||||
# Split services parameter by comma
|
||||
IFS=',' read -ra SERVICES <<< "$(params.services)"
|
||||
|
||||
|
||||
# Build each service
|
||||
for service in "${SERVICES[@]}"; do
|
||||
service=$(echo "$service" | xargs) # Trim whitespace
|
||||
if [ -n "$service" ] && [ "$service" != "none" ]; then
|
||||
echo ""
|
||||
echo "Building service: $service"
|
||||
echo "-------------------------------------------------------------------"
|
||||
|
||||
# Determine Dockerfile path (services vs gateway)
|
||||
if [ "$service" = "gateway" ]; then
|
||||
DOCKERFILE_PATH="$(workspaces.source.path)/gateway/Dockerfile"
|
||||
else
|
||||
DOCKERFILE_PATH="$(workspaces.source.path)/services/$service/Dockerfile"
|
||||
fi
|
||||
|
||||
/kaniko/executor \
|
||||
--dockerfile="$(workspaces.source.path)/services/$service/Dockerfile" \
|
||||
--dockerfile="$DOCKERFILE_PATH" \
|
||||
--destination="$(params.registry)/$service:$(params.git-revision)" \
|
||||
--context="$(workspaces.source.path)" \
|
||||
--build-arg="BASE_REGISTRY=$(params.base-registry)" \
|
||||
--build-arg="PYTHON_IMAGE=$(params.python-image)" \
|
||||
--cache=true \
|
||||
--cache-repo="$(params.registry)/cache"
|
||||
|
||||
echo "Successfully built: $(params.registry)/$service:$(params.git-revision)"
|
||||
fi
|
||||
done
|
||||
|
||||
|
||||
echo ""
|
||||
echo "==================================================================="
|
||||
echo "Build completed successfully!"
|
||||
echo "==================================================================="
|
||||
echo "success" > $(results.build-status.path)
|
||||
resources:
|
||||
limits:
|
||||
|
||||
Reference in New Issue
Block a user