Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
81 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
622482f
* fix ROOT_VERSION for dmt's trdl repo
Ranger-X Jun 17, 2025
36b17a0
* fix ROOT_VERSION for dmt's trdl repo
Ranger-X Jun 17, 2025
e82b990
* add "Login to target registry"
Ranger-X Jun 20, 2025
69cacca
* add printenv for debug .publish stage
Ranger-X Jun 20, 2025
c4ef564
* remove debug
Ranger-X Jun 20, 2025
6070ca6
Merge branch 'main' into i-makeev/feature-multirepo-workflow
Ranger-X Jul 7, 2025
dd36df0
WIP: add Svace setup/init to templates/multi-repo/Setup.gitlab-ci.yml
Ranger-X Jul 7, 2025
55e33e7
* remove `werf managed-images ls` from Scheduled cleanup task
Ranger-X Jul 18, 2025
a668412
* apply private git repo patch before `werf cleanup` to properly chec…
Ranger-X Jul 21, 2025
e15f278
* increase `Scheduled cleanup` timeout to 3 hour
Ranger-X Jul 23, 2025
8b30a26
* add "Logging in to registry ..." for easy debug login issues
Ranger-X Jul 24, 2025
e62bd77
* separate MODULES_REGISTRY and MODULES_TARGET_REGISTRY for publish/d…
Ranger-X Sep 24, 2025
df08fdf
* set default for MODULES_TARGET_REGISTRY_* variables from source reg…
Ranger-X Sep 24, 2025
8e962ff
* set default for MODULES_TARGET_REGISTRY_* variables from source reg…
Ranger-X Sep 24, 2025
ec2c5e9
* get templates/CVE_Scan from `main` branch
Ranger-X Sep 24, 2025
053c4cc
[CVE_Scan] feat: generate docker config without `docker login`
Ranger-X Sep 25, 2025
5c9c3c9
* deploy tags also to dev-registry when tag is specified
Ranger-X Sep 25, 2025
282554e
* fix `DEV | Publish tags also to dev-registry` job
Ranger-X Sep 25, 2025
6b81bb4
Merge remote-tracking branch 'origin/main' into i-makeev/feature-mult…
Ranger-X Sep 29, 2025
d56add5
* add Svace integration from `main` branch
Ranger-X Sep 29, 2025
4f63159
* fix DECKHOUSE_LIB_HELM_VERSION block indent in multi-repo/Setup
Ranger-X Sep 29, 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
66 changes: 66 additions & 0 deletions jobs/multi-repo/Deploy_DEV.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# 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

DEV | Publish tags also to dev-registry:
stage: deploy
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_COMMIT_TAG}
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
# deploy tags to dev-registry (as in prod registry) when tag specified
- if: '$CI_COMMIT_TAG && ($NO_DEPLOY_TAGS_TO_DEV == null || $NO_DEPLOY_TAGS_TO_DEV == "")'
when: on_success
# do not run in other cases
- when: never
script:
- |
if [ "$DEBUG_CI" = "true" -o "$DEBUG_CI" = "1" ]; then
printenv | sort
fi
# publish final images to dev registry and register module with $MODULES_MODULE_TAG
- !reference [.publish, script]
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 ]]
19 changes: 17 additions & 2 deletions templates/CVE_Scan.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,23 @@
echo "Preparing DOCKER_CONFIG and login to registries"
mkdir -p "${workdir}/docker"
export DOCKER_CONFIG="${workdir}/docker"
echo ${PROD_REGISTRY_PASSWORD} | docker login --username="${PROD_REGISTRY_USER}" --password-stdin ${PROD_REGISTRY}
echo ${DEV_REGISTRY_PASSWORD} | docker login --username="${DEV_REGISTRY_USER}" --password-stdin ${DEV_REGISTRY}

PROD_AUTH_STRING=$(echo -n "$PROD_REGISTRY_USER:$PROD_REGISTRY_PASSWORD" | base64 -w 0)
DEV_AUTH_STRING=$(echo -n "$DEV_REGISTRY_USER:$DEV_REGISTRY_PASSWORD" | base64 -w 0)

# Create config.json file
cat > ${DOCKER_CONFIG}/config.json << EOF
{
"auths": {
"$PROD_REGISTRY": {
"auth": "$PROD_AUTH_STRING"
},
"${DEV_REGISTRY}": {
"auth": "$DEV_AUTH_STRING"
}
}
}
EOF
echo
echo "======================================================="
echo
Expand Down
2 changes: 1 addition & 1 deletion templates/Setup.gitlab-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -110,4 +110,4 @@ before_script:

stages:
- build
- deploy
- deploy
33 changes: 33 additions & 0 deletions templates/multi-repo/Build.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
.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"

.svace_rules_mr:
rules:
- if: '$CI_MERGE_REQUEST_LABELS =~ /(^|,)analyze\/svace(,|$)/'
variables:
SVACE_ENABLED: "true"

.svace_rules_manual:
rules:
- if: $CI_PIPELINE_SOURCE == "web" && $SVACE_ENABLED == "true" && $CI_COMMIT_BRANCH
variables:
SVACE_ENABLED: "true"

.svace_rules_schedule:
rules:
- if: $CI_PIPELINE_SOURCE == "schedule" && $SVACE_ENABLED == "true" && $CI_COMMIT_BRANCH
variables:
SVACE_ENABLED: "true"
52 changes: 52 additions & 0 deletions templates/multi-repo/Cleanup.gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
Scheduled cleanup:
stage: cleanup
timeout: 3h
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
when: on_success
- when: never
before_script:
- !reference [.setup, before_script]
script:
- |
if [[ -z "${NO_PRIVATE_REPO_PATCH}" ]]; then
echo "Apply git private repo patch... Set NO_PRIVATE_REPO_PATCH=1 to disable it"
export GOPRIVATE=${CI_SERVER_HOST}
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/".insteadOf "git@${CI_SERVER_HOST}:"
fi

echo "Managed images which will be preserved during cleanup procedure:"
werf managed-images ls
echo "Starting cleanup..."
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"

if [[ -z "${NO_PRIVATE_REPO_PATCH}" ]]; then
echo "Apply git private repo patch... Set NO_PRIVATE_REPO_PATCH=1 to disable it"
export GOPRIVATE=${CI_SERVER_HOST}
git config --global url."https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}/".insteadOf "git@${CI_SERVER_HOST}:"
fi

echo "Managed images which will be preserved during cleanup procedure:"
werf managed-images ls
echo "Starting cleanup..."
werf cleanup
fi
Loading