147 lines
4.8 KiB
YAML
147 lines
4.8 KiB
YAML
include:
|
|
- project: 'esv/bsf/pypi/prosper'
|
|
ref: v0.64.1
|
|
file: '/prosper/templates/projects/docker.yml'
|
|
|
|
variables:
|
|
# renovate: datasource=gitlab-tags depName=esv/bsf/pypi/prosper versioning=semver registryUrl=https://gitlab.global.bsf.tools
|
|
PROSPER_VERSION: v0.64.1
|
|
|
|
kics:
|
|
allow_failure: true
|
|
|
|
hadolint:
|
|
allow_failure: true
|
|
|
|
secrets:
|
|
allow_failure: true
|
|
|
|
# Run Python tests
|
|
python_tests:
|
|
stage: test
|
|
image: deps.global.bsf.tools/docker/python:3.12-slim
|
|
before_script:
|
|
- pip install -r backend/requirements.txt
|
|
- pip install pytest pytest-asyncio httpx
|
|
script:
|
|
- cd backend
|
|
- python -m pytest -v || echo "No tests yet"
|
|
|
|
# deploy_helm_charts:
|
|
# stage: deploy
|
|
# image:
|
|
# name: deps.global.bsf.tools/registry-1.docker.io/alpine/k8s:1.29.12
|
|
# parallel:
|
|
# matrix:
|
|
# # - ENV: "prod"
|
|
# # VALUES_FILE: "helm/values-prod.yaml"
|
|
# # CONTEXT: "esv/bsf/bsf-services/gitlab-kaas-agent-config:services-prod-agent"
|
|
# # NAMESPACE: "bsf-services-namespace"
|
|
# # ONLY: "main"
|
|
# - ENV: "dev"
|
|
# VALUES_FILE: "helm/orchard/values.yaml"
|
|
# CONTEXT: "esv/bsf/bsf-services/gitlab-kaas-agent-config:services-prod-agent"
|
|
# NAMESPACE: "bsf-services-dev-namespace"
|
|
# # ONLY: ["branches", "!main"]
|
|
# script:
|
|
# - kubectl config use-context $CONTEXT
|
|
# - echo "Deploy - buildah push ${IMAGE_NAME}:latest"
|
|
# - |
|
|
# helm upgrade --install orchard-dev ./helm/orchard --namespace $NAMESPACE -f $VALUES_FILE
|
|
|
|
.deploy_template: &deploy_template
|
|
image: deps.global.bsf.tools/registry-1.docker.io/alpine/k8s:1.29.12
|
|
before_script:
|
|
- helm version
|
|
- helm repo add stable https://charts.helm.sh/stable
|
|
- helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
- cd helm/orchard
|
|
- helm dependency update
|
|
- helm repo update
|
|
script:
|
|
- echo "Deploying to $ENV environment in namespace $NAMESPACE using chart $VALUES_FILE with agent $AGENT"
|
|
- helm upgrade --install orchard-$ENV ./helm/orchard --namespace $NAMESPACE -f $VALUES_FILE --set image.tag=$IMAGE
|
|
environment:
|
|
name: $ENV
|
|
kubernetes:
|
|
agent: $AGENT
|
|
|
|
# Deploy to stage (main branch)
|
|
deploy_stage:
|
|
image: deps.global.bsf.tools/registry-1.docker.io/alpine/k8s:1.29.12
|
|
stage: deploy
|
|
variables:
|
|
ENV: stage
|
|
NAMESPACE: orch-stage-namespace
|
|
VALUES_FILE: "helm/orchard/values-stage.yaml"
|
|
AGENT: esv/bsf/bsf-integration/orchard/orchard-mvp:orchard-stage
|
|
IMAGE: $CI_COMMIT_SHA
|
|
rules:
|
|
- if: '$CI_COMMIT_BRANCH == "main"'
|
|
when: always
|
|
<<: *deploy_template
|
|
|
|
# Deploy feature branch to dev namespace
|
|
deploy_feature:
|
|
image: deps.global.bsf.tools/registry-1.docker.io/alpine/k8s:1.29.12
|
|
stage: deploy
|
|
variables:
|
|
FEATURE_ID: feat-$CI_COMMIT_SHORT_SHA
|
|
ENV: feat-$CI_COMMIT_SHORT_SHA
|
|
NAMESPACE: orch-dev-namespace
|
|
VALUES_FILE: "helm/orchard/values-dev.yaml"
|
|
AGENT: esv/bsf/bsf-integration/orchard/orchard-mvp:orchard
|
|
IMAGE: $CI_COMMIT_SHA
|
|
FEATURE_HOST: orchard-$CI_COMMIT_SHORT_SHA.common.global.bsf.tools
|
|
MINIO_HOST: minio-$CI_COMMIT_SHORT_SHA.common.global.bsf.tools
|
|
before_script:
|
|
- kubectl config use-context esv/bsf/bsf-integration/orchard/orchard-mvp:orchard
|
|
- helm version
|
|
- helm repo add stable https://charts.helm.sh/stable
|
|
- helm repo add bitnami https://charts.bitnami.com/bitnami
|
|
- cd helm/orchard
|
|
- helm dependency update
|
|
- helm repo update
|
|
script:
|
|
- echo "Deploying feature branch to $ENV environment"
|
|
- |
|
|
helm upgrade --install orchard-$FEATURE_ID ./helm/orchard \
|
|
--namespace $NAMESPACE \
|
|
-f $VALUES_FILE \
|
|
--set image.tag=$IMAGE \
|
|
--set ingress.hosts[0].host=$FEATURE_HOST \
|
|
--set ingress.tls[0].hosts[0]=$FEATURE_HOST \
|
|
--set ingress.tls[0].secretName=orchard-$FEATURE_ID-tls \
|
|
--set minioIngress.host=$MINIO_HOST \
|
|
--set minioIngress.tls.secretName=minio-$FEATURE_ID-tls
|
|
environment:
|
|
name: review/$CI_COMMIT_REF_SLUG
|
|
url: https://orchard-$CI_COMMIT_SHORT_SHA.common.global.bsf.tools
|
|
on_stop: cleanup_feature
|
|
kubernetes:
|
|
agent: esv/bsf/bsf-integration/orchard/orchard-mvp:orchard
|
|
rules:
|
|
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "main"'
|
|
when: always
|
|
|
|
# Cleanup feature branch deployment
|
|
cleanup_feature:
|
|
stage: deploy
|
|
variables:
|
|
FEATURE_ID: feat-$CI_COMMIT_SHORT_SHA
|
|
NAMESPACE: orch-dev-namespace
|
|
AGENT: esv/bsf/bsf-integration/orchard/orchard-mvp:orchard
|
|
image: deps.global.bsf.tools/registry-1.docker.io/alpine/k8s:1.29.12
|
|
script:
|
|
- echo "Cleaning up feature deployment orchard-$FEATURE_ID"
|
|
- helm uninstall orchard-$FEATURE_ID --namespace $NAMESPACE || true
|
|
environment:
|
|
name: review/$CI_COMMIT_REF_SLUG
|
|
action: stop
|
|
kubernetes:
|
|
agent: $AGENT
|
|
rules:
|
|
- if: '$CI_COMMIT_BRANCH && $CI_COMMIT_BRANCH != "main"'
|
|
when: manual
|
|
allow_failure: true
|