Skip to content

[feature] Multi-repo workflow #13

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 60 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
60 commits
Select commit Hold shift + click to select a range
8fb624e
* default's `before_script` block in Setup moved to `.setup`, so it's…
Ranger-X Mar 25, 2025
d76af77
* add `.lint` job to `lint` stage
Ranger-X Mar 25, 2025
40fdc7e
* add workflow D8.Module
Ranger-X Mar 26, 2025
179c7b0
* revert back to dedicated files instead of workflow, because workflo…
Ranger-X Mar 26, 2025
c9d8ddb
* add .publish job to deploy stage
Ranger-X Mar 26, 2025
8d9fccb
fix: remove dependencies: .build from .publish
Ranger-X Mar 26, 2025
7a12eb9
* add Deploy_DEV job
Ranger-X Mar 26, 2025
f23c336
* fix .default_rules
Ranger-X Mar 26, 2025
e888650
* fix .default_rules
Ranger-X Mar 26, 2025
44afc49
* add jobs/Deploy_PROD
Ranger-X Mar 27, 2025
d40fc2e
refactor: move my `multi-repo` version to `templates/multi-repo`
Ranger-X Mar 28, 2025
34cad56
* multi-repo readme and example
Ranger-X Mar 31, 2025
13fb130
* fix URL to templates in `multi-repo-module.gitlab-ci.yml` as it alr…
Ranger-X Apr 1, 2025
f3eb923
* add `Publish default branch to DEV` job to `Deploy_DEV`
Ranger-X Apr 1, 2025
e13130d
* added `Cleanup` job
Ranger-X Apr 1, 2025
36be3a7
* add cleanup include to `multi-repo` example
Ranger-X Apr 1, 2025
d7bf265
* add `Auto cleanup` job which randomly (if current second is divided…
Ranger-X Apr 2, 2025
66f58d1
* fix `auto cleanup` job rules
Ranger-X Apr 2, 2025
ac682ef
* allow `auto cleanup` job to fail
Ranger-X Apr 2, 2025
f6526e5
* refactor PROD deploy with EDITION and parallel.matrix.RELEASE_CHANNEL
Ranger-X Apr 3, 2025
d37be2d
* do not run auto-cleanup when tag defined (release workflow)
Ranger-X Apr 3, 2025
faeaae9
* fix .deploy_prod_rules
Ranger-X Apr 3, 2025
615652d
* add deploy to PROD EE
Ranger-X Apr 3, 2025
267b541
* fix .deploy_prod_rules
Ranger-X Apr 3, 2025
96b6368
* dry run deploy jobs (without crane copy)
Ranger-X Apr 3, 2025
a60c3e0
* remove 'dry run' mode for deploy to prod
Ranger-X Apr 3, 2025
1105f86
* add description to variables
Ranger-X Apr 3, 2025
dea5cea
* fix FORCE_CI conditions
Ranger-X Apr 3, 2025
b9fffe1
* debug Build/deploy
Ranger-X Apr 3, 2025
dfdd145
* fix deploy
Ranger-X Apr 3, 2025
b30ef21
* add Deploy_PROD_experiment
Ranger-X Apr 7, 2025
7112660
* Deploy_PROD_experiment
Ranger-X Apr 7, 2025
4bbf96f
* fix Deploy_PROD_experiment
Ranger-X Apr 7, 2025
4ee3f68
* fix Deploy_PROD_experiment
Ranger-X Apr 7, 2025
3657f8f
* fix Deploy_PROD_experiment
Ranger-X Apr 7, 2025
6d3ea5f
* add inputs.editions to Deploy_PROD
Ranger-X Apr 7, 2025
9ac105f
* add spec.inputs.editions to README.md
Ranger-X Apr 7, 2025
61df342
* remove `if: $CI_COMMIT_BRANCH` rule from .default_rules
Ranger-X Apr 14, 2025
b1411a5
* add debug job
Ranger-X Apr 14, 2025
e6a7292
* fix `debug:printenv`
Ranger-X Apr 14, 2025
c40f9e9
[.default_rules] fix: do not run pipeline for push to the branch
Ranger-X Apr 14, 2025
40a8669
[.default_rules] fix: run when merge request is merged to main/master…
Ranger-X Apr 14, 2025
e04f697
[Publish merge request to DEV] fix: run
Ranger-X Apr 14, 2025
49158da
[Publish merge request to DEV] fix: run when new branch is created an…
Ranger-X Apr 14, 2025
cb2e7b6
[Publish merge request to DEV] fix: run when new branch is created an…
Ranger-X Apr 14, 2025
7b05506
* remove pipeline rule for "new branches"
Ranger-X Apr 14, 2025
342b777
* automatically create gitlab release when push new tag
Ranger-X Apr 15, 2025
56a6489
[Create gitlab release] * fix
Ranger-X Apr 15, 2025
b18b4ad
* remove release creating
Ranger-X Apr 15, 2025
7e3d048
* remove release creating
Ranger-X Apr 15, 2025
321ec8c
[.publish] fix: copy to destination registry only final images from `…
Ranger-X Apr 21, 2025
b0b284e
* set timeout for `Auto cleanup` job to 10 minutes instead of default…
Ranger-X Apr 22, 2025
eec1b1d
* print env vars on .deploy_prod if DEBUG_CI enabled
Ranger-X Apr 25, 2025
00112da
* grouping deploy jobs by release channels
Ranger-X Apr 25, 2025
2e963f5
* slightly rename deploy jobs: move env suffix (DEV/PROD) to begin of…
Ranger-X Apr 25, 2025
89dd366
* slightly rename deploy jobs
Ranger-X Apr 25, 2025
c92fc2d
* slightly rename deploy jobs
Ranger-X Apr 25, 2025
61fee16
* slightly rename deploy jobs
Ranger-X Apr 25, 2025
9d381c3
* do not download base_images.yml if BASE_IMAGES_VERSION is empty
Ranger-X May 15, 2025
1accb07
* use BASE_IMAGES_VERSION v0.5.2
Ranger-X May 15, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
31 changes: 30 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,35 @@ Build:
extends: .build
```

> Instead of `/main/`, you can specify a specific commit to ensure changes do not affect your CI.
> Instead of `/main/`, you can specify a specific commit to ensure changes do not affect your CI.

The [`examples`](examples/) folder contains examples of `.gitlab-ci.yml` that can be assembled from the templates.

## Multi-repository templates

In `templates/multi-repo` the CI workflow differs from `basic` CI (which in `templates`) in the following key aspects:

- In `multi-repo` workflow we can push to `dev` and `prod` registries separately with their own rules (see `jobs/multi-repo` and/or `examples/multi-repo-module.gitlab-ci.yml` for example jobs).
- All werf's caches and other artifacts (from `build` stage) are stored in Gitlab's module's registry by default. And **only final images** are pushed to the dev/prod registries. So, even in dev-registry there **should be no** "build-time garbage" and/or some "extra" images/layers for each module.

### Detailed differences between `multi-repo` and `basic` workflows

- [General] There is additional stage `lint` before `build` and `cleanup` stage after `deploy`.
- [General] All `only` sections (like `only: [tags, branches]`) replaced with corresponding `rules` section.
- [General] Added `Scheduled cleanup` job to cleanup Gitlab's registry by pipeline schedule
- [General] Added `Auto cleanup` job to cleanup Gitlab's registry BEFORE `build` stage. Can be disabled via `AUTO_CLEANUP="false"` variable.
- [General] Added `.default_rules` hidden job (see `templates/multi-repo/Setup.gitlab-ci.yml`) for easy modification of this whole workflow.
- [General] Added `.deploy-prod-rules` hidden job (see `templates/multi-repo/Deploy.gitlab-ci.yml`) for easy modification of `deploy to production` workflow.
- [General] Added `jobs/multi-repo` jobs files which user can include and use in their own workflow.
- [General] Added ability to specify which module's `EDITION` (`CE`, `EE`, etc) should be pushed to PRODUCTION registry.
- [Refactor] Default `before_script` section (see `templates/Setup.gitlab-ci.yml`) moved to `.setup/before_script` job.
- [Refactor] `dmt lint` job moved to `lint` stage in dedicated `templates/multi-repo/Lint.gitlab-ci.yml` file.
- [Refactor] All werf's caches and other artifacts (from `build` stage) are stored in Gitlab's registry (`${CI_REGISTRY_IMAGE}/${MODULES_MODULE_NAME}`) by default.
- [Refactor] Images publishing (via `crane copy`) and module's self-registration processes moved to dedicated hidden job `.publish` (see `templates/multi-repo/Deploy.gitlab-ci.yml`).

## Variables

`$MODULES_REGISTRY` - base URL for the registry, e.g. `registry.example.com`
`$MODULES_REGISTRY_PATH` - path to modules repository in registry, e.g. `deckhouse/modules`
`$MODULES_MODULE_NAME` (Optional) - module name, by default it is equal to the project name
`$RELEASE_CHANNEL` - lowercase release channel name, e.g., `alpha`, `stable`, `early-access`
59 changes: 59 additions & 0 deletions examples/multi-repo-module.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
include:
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/templates/multi-repo/Setup.gitlab-ci.yml'
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/templates/multi-repo/Lint.gitlab-ci.yml'
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/templates/multi-repo/Build.gitlab-ci.yml'
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/templates/multi-repo/Deploy.gitlab-ci.yml'
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/templates/multi-repo/Cleanup.gitlab-ci.yml'
# deploy jobs for DEV registry
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/jobs/multi-repo/Deploy_DEV.gitlab-ci.yml'
# deploy jobs for PROD registry
- remote: 'https://raw.githubusercontent.com/deckhouse/modules-gitlab-ci/refs/heads/main/jobs/multi-repo/Deploy_PROD.gitlab-ci.yml'
inputs:
# Editions used in your module. Array of following items:
# ce - Community edition
# ee - Enterprise edition
# fe - Flant edition (internal edition for Flant's engineers)
# se - Standard edition
# se-plus - Standard edition +
editions:
# All values must be in lowercase and quoted
- "ce"
- "ee"
- "fe"
- "se"
- "se-plus"

variables:
# Do not forget to put these variables to your Gitlab CI secrets:
# They are REQUIRED and used for pulling/pushing images to the corresponding registry
# - DEV_MODULES_REGISTRY: DEV registry domain (like: registry.example.com)
# - DEV_MODULES_REGISTRY_PATH: path to modules repository in DEV registry (like: deckhouse/modules)
# - DEV_MODULES_REGISTRY_LOGIN: username to log in to DEV registry
# - DEV_MODULES_REGISTRY_PASSWORD: password to log in to DEV registry

# WARNING: If some of following variables are NOT SET, then there is NO production deployment jobs will be created in pipeline
# - PROD_MODULES_REGISTRY: PROD registry domain (like: registry.example.com)
# - PROD_MODULES_REGISTRY_PATH: path to modules repository in PROD registry (like: deckhouse/modules)
# - PROD_MODULES_REGISTRY_LOGIN: username to log in to PROD registry
# - PROD_MODULES_REGISTRY_PASSWORD: password to log in to PROD registry
WERF_VERSION: "2 stable"
BASE_IMAGES_VERSION: v0.2

default:
tags:
- my-runner-tag


###### LINT STAGE ######

Lint:
extends: .lint

###### END OF LINT STAGE ######

###### BUILD STAGE ######

Build:
extends: .build

###### END OF BUILD STAGE ######
13 changes: 13 additions & 0 deletions jobs/multi-repo/Debug.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
variables:
DEBUG_CI:
value: "false"
description: "Run debug job(s)"

debug:printenv:
stage: build
rules:
# run if $DEBUG_CI variable is set to true
- if: $DEBUG_CI == "true" || $DEBUG_CI == "1"
script:
- |
printenv | sort
41 changes: 41 additions & 0 deletions jobs/multi-repo/Deploy_DEV.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
# emulate same behaviour as in Deckhouse Github registry
# when opened PRs will pushed to dev registry
DEV | Publish merge request:
extends: .publish
variables:
MODULES_REGISTRY: ${DEV_MODULES_REGISTRY}
MODULES_REGISTRY_PATH: ${DEV_MODULES_REGISTRY_PATH}
MODULES_REGISTRY_LOGIN: ${DEV_MODULES_REGISTRY_LOGIN}
MODULES_REGISTRY_PASSWORD: ${DEV_MODULES_REGISTRY_PASSWORD}
# names as in Github: "pr" + merge request project-level ID instead of branch name
MODULES_MODULE_TAG: pr${CI_MERGE_REQUEST_IID}
rules:
# do not run if some required variables is empty
- if: '$DEV_MODULES_REGISTRY == null || $DEV_MODULES_REGISTRY == "" || $DEV_MODULES_REGISTRY_PATH == null || $DEV_MODULES_REGISTRY_PATH == ""'
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only, when and rules don't work well together. If we implement rules, then it's better to get rid of when without rules in the job and only in these jobs.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In multi-repo templates (templates/multi-repo/*.yml) I use rules everywhere. Do you mean get rid of only in simple templates (templates/*.yml)?

when: never
# run only for merge requests
- if: $CI_MERGE_REQUEST_IID && $CI_MERGE_REQUEST_SOURCE_BRANCH_NAME != $CI_DEFAULT_BRANCH && $CI_PIPELINE_SOURCE == "merge_request_event"
when: on_success
# run when new branch is created and there are no opened merge requests for this branch and no commits to this branch yet (completely new branch from master/main)
# - if: $CI_COMMIT_BRANCH != $CI_DEFAULT_BRANCH && ($CI_MERGE_REQUEST_IID == null || $CI_MERGE_REQUEST_IID == "") && $CI_COMMIT_BEFORE_SHA == "0000000000000000000000000000000000000000"
# when: on_success
# do not run in other cases
- when: never

DEV | Publish default branch:
extends: .publish
variables:
MODULES_REGISTRY: ${DEV_MODULES_REGISTRY}
MODULES_REGISTRY_PATH: ${DEV_MODULES_REGISTRY_PATH}
MODULES_REGISTRY_LOGIN: ${DEV_MODULES_REGISTRY_LOGIN}
MODULES_REGISTRY_PASSWORD: ${DEV_MODULES_REGISTRY_PASSWORD}
MODULES_MODULE_TAG: ${CI_DEFAULT_BRANCH}
rules:
# do not run if some required variables is empty
- if: '$DEV_MODULES_REGISTRY == null || $DEV_MODULES_REGISTRY == "" || $DEV_MODULES_REGISTRY_PATH == null || $DEV_MODULES_REGISTRY_PATH == ""'
when: never
# run only when push to default (main/master) branch
- if: $CI_PIPELINE_SOURCE == "push" && $CI_COMMIT_BRANCH == $CI_DEFAULT_BRANCH
when: on_success
# do not run in other cases
- when: never
54 changes: 54 additions & 0 deletions jobs/multi-repo/Deploy_PROD.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
# https://docs.gitlab.com/ci/inputs/
spec:
inputs:
editions:
type: array
description: List of module editions
default:
- ee
- fe
- se
- se-plus

---

PROD | Alpha:
extends: .deploy_prod
variables:
RELEASE_CHANNEL: alpha
parallel:
matrix:
- EDITION: $[[ inputs.editions ]]

PROD | Beta:
extends: .deploy_prod
variables:
RELEASE_CHANNEL: beta
parallel:
matrix:
- EDITION: $[[ inputs.editions ]]

PROD | EarlyAccess:
extends: .deploy_prod
variables:
RELEASE_CHANNEL: early-access
parallel:
matrix:
- EDITION: $[[ inputs.editions ]]

PROD | Stable:
extends: .deploy_prod
variables:
RELEASE_CHANNEL: stable
parallel:
matrix:
- EDITION: $[[ inputs.editions ]]

# because uppercased letters are ordered before lowercased, so put rock-solid job last as in stability level, not alphabetical
PROD | rock-solid:
extends: .deploy_prod
variables:
RELEASE_CHANNEL: rock-solid
parallel:
matrix:
- EDITION: $[[ inputs.editions ]]
2 changes: 1 addition & 1 deletion templates/Build.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,4 +43,4 @@
--new_tag "${MODULES_MODULE_SOURCE}:${MODULES_MODULE_NAME}"
only:
- tags
- branches
- branches
6 changes: 3 additions & 3 deletions templates/Deploy.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@
script:
- |
REPO="${MODULES_MODULE_SOURCE}/${MODULES_MODULE_NAME}/release"

IMAGE_SRC="${REPO}:${MODULES_MODULE_TAG}"
IMAGE_DST="${REPO}:${RELEASE_CHANNEL}"

echo "✨ Pushing ${IMAGE_SRC} to ${IMAGE_DST}"
crane copy "${IMAGE_SRC}" "${IMAGE_DST}"
only:
- tags
when: manual
when: manual
2 changes: 1 addition & 1 deletion templates/Setup.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,4 @@ before_script:
- curl --fail -sSLO https://fox.flant.com/api/v4/projects/deckhouse%2Fbase-images/packages/generic/base_images/${BASE_IMAGES_VERSION}/base_images.yml
stages:
- build
- deploy
- deploy
15 changes: 15 additions & 0 deletions templates/multi-repo/Build.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
.build:
stage: build
rules:
- !reference [.default_rules, rules]
before_script:
- !reference [.setup, before_script]
script:
# Build images
- |
werf build \
--save-build-report --build-report-path images_tags_werf.json
artifacts:
paths:
- images_tags_werf.json
expire_in: "30 days"
33 changes: 33 additions & 0 deletions templates/multi-repo/Cleanup.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
Scheduled cleanup:
stage: cleanup
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
- when: never
before_script:
- !reference [.setup, before_script]
script:
- werf managed-images ls
- werf cleanup

Auto cleanup:
stage: cleanup
allow_failure: true
timeout: 10 minutes
rules:
# do not run if this job is explicitly disabled by user
- if: $AUTO_CLEANUP == "false" || $AUTO_CLEANUP == "0" || $AUTO_CLEANUP == ""
when: never
# do not run if there is a tag (release workflow)
- if: $CI_COMMIT_TAG
when: never
- !reference [.default_rules, rules]
before_script:
- !reference [.setup, before_script]
script:
- |
if (( $(date +%s) % 10 == 0 )); then
echo "✨ Run auto cleanup"
werf managed-images ls
werf cleanup
fi
103 changes: 103 additions & 0 deletions templates/multi-repo/Deploy.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
.publish:
stage: deploy
script:
- |
# Login to Gitlab (source) registry if target registry is not same Gitlab
if [[ "x${MODULES_REGISTRY}" != "x${CI_REGISTRY}" ]]; then
echo "Login to Gitlab (source) ${CI_REGISTRY}..."
werf cr login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
fi

# Login to target registry
werf cr login -u ${MODULES_REGISTRY_LOGIN} -p ${MODULES_REGISTRY_PASSWORD} ${MODULES_REGISTRY}
# generate MODULES_MODULE_SOURCE
- |
export MODULES_MODULE_SOURCE="${MODULES_REGISTRY}/${MODULES_REGISTRY_PATH}"

# Module images
- |
jq -r '.Images | values[] | select (.Final==true) | .WerfImageName + " " + .DockerImageName + " " + .DockerTag + " " + .DockerImageDigest' < images_tags_werf.json | while read line; do
image="$(cut -d " " -f 1 <<< ${line})"
docker_image="$(cut -d " " -f 2 <<< ${line})"
docker_tag="$(cut -d " " -f 3 <<< ${line})"
shasum="$(cut -d " " -f 4 <<< ${line})"
name="$(tr '[:lower:]' '[:upper:]' <<< ${image} | sed 's|[-/]|_|g')"

# image: pg-images-17.3-bookworm-standard;
# name: PG_IMAGES_17.3_BOOKWORM_STANDARD;
# shasum: sha256:cd6daa30c94ec77b352156cbf1c05c8e98b44d1d3a47fa2b0a1083587247f730;
# docker_image: registry.flant.com/team/managed-services/managed-psql/managed-psql-d8/managed-postgres:ed0388a743d61926309d1023e02c639c1006f7b7b56d78161f32b0e0-1744971955188;
# docker_tag: ed0388a743d61926309d1023e02c639c1006f7b7b56d78161f32b0e0-1744971955188

IMAGE_SRC="${docker_image}"
IMAGE_DST="${MODULES_MODULE_SOURCE}/${MODULES_MODULE_NAME}:${docker_tag}"

echo "✨ Pushing ${IMAGE_SRC} to ${IMAGE_DST}"
crane copy ${IMAGE_SRC} ${IMAGE_DST}
done

# Bundle image
- |
IMAGE_SRC="$(jq -r '.Images."bundle".DockerImageName' images_tags_werf.json)"
IMAGE_DST="${MODULES_MODULE_SOURCE}/${MODULES_MODULE_NAME}:${MODULES_MODULE_TAG}"

echo "✨ Pushing BUNDLE ${IMAGE_SRC} to ${IMAGE_DST}"
crane copy ${IMAGE_SRC} ${IMAGE_DST}
# Release-channel image
- |
IMAGE_SRC="$(jq -r '.Images."release-channel-version".DockerImageName' images_tags_werf.json)"
IMAGE_DST="${MODULES_MODULE_SOURCE}/${MODULES_MODULE_NAME}/release:${MODULES_MODULE_TAG}"

echo "✨ Pushing RELEASE ${IMAGE_SRC} to ${IMAGE_DST}"
crane copy ${IMAGE_SRC} ${IMAGE_DST}
# Register module
- |
echo "✨ Register the module ${MODULES_MODULE_NAME}"
crane append \
--oci-empty-base \
--new_layer "" \
--new_tag "${MODULES_MODULE_SOURCE}:${MODULES_MODULE_NAME}"

.deploy:
stage: deploy
script:
- |
REPO="${MODULES_REGISTRY}/${MODULES_REGISTRY_PATH}/${MODULES_MODULE_NAME}/release"

IMAGE_SRC="${REPO}:${MODULES_MODULE_TAG}"
IMAGE_DST="${REPO}:${RELEASE_CHANNEL}"

echo "✨ Pushing ${IMAGE_SRC} to ${IMAGE_DST}"
crane copy "${IMAGE_SRC}" "${IMAGE_DST}"

.deploy_prod_rules:
rules:
# add MANUAL deploy job if $FORCE_CI variable is set
- if: $FORCE_CI == "true" || $FORCE_CI == "1"
when: manual
# do not run if some required variables is empty
- if: '$PROD_MODULES_REGISTRY == null || $PROD_MODULES_REGISTRY == "" || $EDITION == null || $EDITION == "" || $RELEASE_CHANNEL == null || $RELEASE_CHANNEL == ""'
when: never
# add MANUAL deploy job only if it is a tag defined (release workflow)
- if: '$CI_COMMIT_TAG'
when: manual

.deploy_prod:
stage: deploy
rules:
- !reference [.deploy_prod_rules, rules]
variables:
MODULES_REGISTRY: $PROD_MODULES_REGISTRY
MODULES_REGISTRY_LOGIN: $PROD_MODULES_REGISTRY_LOGIN
MODULES_REGISTRY_PASSWORD: $PROD_MODULES_REGISTRY_PASSWORD
# path in PROD registry must be hardcoded
MODULES_REGISTRY_PATH: deckhouse/${EDITION}/modules
script:
- |
if [ "$DEBUG_CI" = "true" -o "$DEBUG_CI" = "1" ]; then
printenv | sort
fi
# publish final images to prod registry and register module with $MODULES_MODULE_TAG
- !reference [.publish, script]
# make 'symlink' to published module tag for specified release-channel
- !reference [.deploy, script]
Loading