Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • EOLE/infra/ci-tools
  • daniel.dehennin/ci-tools
2 results
Show changes
Commits on Source (18)
......@@ -16,7 +16,10 @@ stages:
.docker-matrix:
parallel:
matrix:
- IMAGE_NAME: [commitlint, semantic-release-gitlab]
- IMAGE_NAME:
- commitlint
- helm
- semantic-release-gitlab
###############################################################################
# `lint` stage: `commitlint`
......
......@@ -21,6 +21,7 @@ const devBranch = undefined;
// Configure semantic-release plugins
const breakingKeywords = ["BREAKING CHANGE", "BREAKING-CHANGE", "BREAKING CHANGES", "BREAKING-CHANGES"];
const changelogFile = 'docs/CHANGELOG.md';
// const chartDir = './chart';
// Configure `conventionalcommits`
// See:
......@@ -41,6 +42,21 @@ const commitTypes = [
{type: "test", section: "Tests", hidden: false},
];
const releaseRules = [
{ breaking: true, release: 'major' },
// { type: 'build', release: 'patch'},
// { type: 'chore', release: 'patch'},
// { type: 'ci', release: 'patch'},
{ type: 'docs', release: 'patch' },
{ type: 'feat', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'revert', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'test', release: 'patch' },
];
const semanticBranches = [stableBranch];
if (betaBranch) {
......@@ -77,7 +93,7 @@ const config = {
{
noteKeywords: breakingKeywords,
},
releaseRules: './release-rules.js',
releaseRules: releaseRules,
presetConfig:
{
types: commitTypes,
......@@ -142,6 +158,20 @@ if (
// );
// gitAssets.push('setup.cfg');
// // Update Helm chart version
// config.plugins.push(
// [
// 'semantic-release-helm3',
// {
// chartPath: chartDir,
// onlyUpdateVersion: true,
// },
// ]
// );
// gitAssets.push(chartDir.concat('/Chart.yaml'));
// Commit changes and create release on Gitlab
config.plugins.push(
[
......
FROM alpine:latest as INSTALLER
LABEL maintainer="eole@ac-dijon.fr"
RUN apk add --no-cache \
ca-certificates \
curl \
git \
openssl
RUN curl -o get-helm-3 https://raw.githubusercontent.com/helm/helm/main/scripts/get-helm-3
RUN sh ./get-helm-3
RUN helm plugin install https://github.com/chartmuseum/helm-push
FROM alpine:latest
LABEL maintainer="eole@ac-dijon.fr"
COPY --from=INSTALLER /usr/local/bin/helm /usr/local/bin/helm
COPY --from=INSTALLER /root/.local/share/helm/ /root/.local/share/helm
......@@ -10,6 +10,7 @@ ARG SEMAINTIC_EXEC_VERSION=6
ARG SEMAINTIC_GIT_VERSION=10
ARG SEMANTIC_NPM_VERSION=9
ARG SEMANTIC_PYPI_VERSION=2
ARG SEMANTIC_HELM_VERSION=2
RUN apk add --no-cache git \
ca-certificates \
......@@ -30,4 +31,5 @@ RUN npm install -g semantic-release@${SEMAINTIC_RELEASE_VERSION} \
@semantic-release/git@${SEMAINTIC_GIT_VERSION} \
@semantic-release/npm@${SEMAINTIC_NPM_VERSION} \
conventional-changelog-conventionalcommits@${CONVENTIONALCOMMITS_VERSION} \
semantic-release-pypi@${SEMANTIC_PYPI_VERSION}
semantic-release-pypi@${SEMANTIC_PYPI_VERSION} \
semantic-release-helm3@${SEMANTIC_HELM_VERSION}
# Changelog
## [1.11.0](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/compare/release/1.10.0...release/1.11.0) (2022-06-23)
### Features
* **.git:commitlint:** skip no branch or semantic-release commit ([3a855ab](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/3a855ab00db2a0a8022ad14e4c53e02dc93bd01c))
* **helm:** build the helm package ([115a62a](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/115a62a808a91f9ad2b1aa74775786c3d693b330))
* **helm:** publish the helm package ([98f3a6e](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/98f3a6e473d2fb49d3335deaee99812b2d234103))
* **helm:** verify helm formatting with `.helm:lint` job template ([7e1ccbd](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/7e1ccbd30f8f53fa29bfc574159e52999803f5e7))
* **semantic-release:** don't enforce configuration on job rules ([1a1a9ca](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/1a1a9cac043b2458f9811c76bdc0e15784904eec))
* **semantic-release:** update version of Helm charts ([f776b12](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/f776b127787ba40bbb831a621f3fc76015889aad))
### Bug Fixes
* **helm:** rename jobs to their used helm command ([7d6886c](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/7d6886c5c9edd79f310cb7ff6900c0837079c411))
### Code Refactoring
* **semantic-release:** move rules in main configuration file ([2ba784d](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/2ba784d805aefc92d60559330b78f5edf9c986e2))
### Documentation
* **getting-started:** update `semantic-release` configuration steps ([b6d5bc5](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/b6d5bc56c08e2526186f32bf5daf7a8b42bb087b))
### Continuous Integration
* **build:** new docker image with required helm tools ([e620568](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/commit/e62056859609fb3f18c718cc06f9349299b97ca2))
## [1.10.0](https://gitlab.mim-libre.fr/EOLE/infra/ci-tools/compare/release/1.9.1...release/1.10.0) (2022-03-22)
......
......@@ -332,7 +332,7 @@ you need mostly 4 steps:
new-release: {extends: '.semantic-release:stable'}
# Create the prereleases versions on `$TESTING_BRANCH`
# update `release.config.js` variable `betaBranch`
# update `.releaserc.js` variable `betaBranch`
testing-prerelease: {extends: '.semantic-release:testing'}
# Avoid regression by merging all pre-release fixes to `$DEV_BRANCH`
......@@ -399,12 +399,10 @@ you need mostly 4 steps:
</details>
2. configure [`commitlint`](#validate-commit-messages) with the
[`.commitlintrc.yaml`](.commitlintrc.yaml)
3. configure [`semantic-release`](#generate-release-with-semantic-version-scheme)
1. the general configuration
[`release.config.js`](release.config.js) (note that the
`branches` variable must match your `$STABLE_BRANCH`)
2. the version bump rules in [`release-rules.js`](release-rules.js)
3. add a `Dockerfile` in the root directory of your sources
3. configure
[`semantic-release`](#generate-release-with-semantic-version-scheme)
in [`.releaserc.js`](.releaserc.js) (note that the `branches` variable must match your `$STABLE_BRANCH`)
4. add a `Dockerfile` in the root directory of your sources
### Step by step setup
......@@ -511,9 +509,7 @@ you need to:
your `.gitlab-ci.yml`
4. define the `new-release` job extending [`.semantic-release:stable`](templates/Semantic-release.yaml#L17-L81)
5. define the `testing-prerelease` job extending [`.semantic-release:testing`](templates/Semantic-release.yaml#L84-L144)
6. configure `semantic-release`:
1. [`release.config.js`](release.config.js)
2. [`release-rules.js`](release-rules.js)
6. configure `semantic-release` in [`.releaserc.js`](.releaserc.js)
```diff
--- .gitlab-ci.yml.orig
......@@ -545,7 +541,7 @@ you need to:
+new-release: {extends: '.semantic-release:stable'}
+
+# Create the prereleases versions on `$TESTING_BRANCH`
+# update `release.config.js` variable `betaBranch`
+# update `.releaserc.js` variable `betaBranch`
+testing-prerelease: {extends: '.semantic-release:testing'}
...
```
......@@ -679,7 +675,7 @@ To be used, you need to:
new-release: {extends: '.semantic-release:stable'}
@@ -68,4 +68,61 @@
# Create the prereleases versions on `$TESTING_BRANCH`
# update `release.config.js` variable `betaBranch`
# update `.releaserc.js` variable `betaBranch`
testing-prerelease: {extends: '.semantic-release:testing}
+
+## tag contribution branches with a more stable name than `git-${CI_COMMIT_SHORT_SHA}`
......@@ -773,7 +769,7 @@ To do so, you need to:
# Create the release versions on `$STABLEE_BRANCH`
new-release: {extends: '.semantic-release:stable'}
@@ -69,6 +70,9 @@
# update `release.config.js` variable `betaBranch`
# update `.releaserc.js` variable `betaBranch`
testing-prerelease: {extends: '.semantic-release:testing}
+# Avoid regression by merging all pre-release fixes to `$DEV_BRANCH`
......
// No release is triggered for the types commented out below.
// Commits using these types will be incorporated into the next release.
//
// NOTE: Any changes here must be reflected in `CONTRIBUTING.md`.
module.exports = [
{ breaking: true, release: 'major' },
// {type: 'build', release: 'patch'},
// {type: 'chore', release: 'patch'},
// {type: 'ci', release: 'patch'},
{ type: 'docs', release: 'patch' },
{ type: 'feat', release: 'minor' },
{ type: 'fix', release: 'patch' },
{ type: 'perf', release: 'patch' },
{ type: 'refactor', release: 'patch' },
{ type: 'revert', release: 'patch' },
{ type: 'style', release: 'patch' },
{ type: 'test', release: 'patch' },
];
......@@ -34,7 +34,7 @@
# - 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 `.on-branch` rules templates or it must be overriden by
# the extending job to feet your need
#
# - a `${CI_COMMIT_SHA}` pointing to the last commit to verify
......@@ -63,7 +63,7 @@
#
.git:commitlint:
stage: lint
extends: .not-on-stable
extends: .on-branch
image: "${GIT_COMMITLINT_IMAGE}"
variables:
GIT_COMMITLINT_IMAGE: 'hub.eole.education/eole/commitlint:latest'
......
# -*- 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
# repository
#
---
#
# .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
# =================
#
.helm:package:
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
# =================
#
.helm:cm-push:
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: ''
HELM_BUILD_DIR: 'build'
CHART_DIR: '.'
...
......@@ -70,6 +70,14 @@ variables:
- !reference [.rules-map, not-on-semantic-release-commit]
- !reference [.rules-map, on-branch]
# Select branches
.on-branch:
rules:
- !reference [.rules-map, not-on-schedule]
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-tag]
- !reference [.rules-map, on-branch]
# Select the developpment branch
.on-dev:
rules:
......
......@@ -42,7 +42,8 @@
# - `.releaserc.yaml`
# - `.releaserc.yml`
#
# - the `.rules-map` rules templates
# - the `.on-stable` rules templates or it must be overriden by the
# extending job to feet your need
#
# - an access token named `GITLAB_TOKEN` with
# - `api`
......@@ -73,7 +74,7 @@
#
.semantic-release:stable:
stage: release
extends: .on-stable-with-semantic-release-config
extends: .on-stable
image: "$SEMANTIC_RELEASE_IMAGE"
variables:
SEMANTIC_RELEASE_IMAGE: 'hub.eole.education/eole/semantic-release-gitlab:latest'
......@@ -109,7 +110,8 @@
# - `.releaserc.yaml`
# - `.releaserc.yml`
#
# - the `.rules-map` rules templates
# - the `.on-testing` rules templates or it must be overriden by the
# extending job to feet your need
#
# - an access token named `GITLAB_TOKEN` with
# - `api`
......@@ -141,7 +143,7 @@
.semantic-release:testing:
extends:
- .semantic-release:stable
- .on-testing-with-semantic-release-config
- .on-testing
#
......@@ -172,7 +174,8 @@
# - `.releaserc.yaml`
# - `.releaserc.yml`
#
# - the `.rules-map` rules templates
# - the `.on-dev` rules templates or it must be overriden by the
# extending job to feet your need
#
# - an access token named `GITLAB_TOKEN` with
# - `api`
......@@ -204,50 +207,5 @@
.semantic-release:dev:
extends:
- .semantic-release:stable
- .on-dev-with-semantic-release-config
.on-stable-with-semantic-release-config:
rules:
- !reference [.rules-map, not-on-schedule]
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-semantic-release-commit]
- if: $CI_COMMIT_BRANCH == $STABLE_BRANCH
exists:
- release.config.js
- .releaserc
- .releaserc.yaml
- .releaserc.yml
- .releaserc.json
- .releaserc.js
when: on_success
.on-testing-with-semantic-release-config:
rules:
- !reference [.rules-map, not-on-schedule]
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-semantic-release-commit]
- if: $CI_COMMIT_BRANCH == $TESTING_BRANCH
exists:
- release.config.js
- .releaserc
- .releaserc.yaml
- .releaserc.yml
- .releaserc.json
- .releaserc.js
when: on_success
.on-dev-with-semantic-release-config:
rules:
- !reference [.rules-map, not-on-schedule]
- !reference [.rules-map, not-on-draft]
- !reference [.rules-map, not-on-semantic-release-commit]
- if: $CI_COMMIT_BRANCH == $DEV_BRANCH
exists:
- release.config.js
- .releaserc
- .releaserc.yaml
- .releaserc.yml
- .releaserc.json
- .releaserc.js
when: on_success
- .on-dev
...