Update readme with renovate configuration for digest updates #514

Merged
mmalyska merged 6 commits from readme-renovate-digest into main 2023-09-27 07:31:53 +00:00
mmalyska commented 2023-09-19 09:09:50 +00:00 (Migrated from gitea.com)

Description of the change

Update README with information how to configure renovate to update digest for gitea charts.

Benefits

Automatic digest updates for people using renovate.

### Description of the change Update README with information how to configure renovate to update digest for gitea charts. ### Benefits Automatic digest updates for people using renovate.
pat-s (Migrated from gitea.com) reviewed 2023-09-19 11:47:59 +00:00
pat-s (Migrated from gitea.com) reviewed 2023-09-19 12:41:12 +00:00
pat-s (Migrated from gitea.com) left a comment

Thanks!

Some grammar/wording suggestions.

Thanks! Some grammar/wording suggestions.
pat-s (Migrated from gitea.com) commented 2023-09-19 12:41:12 +00:00

To be able to use a digest value which is automatically updated by renovate a custom "regexManager" is required.

To be able to use a digest value which is automatically updated by `renovate` a custom "regexManager" is required.
pat-s (Migrated from gitea.com) commented 2023-09-19 12:42:02 +00:00

Here's an examplary values.yml definition which makes use of a digest:

Here's an examplary `values.yml` definition which makes use of a digest:
pat-s (Migrated from gitea.com) commented 2023-09-19 12:42:22 +00:00

pullPolicy: IfNotPresent can be removed here

`pullPolicy: IfNotPresent` can be removed here
pat-s (Migrated from gitea.com) commented 2023-09-19 12:43:39 +00:00

By default renovate adds the digest after the tag.
To comply with the Gitea helm chart definition of the digest parameter, a custom "regexManager" definition is required:

By default renovate adds the digest after the tag. To comply with the Gitea helm chart definition of the digest parameter, a custom "regexManager" definition is required:
pat-s (Migrated from gitea.com) commented 2023-09-19 12:45:33 +00:00

"Apply an explicit gitea digest field match"

"Apply an explicit gitea digest field match"
pat-s (Migrated from gitea.com) commented 2023-09-19 12:44:39 +00:00

"fileMatch": ["values\\.yaml|values\\.yml"]

`"fileMatch": ["values\\.yaml|values\\.yml"]`
pat-s (Migrated from gitea.com) commented 2023-09-19 12:58:43 +00:00

I will do it with "values\\.ya?ml" to make a optional.

I will do it with `"values\\.ya?ml"` to make `a` optional.
pat-s (Migrated from gitea.com) commented 2023-09-19 12:46:40 +00:00

I think this sentence could be removed, the parameter scope should be quite clear.

I think this sentence could be removed, the parameter scope should be quite clear.
justusbunsi (Migrated from gitea.com) reviewed 2023-09-22 13:58:57 +00:00
justusbunsi (Migrated from gitea.com) left a comment

Thanks @mmalyska for creating this PR. I finally found time to review it and found some issues.

Thanks @mmalyska for creating this PR. I finally found time to review it and found some issues.
justusbunsi (Migrated from gitea.com) commented 2023-09-22 14:55:51 +00:00

We should name Renovate with capital R. It's how they spell themselves. And probably link to https://docs.renovatebot.com/configuration-options/#regexmanagers.

We should name Renovate with capital R. It's how they spell themselves. And probably link to https://docs.renovatebot.com/configuration-options/#regexmanagers.
justusbunsi (Migrated from gitea.com) commented 2023-09-25 09:52:58 +00:00

They renamed regexManager to customManagers so following that I've updated configuration https://github.com/renovatebot/renovate/pull/24451

They renamed `regexManager` to `customManagers` so following that I've updated configuration https://github.com/renovatebot/renovate/pull/24451
justusbunsi (Migrated from gitea.com) commented 2023-09-22 13:58:57 +00:00

The image specification is on top level of values.yaml

- gitea:
-   image:
-     repository: gitea/gitea
-     tag: 1.20.2
-     digest: sha256:6e3b85a36653894d6741d0aefb41dfaac39044e028a42e0a520cc05ebd7bfc3f
+ image:
+   repository: gitea/gitea
+   tag: 1.20.2
+   digest: sha256:6e3b85a36653894d6741d0aefb41dfaac39044e028a42e0a520cc05ebd7bfc3f
The image specification is on top level of `values.yaml` ```diff - gitea: - image: - repository: gitea/gitea - tag: 1.20.2 - digest: sha256:6e3b85a36653894d6741d0aefb41dfaac39044e028a42e0a520cc05ebd7bfc3f + image: + repository: gitea/gitea + tag: 1.20.2 + digest: sha256:6e3b85a36653894d6741d0aefb41dfaac39044e028a42e0a520cc05ebd7bfc3f ```
justusbunsi (Migrated from gitea.com) commented 2023-09-22 14:56:23 +00:00

