Skip to content
Permalink
Browse files
fix(giterminism): --add-custom-tag option is not allowed
Signed-off-by: Alexey Igrychev <alexey.igrychev@flant.com>
  • Loading branch information
alexey-igrychev committed Sep 9, 2022
1 parent bc691f2 commit 8b72dfef1076a8374d89ba9def584095150e6f29
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 14 deletions.
@@ -88,10 +88,6 @@ func getCustomTagFuncList(tagOptionValues []string, commonCmdData *CmdData, gite
return nil, fmt.Errorf("custom tags can only be used with remote storage: --repo=ADDRESS param required")
}

if err := giterminismManager.Inspector().InspectCustomTags(); err != nil {
return nil, err
}

templateName := "--add/use-custom-tag"
tmpl := template.New(templateName).Delims("%", "%")
tmpl = tmpl.Funcs(map[string]interface{}{
@@ -150,9 +146,6 @@ func GetUseCustomTagFunc(commonCmdData *CmdData, giterminismManager giterminism_
if *commonCmdData.UseCustomTag != "" {
tagOptionValues = []string{*commonCmdData.UseCustomTag}
}
if len(tagOptionValues) == 0 {
return nil, nil
}

customTagFuncList, err := getCustomTagFuncList(tagOptionValues, commonCmdData, giterminismManager, werfConfig)
if err != nil {
@@ -163,6 +156,10 @@ func GetUseCustomTagFunc(commonCmdData *CmdData, giterminismManager giterminism_
return nil, nil
}

if err := giterminismManager.Inspector().InspectCustomTags(); err != nil {
return nil, err
}

if len(customTagFuncList) != 1 {
panic("unexpected condition")
}
@@ -13,8 +13,8 @@ directives:
- name: allowCustomTags
value: "bool"
description:
en: Allow the use of --add-custom-tag and --use-custom-tag options
ru: Разрешить опции --add-custom-tag и --use-custom-tag
en: Allow the use of --use-custom-tag option
ru: Разрешить опцию --use-custom-tag
- name: config
description:
en: The rules of loosening giterminism for the werf configuration file (werf.yaml)
@@ -32,11 +32,11 @@ By default, werf prohibits using a particular set of directives and Go-template

#### CLI

##### --add-custom-tag and --use-custom-tag options
##### \-\-use-custom-tag option

The use of tag aliases with immutable values (e.g., `%image%-master`) makes previous deployments unreproducible and requires specifying the policy `imagePullPolicy: Always` for each image when configuring application containers in the helm chart.

To activate `--add-custom-tag` and `--use-custom-tag` options it is necessary to use [werf-giterminism.yaml]({{ "reference/werf_giterminism_yaml.html" | true_relative_url }}), but we recommend thinking again about the possible consequences.
To activate `--use-custom-tag` option it is necessary to use [werf-giterminism.yaml]({{ "reference/werf_giterminism_yaml.html" | true_relative_url }}), but we recommend thinking again about the possible consequences.

#### Go-template functions

@@ -32,11 +32,11 @@ werf не позволяет работать с незакоммиченным

#### CLI

##### Опции --add-custom-tag и --use-custom-tag
##### Опция --use-custom-tag

Использование алиасов тегов с неизменяемыми значениями (например, `%image%-master`) делает предыдущие выкаты невоспроизводимыми и требует указания политики `imagePullPolicy: Always` для каждого образа при конфигурации контейнеров приложения в helm-чарте.

Для активации опций `--add-custom-tag` и `--use-custom-tag` необходимо использовать [werf-giterminism.yaml]({{ "reference/werf_giterminism_yaml.html" | true_relative_url }}), но мы рекомендуем еще раз подумать о возможных последствиях.
Для активации опции `--use-custom-tag` необходимо использовать [werf-giterminism.yaml]({{ "reference/werf_giterminism_yaml.html" | true_relative_url }}), но мы рекомендуем еще раз подумать о возможных последствиях.

#### Функции Go-шаблонизатора

@@ -13,5 +13,5 @@ func (i Inspector) InspectCustomTags() error {

return errors.NewError(`custom tags not allowed by giterminism
The use of --add-custom-tag and --use-custom-tag options might make previous deployments unreproducible and require extra configuration in the helm chart.`)
The use of --use-custom-tag option might make previous deployments unreproducible and require extra configuration in the helm chart.`)
}

0 comments on commit 8b72dfe

Please sign in to comment.