-
Stackspin-renovate Bot authoredd27574ad
.gitlab-ci.yml 2.71 KiB
include:
- remote: https://open.greenhost.net/stackspin/stackspin/-/raw/main/.gitlab/ci_templates/helm_package.yml
- remote: https://open.greenhost.net/stackspin/stackspin/-/raw/main/.gitlab/ci_templates/dummy_job.yml
- template: 'Workflows/MergeRequest-Pipelines.gitlab-ci.yml'
.use_kubernetes:
image:
name: alpine/k8s:1.22.9
entrypoint: ["/bin/sh", "-c"]
before_script:
- kubectl config get-contexts
- kubectl config use-context stackspin/kubernetes-agent-setup:stackspin-k8s-agent
.chart_changes_rules:
rules:
- changes:
- templates/**/*
- taiko-tests/**/*.js
- values-local.yaml.example
- values.yaml
- Chart.yaml
- .gitlab-ci.yml
.delete_helmrelease: &delete_helmrelease
- cd ${CHART_DIR:-"."}
- ./fully-delete-helmrelease.sh "nc$CI_MERGE_REQUEST_IID" "nc$CI_MERGE_REQUEST_IID"
# namespace removal fails if the namespace does not exist (yet), that's not a problem
- kubectl delete namespace "nc$CI_MERGE_REQUEST_IID" || true
stages:
- lint-helm-chart
- install-helm-chart
- test-helm-chart
- package-helm-chart
- release-helm-chart
- dummy
variables:
CHART_NAME: nextcloud-onlyoffice
post-install-delete-helmrelease:
stage: install-helm-chart
script:
- *delete_helmrelease
extends:
- .use_kubernetes
- .chart_changes_rules
# Gets triggered by on_stop of install-helmrelease, or manually
when: manual
environment:
name: helmrelease/nc$CI_MERGE_REQUEST_IID
action: stop
install-helmrelease:
stage: install-helm-chart
needs:
# This job contains the `helm dep` artifacts
- job: lint-helm
script:
- *delete_helmrelease
- cp values-local.yaml.example values-ci.yaml
# This sets the domains to files-MR_ID.gitlab.stackspin.net and
# office-MR_ID.gitlab.stackspin.net
- sed -i "s/\.your\.domain/-nc$CI_MERGE_REQUEST_IID.gitlab.stackspin.net/" values-ci.yaml
# Make sure TLS certificate secrets for different MRs do not clash
- sed -i "s/files-cert/files-cert-nc$CI_MERGE_REQUEST_IID/" values-ci.yaml
- sed -i "s/office-cert/office-cert-nc$CI_MERGE_REQUEST_IID/" values-ci.yaml
- kubectl create namespace "nc$CI_MERGE_REQUEST_IID"
- helm install -n nc$CI_MERGE_REQUEST_IID --wait "nc$CI_MERGE_REQUEST_IID" . -f values-ci.yaml
environment: