Newer
Older
# -*- mode: yaml; coding: utf-8 -*-
# vim: ft=yaml
#
# Hidden template jobs to be used in `.gitlab-ci.yml`
#
# - `.helm:lint`: verify formatting of the helm chart
#
# - `.helm:package`: build the helm package tgz file
# - `.helm:cm-push`: push the helm package tgz file to a remote
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
---
#
# .helm:lint
# ==========
#
# Verify formatting of the helm chart files.
#
# USAGE
# =====
#
# include:
# - project: EOLE/Infra/ci-tools
# ref: master
# file: /templates/Helm.yaml
#
# stages:
# - lint
#
# helm lint: {extends: '.helm:lint'}
#
# REQUIREMENTS
# ============
#
# - a `lint` stage must be present in your pipeline or it must be
# overriden by the extending job to feet your need.
#
# - the `.not-on-stable` rules templates or it must be overriden by
# the extending job to feet your need
#
# OPTIONAL VARIABLES
# ==================
#
# - `CHART_DIR`: directory of the helm chart, default to `.`
#
# - `HELM_IMAGE`: name of the `helm` docker image to use
#
# - `HELM_ARGS`: optional arguments to pass to `helm lint` command,
# empty by default
#
# USED CI VARIABLES
# =================
#
.helm:lint:
stage: lint
extends:
- .helm:base
- .not-on-stable
script:
- echo -e "\e[0Ksection_start:$(date +%s):helm-lint\r\e[0KExecute 'helm lint ${HELM_ARGS} ${CHART_DIR}'"
- helm lint ${HELM_ARGS} "${CHART_DIR}"
- echo -e "\e[0Ksection_end:$(date +%s):helm-lint\r\e[0K"
# .helm:package
# =============
#
# Build the helm package tgz file
#
# USAGE
# =====
#
# include:
# - project: EOLE/Infra/ci-tools
# ref: master
# file: /templates/Helm.yaml
#
# stages:
# - build
#
# helm build: {extends: '.helm:package'}
#
# REQUIREMENTS
# ============
#
# - a `build` stage must be present in your pipeline or it must be
# overriden by the extending job to feet your need.
#
# - the `.not-on-stable` rules templates or it must be overriden by
# the extending job to feet your need
#
# OPTIONAL VARIABLES
# ==================
#
# - `CHART_DIR`: directory of the helm chart, default to `.`
#
# - `HELM_IMAGE`: name of the `helm` docker image to use
#
# - `HELM_ARGS`: optional arguments to pass to `helm package` command,
# empty by default
#
# - `HELM_BUILD_DIR`: write package chart in this directory, default
# to `build`
#
# USED CI VARIABLES
# =================
#
stage: build
extends:
- .helm:base
- .not-on-stable
artifacts:
paths:
- $HELM_BUILD_DIR
script:
- echo -e "\e[0Ksection_start:$(date +%s):helm-package\r\e[0KExecute 'helm package --destination ${HELM_BUILD_DIR} ${HELM_ARGS} ${CHART_DIR}'"
- helm package --destination "${HELM_BUILD_DIR}" ${HELM_ARGS} "${CHART_DIR}"
- echo -e "\e[0Ksection_end:$(date +%s):helm-package\r\e[0K"
# .helm:cm-push
# =============
# Push the helm package tgz file to a remote chartMuseum repository
#
# USAGE
# =====
#
# include:
# - project: EOLE/Infra/ci-tools
# ref: master
# file: /templates/Helm.yaml
#
# stages:
# - release
#
# helm publish: {extends: '.helm:cm-push'}
#
# REQUIREMENTS
# ============
#
# - a `release` stage must be present in your pipeline or it must be
# overriden by the extending job to feet your need.
#
# - the `.on-release-tag` rules templates or it must be overriden by
# the extending job to feet your need
#
# - `HELM_REPO` variable: URL of the helm ChartMuseum
#
# - `HELM_REPO_USERNAME` variable: name of the user with write access
# to the ChartMuseum
#
# - `HELM_REPO_PASSWORD` variable: password of `HELM_REPO_USERNAME`
#
# OPTIONAL VARIABLES
# ==================
#
# - `CHART_DIR`: directory of the helm chart, default to `.`
#
# - `HELM_IMAGE`: name of the `helm` docker image to use
#
# - `HELM_ARGS`: optional arguments to pass to `helm cm-push` command,
# empty by default
#
# - `HELM_BUILD_DIR`: write package chart in this directory, default
# to `build`
#
# USED CI VARIABLES
# =================
#
stage: release
extends:
- .helm:base
- .on-release-tag
script:
- echo -e "\e[0Ksection_start:$(date +%s):helm-cm-push-config[collapsed=true]\r\e[0KPrepare environment to push to helm remote repository '${HELM_REPO}'"
- helm repo add chartrepo "${HELM_REPO}"
- echo -e "\e[0Ksection_end:$(date +%s):helm-cm-push-config\r\e[0K"
- echo -e "\e[0Ksection_start:$(date +%s):helm-cm-push\r\e[0KExecute 'helm cm-push ${HELM_BUILD_DIR}/* chartrepo'"
- helm cm-push "${HELM_BUILD_DIR}"/* chartrepo
- echo -e "\e[0Ksection_end:$(date +%s):helm-cm-push\r\e[0K"
.helm:base:
extends: .not-on-stable
image:
name: "${HELM_IMAGE}"
variables:
HELM_IMAGE: hub.eole.education/eole/helm:latest
HELM_ARGS: ''
CHART_DIR: '.'
...