-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #144 from DSD-DBS/gitlab-ci
Add release train Gitlab CI template
- Loading branch information
Showing
5 changed files
with
231 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
include: "/ci-templates/gitlab/release-train.yml" | ||
|
||
.staging: &staging | ||
rules: | ||
# For commits on the main branch, build for the staging environment | ||
- if: '$CI_COMMIT_REF_NAME == "main"' | ||
- when: manual | ||
variables: | ||
ENVIRONMENT: staging | ||
CAPELLA_DOCKER_IMAGES_REVISION: "$CI_COMMIT_REF_NAME" | ||
IMAGE_BUILDER_GITLAB_REPOSITORY: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
BUILD_FOR_LATEST_TAG: "0" | ||
DOCKER_BUILD_ARGS: "" # Enable Docker build cache | ||
|
||
.production: &production | ||
rules: | ||
# For tags, build for the production environment | ||
- if: "$CI_COMMIT_TAG != null" | ||
variables: | ||
ENVIRONMENT: production | ||
CAPELLA_DOCKER_IMAGES_REVISION: "$CI_COMMIT_REF_NAME" | ||
IMAGE_BUILDER_GITLAB_REPOSITORY: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
BUILD_FOR_LATEST_TAG: "1" | ||
|
||
production-base: | ||
extends: .base | ||
<<: *production | ||
|
||
production-jupyter: | ||
extends: .jupyter | ||
needs: | ||
- job: production-base | ||
optional: true | ||
<<: *production | ||
|
||
production-capella: | ||
extends: .capella | ||
needs: | ||
- job: production-base | ||
optional: true | ||
<<: *production | ||
|
||
staging-base: | ||
extends: .base | ||
<<: *staging | ||
|
||
staging-jupyter: | ||
extends: .jupyter | ||
needs: | ||
- job: staging-base | ||
optional: true | ||
<<: *staging | ||
|
||
staging-capella: | ||
extends: .capella | ||
needs: | ||
- job: staging-base | ||
optional: true | ||
<<: *staging |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
SPDX-License-Identifier: Apache-2.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
# SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
variables: | ||
# Revision of Github repository. If using a mirror, no change is needed. | ||
CAPELLA_DOCKER_IMAGES_REVISION: "$CI_COMMIT_REF_NAME" | ||
|
||
# Provide the path to image builder repository | ||
IMAGE_BUILDER_GITLAB_REPOSITORY: "path/to/project" | ||
|
||
# The base image does not depend on the Capella version. | ||
# Therefore, we're building it once before building the dependent Capella images. | ||
.base: | ||
trigger: | ||
project: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
strategy: depend | ||
variables: | ||
CAPELLA_DOCKER_IMAGES_REVISION: $CAPELLA_DOCKER_IMAGES_REVISION | ||
BUILD_FOR_LATEST_TAG: "1" | ||
|
||
# Only build base image | ||
BASE: "1" | ||
|
||
.capella: | ||
trigger: | ||
project: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
strategy: depend | ||
parallel: | ||
matrix: | ||
- CAPELLA_VERSION: ["5.0.0", "5.2.0", "6.0.0", "6.1.0"] | ||
variables: | ||
CAPELLA_DOCKER_IMAGES_REVISION: $CAPELLA_DOCKER_IMAGES_REVISION | ||
BUILD_FOR_LATEST_TAG: "1" | ||
|
||
# Build all Capella images | ||
CAPELLA_BASE: "1" | ||
CAPELLA_CLI: "1" | ||
CAPELLA_REMOTE: "1" | ||
T4C_CLIENT_BASE: "1" | ||
T4C_CLIENT_BACKUP: "1" | ||
T4C_CLIENT_EXPORTER: "1" | ||
T4C_CLIENT_REMOTE: "1" | ||
T4C_CLIENT_REMOTE_PURE_VARIANTS: "1" | ||
CAPELLA_EASE: "1" | ||
CAPELLA_EASE_REMOTE: "1" | ||
CAPELLA_READONLY: "1" | ||
|
||
.jupyter: | ||
trigger: | ||
project: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
strategy: depend | ||
variables: | ||
CAPELLA_DOCKER_IMAGES_REVISION: $CAPELLA_DOCKER_IMAGES_REVISION | ||
BUILD_FOR_LATEST_TAG: "1" | ||
|
||
# Only build jupyter image | ||
JUPYTER: "1" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,88 @@ | ||
<!-- | ||
~ SPDX-FileCopyrightText: Copyright DB Netz AG and the capella-collab-manager contributors | ||
~ SPDX-License-Identifier: Apache-2.0 | ||
--> | ||
|
||
# Release train | ||
|
||
The image builder Gitlab CI/CD template is limited to one environment and one Capella version. | ||
In addition, we provide a release train template, which can be used to trigger the image builder pipeline with a matrix of Capella versions and environments. | ||
|
||
<!-- prettier-ignore --> | ||
!!! warning | ||
To continue, create a new image builder Gitlab repository and follow the instuctions of the image builder template. | ||
|
||
The pipeline is not triggered automatically. There are a few options to trigger the pipeline automatically: | ||
|
||
For changes on Github in this repository (e.g., new push to branches or a new tag): | ||
|
||
- If you're using the PREMIUM version of Gitlab, pipelines can be automatically triggered for external repositories: https://docs.gitlab.com/ee/ci/ci_cd_for_external_repos/ | ||
- Detect changes on the remote with `git ls-remote` and trigger a Gitlab CI pipeline with a cronjob. | ||
|
||
For changes in your Gitlab image builder repository: | ||
|
||
- Use a [Gitlab trigger](https://docs.gitlab.com/ee/ci/yaml/#trigger) to trigger the release train pipeline. | ||
|
||
You can customize the pipeline to your needs (e.g., define multiple environments). The template provides three different jobs `.base`, `.capella` and `.jupyter` which can be extended: | ||
|
||
```yml | ||
include: | ||
- remote: https://raw.githubusercontent.com/DSD-DBS/capella-dockerimages/${CAPELLA_DOCKER_IMAGES_REVISION}/ci-templates/gitlab/release-train.yml" | ||
|
||
.staging: &staging | ||
rules: | ||
# For commits on the main branch, build for the staging environment | ||
- if: '$CI_COMMIT_REF_NAME == "main"' | ||
- when: manual | ||
variables: | ||
ENVIRONMENT: staging | ||
CAPELLA_DOCKER_IMAGES_REVISION: "$CI_COMMIT_REF_NAME" | ||
IMAGE_BUILDER_GITLAB_REPOSITORY: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
BUILD_FOR_LATEST_TAG: "0" | ||
|
||
.production: &production | ||
rules: | ||
# For tags, build for the production environment | ||
- if: "$CI_COMMIT_TAG != null" | ||
variables: | ||
ENVIRONMENT: production | ||
CAPELLA_DOCKER_IMAGES_REVISION: "$CI_COMMIT_REF_NAME" | ||
IMAGE_BUILDER_GITLAB_REPOSITORY: "$IMAGE_BUILDER_GITLAB_REPOSITORY" | ||
BUILD_FOR_LATEST_TAG: "1" | ||
|
||
production-base: | ||
extends: .base | ||
<<: *production | ||
|
||
production-jupyter: | ||
extends: .jupyter | ||
needs: | ||
- job: production-base | ||
optional: true | ||
<<: *production | ||
|
||
production-capella: | ||
extends: .capella | ||
needs: | ||
- job: production-base | ||
optional: true | ||
<<: *production | ||
|
||
staging-base: | ||
extends: .base | ||
<<: *staging | ||
|
||
staging-jupyter: | ||
extends: .jupyter | ||
needs: | ||
- job: staging-base | ||
optional: true | ||
<<: *staging | ||
|
||
staging-capella: | ||
extends: .capella | ||
needs: | ||
- job: staging-base | ||
optional: true | ||
<<: *staging | ||
``` |