Same as above: Renovate with capital R.

Same as above: Renovate with capital R.
justusbunsi (Migrated from gitea.com) commented 2023-09-22 14:53:58 +00:00

The matchStrings pattern matches non-compliant strings (https://regex101.com/r/G43cMf/1).

I suggest the following changes to the configuration to:

  {
      "description": "Apply an explicit gitea digest field match",
      "fileMatch": ["values\\.ya?ml"],
-     "matchStrings": ["(?<depName>gitea\\/gitea)\\n.*?tag: (?<currentValue>[^@].*?)\\n.*?digest: (?<currentDigest>sha256:[a-f0-9]+)"],
+     "matchStrings": ["(?<depName>gitea\\/gitea)\\n(?<indentation>\\s+)tag: (?<currentValue>[^@].*?)\\n\\s+digest: (?<currentDigest>sha256:[a-f0-9]+)"],
      "datasourceTemplate": "docker",
-     "autoReplaceStringTemplate": "{{depName}}\n    tag: {{newValue}}\n    digest: {{#if newDigest}}{{{newDigest}}}{{else}}{{{currentDigest}}}{{/if}}"
+     "autoReplaceStringTemplate": "{{depName}}\n{{indentation}}tag: {{newValue}}\n{{indentation}}digest: {{#if newDigest}}{{{newDigest}}}{{else}}{{{currentDigest}}}{{/if}}"
    }
The `matchStrings` pattern matches non-compliant strings (https://regex101.com/r/G43cMf/1). I suggest the following changes to the configuration to: - fix the non-compliant matches (https://regex101.com/r/GIFmH1/1) - have dynamic indentation ([Renovate documentation](https://docs.renovatebot.com/templates/#other-available-fields:~:text=has%20release%20notes-,indentation,-%3A%20The%20indentation%20of)) ```diff { "description": "Apply an explicit gitea digest field match", "fileMatch": ["values\\.ya?ml"], - "matchStrings": ["(?<depName>gitea\\/gitea)\\n.*?tag: (?<currentValue>[^@].*?)\\n.*?digest: (?<currentDigest>sha256:[a-f0-9]+)"], + "matchStrings": ["(?<depName>gitea\\/gitea)\\n(?<indentation>\\s+)tag: (?<currentValue>[^@].*?)\\n\\s+digest: (?<currentDigest>sha256:[a-f0-9]+)"], "datasourceTemplate": "docker", - "autoReplaceStringTemplate": "{{depName}}\n tag: {{newValue}}\n digest: {{#if newDigest}}{{{newDigest}}}{{else}}{{{currentDigest}}}{{/if}}" + "autoReplaceStringTemplate": "{{depName}}\n{{indentation}}tag: {{newValue}}\n{{indentation}}digest: {{#if newDigest}}{{{newDigest}}}{{else}}{{{currentDigest}}}{{/if}}" } ```
justusbunsi (Migrated from gitea.com) commented 2023-09-25 09:40:20 +00:00

Nice solution with the indentation.

Nice solution with the `indentation`.
pat-s (Migrated from gitea.com) reviewed 2023-09-25 09:54:13 +00:00
justusbunsi (Migrated from gitea.com) reviewed 2023-09-25 09:54:18 +00:00
techknowlogick commented 2023-09-27 02:13:13 +00:00 (Migrated from gitea.com)

This looks good to me, but I'll leave it to @pat-s and @justusbunsi to give the final +1

This looks good to me, but I'll leave it to @pat-s and @justusbunsi to give the final +1
justusbunsi (Migrated from gitea.com) approved these changes 2023-09-27 04:45:42 +00:00
justusbunsi (Migrated from gitea.com) left a comment

LGTM. Thanks @mmalyska.

LGTM. Thanks @mmalyska.
pat-s (Migrated from gitea.com) approved these changes 2023-09-27 07:31:28 +00:00
pat-s commented 2023-09-27 07:31:48 +00:00 (Migrated from gitea.com)

Thanks again for contributing @mmalyska!

Thanks again for contributing @mmalyska!
Sign in to join this conversation.
No description provided.