lennybot 1.0.25__py3-none-any.whl → 1.0.32__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
lennybot/__init__.py CHANGED
@@ -91,6 +91,6 @@ def main() -> int:
91
91
  result = app.apply(plan)
92
92
  app.ci_finalize(plan, result)
93
93
  else:
94
- logging.error("Unexpected Arguments", args)
94
+ logging.error("Unexpected Arguments: %s", args)
95
95
  return 1
96
96
  return 0
@@ -1,8 +1,9 @@
1
- from .download_resources import DownloadResourcesAction
1
+ from .download_resources import DownloadResourceAction
2
2
  from .iaction import IAction
3
3
  from .remove_checksums import RemoveChecksumsAction
4
4
  from .update_dockerfile import UpdateDockerfileAction
5
5
  from .update_image_tag import UpdateImageTagAction
6
+ from .update_json import UpdateJsonAction
6
7
  from .update_yaml import UpdateYamlAction
7
8
 
8
9
 
@@ -10,8 +11,10 @@ def create_action(name, source_version, latest_version, config) -> IAction:
10
11
  action_type = config.type
11
12
  if action_type == "image-tag-update":
12
13
  return UpdateImageTagAction(name, source_version, latest_version, config)
13
- if action_type == "download-resources":
14
- return DownloadResourcesAction(name, source_version, latest_version, config)
14
+ if action_type in ["download-resource", "download-resources"]:
15
+ return DownloadResourceAction(name, source_version, latest_version, config)
16
+ if action_type == "update-json":
17
+ return UpdateJsonAction(name, source_version, latest_version, config)
15
18
  if action_type == "update-yaml":
16
19
  return UpdateYamlAction(name, source_version, latest_version, config)
17
20
  if action_type == "update-dockerfile":
@@ -1,11 +1,14 @@
1
+ import logging
2
+
1
3
  import requests
2
4
 
3
5
  from ..config.config import LennyBotActionConfig
4
6
  from .iaction import IAction
5
7
 
6
8
 
7
- class DownloadResourcesAction(IAction):
9
+ class DownloadResourceAction(IAction):
8
10
  def __init__(self, name, source_version, target_version, config: LennyBotActionConfig) -> None:
11
+ self._log = logging.getLogger(self.__class__.__name__)
9
12
  self._name = name
10
13
  self._source_version = source_version
11
14
  self._target_version = target_version
@@ -30,8 +33,14 @@ class DownloadResourcesAction(IAction):
30
33
 
31
34
  def run(self):
32
35
  download_url = self._url.replace("{{version}}", self._target_version)
36
+ self._log.debug("Downloading resource from %s to %s", download_url, self._target_path)
33
37
  response = requests.get(download_url)
34
38
  if response.status_code != 200:
35
- raise Exception("Unable to download resources")
39
+ self._log.error(
40
+ "Unable to download resource, received status code: %d\n%s", response.status_code, response.text
41
+ )
42
+ raise Exception("Unable to download resource, received status code: " + str(response.status_code))
43
+ self._log.debug("Downloaded resources successfully")
36
44
  with open(self._target_path, "w", encoding="utf-8") as file_ptr:
37
45
  file_ptr.write(response.text)
46
+ self._log.debug("Saved resource to %s", self._target_path)
@@ -0,0 +1,48 @@
1
+ import json
2
+
3
+ from jsonpath_ng import parse
4
+
5
+ from ..config.config import LennyBotActionConfig
6
+ from .iaction import IAction
7
+
8
+
9
+ class UpdateJsonAction(IAction):
10
+ def __init__(self, name, source_version, target_version, config: LennyBotActionConfig) -> None:
11
+ self._name = name
12
+ self._source_version = source_version
13
+ self._target_version = target_version
14
+ if config.target_file is None:
15
+ raise Exception("Target file is not set for application " + name)
16
+ self._target_file = config.target_file
17
+ if config.json_path is None:
18
+ raise Exception("JSON Path is not set for application " + name)
19
+ self._json_path = parse(config.json_path)
20
+ if config.value_pattern is not None:
21
+ self._value_pattern = config.value_pattern
22
+ else:
23
+ self._value_pattern = "{{version}}"
24
+
25
+ @property
26
+ def application(self) -> str:
27
+ return self._name
28
+
29
+ @property
30
+ def source_version(self) -> str:
31
+ return self._source_version
32
+
33
+ @property
34
+ def target_version(self) -> str:
35
+ return self._target_version
36
+
37
+ def run(self):
38
+ # Read the JSON data from the file
39
+ with open(self._target_file, "r", encoding="utf-8") as file_ptr:
40
+ json_data = json.load(file_ptr)
41
+ # Update the value in the JSON data
42
+ self._json_path.update(json_data, self._create_value())
43
+ # Write the updated JSON data back to the file
44
+ with open(self._target_file, "w", encoding="utf-8") as file_ptr:
45
+ json.dump(json_data, fp=file_ptr, indent=4)
46
+
47
+ def _create_value(self):
48
+ return self._value_pattern.replace("{{version}}", self._target_version)
@@ -1,5 +1,4 @@
1
- from lennybot.config.config import LennyBotConfig
2
-
1
+ from ..config.config import LennyBotConfig
3
2
  from .docker_image_available import DockerImageAvailableCheck
4
3
  from .icheck import ICheck
5
4
 
@@ -5,7 +5,7 @@ from urllib.parse import urlencode
5
5
 
6
6
  import requests
7
7
 
8
- from ..config.config import LennyBotCheckConfig, LennyBotConfigContainerConfig, LennyBotConfigContainerRegistry
8
+ from ..config.config import LennyBotCheckConfig, LennyBotConfigContainerConfig
9
9
  from .icheck import ICheck
10
10
 
11
11
  PATTERN = r"(?:([\-\_\.\w]+)$)|(?:([\-\_\.\w]+)/([\-\_\.\w]+)$)|(?:([\-\.A-z0-9]+)/([\-\_\.\w]+)/([\-\_\.\w]+)$)|(?:([\-\.A-z0-9]+)/([\-\_\.\w]+)/([\-\_\.\w]+)/([\-\_\.\w]+)$)"
@@ -34,6 +34,7 @@ class WwwAuthenticateHeader:
34
34
 
35
35
 
36
36
  class DockerImageAvailableCheck(ICheck):
37
+ # pylint: disable=too-many-positional-arguments
37
38
  def __init__(
38
39
  self,
39
40
  application_name,
@@ -103,7 +104,11 @@ class DockerImageAvailableCheck(ICheck):
103
104
  + image_tag
104
105
  )
105
106
  return DockerImage(match.group(4), match.group(5) + "/" + match.group(6), image_tag)
106
- return DockerImage(match.group(7), match.group(8) + "/" + match.group(9) + "/" + match.group(10), image_tag)
107
+ return DockerImage(
108
+ match.group(7),
109
+ match.group(8) + "/" + match.group(9) + "/" + match.group(10),
110
+ image_tag,
111
+ )
107
112
 
108
113
  def _authenticate_on_registry(self, registry: str, authentication_header: WwwAuthenticateHeader) -> str:
109
114
  params = {
@@ -143,11 +148,19 @@ class DockerImageAvailableCheck(ICheck):
143
148
  return str(access_token)
144
149
 
145
150
  if response.status_code == 401:
146
- logging.error("Authentication failed: %d with %s", response.status_code, response.headers)
151
+ logging.error(
152
+ "Authentication failed: %d with %s",
153
+ response.status_code,
154
+ response.headers,
155
+ )
147
156
  raise Exception("Error occurred: Unauthenticated: ", response.status_code)
148
157
 
149
158
  if response.status_code == 403:
150
- logging.error("Authorization failed: %d with %s", response.status_code, response.headers)
159
+ logging.error(
160
+ "Authorization failed: %d with %s",
161
+ response.status_code,
162
+ response.headers,
163
+ )
151
164
  raise Exception("Error occurred: Unauthorization: ", response.status_code)
152
165
 
153
166
  if response.status_code == 404:
lennybot/config/config.py CHANGED
@@ -1,6 +1,6 @@
1
1
  import logging
2
2
  import os
3
- from typing import Any, Dict, List, Optional
3
+ from typing import Dict, List, Optional
4
4
 
5
5
  import yaml
6
6
 
@@ -26,7 +26,13 @@ CONFIGURATION_OPTIONS = {
26
26
  },
27
27
  "logging": {
28
28
  "type": "object",
29
- "properties": {"level": {"type": "string", "required": False, "attribute": "_logging_level"}},
29
+ "properties": {
30
+ "level": {
31
+ "type": "string",
32
+ "required": False,
33
+ "attribute": "_logging_level",
34
+ }
35
+ },
30
36
  },
31
37
  "container": {
32
38
  "type": "object",
@@ -56,7 +62,12 @@ CONFIGURATION_OPTIONS = {
56
62
  "attribute": "_source",
57
63
  "properties": {
58
64
  "type": {"type": "string", "required": True, "attribute": "_type"},
59
- "repository": {"type": "string", "required": True, "attribute": "_repository"},
65
+ "repository": {
66
+ "type": "string",
67
+ "required": True,
68
+ "attribute": "_repository",
69
+ },
70
+ "ltsOnly": {"type": "bool", "required": False, "attribute": "_lts_only"},
60
71
  "regex": {"type": "string", "attribute": "_regex"},
61
72
  },
62
73
  },
@@ -82,6 +93,7 @@ CONFIGURATION_OPTIONS = {
82
93
  "target": {"type": "string", "attribute": "_target"},
83
94
  "targetFile": {"type": "string", "attribute": "_target_file"},
84
95
  "yamlPath": {"type": "string", "attribute": "_yaml_path"},
96
+ "jsonPath": {"type": "string", "attribute": "_json_path"},
85
97
  "valuePattern": {"type": "string", "attribute": "_value_pattern"},
86
98
  },
87
99
  },
@@ -95,6 +107,8 @@ class LennyBotSourceConfig:
95
107
  self._type = None
96
108
  self._repository = None
97
109
  self._regex = None
110
+ self._source_url = None
111
+ self._lts_only = None
98
112
 
99
113
  @property
100
114
  def type(self) -> str:
@@ -108,6 +122,18 @@ class LennyBotSourceConfig:
108
122
  def regex(self) -> str:
109
123
  return str(self._regex)
110
124
 
125
+ @property
126
+ def source_url(self) -> str:
127
+ return str(self._source_url)
128
+
129
+ @property
130
+ def lts_only(self) -> bool:
131
+ return bool(self._lts_only)
132
+
133
+ @lts_only.setter
134
+ def lts_only(self, value: bool) -> None:
135
+ self._lts_only = value
136
+
111
137
 
112
138
  class LennyBotCheckConfig:
113
139
  def __init__(self) -> None:
@@ -133,6 +159,7 @@ class LennyBotActionConfig:
133
159
  self._url = None
134
160
  self._target_file = None
135
161
  self._yaml_path = None
162
+ self._json_path = None
136
163
  self._value_pattern = None
137
164
 
138
165
  @property
@@ -163,6 +190,10 @@ class LennyBotActionConfig:
163
190
  def target_file(self) -> str | None:
164
191
  return self._target_file
165
192
 
193
+ @property
194
+ def json_path(self) -> str | None:
195
+ return self._json_path
196
+
166
197
  @property
167
198
  def yaml_path(self) -> str | None:
168
199
  return self._yaml_path
@@ -259,7 +290,10 @@ class LennyBotConfig:
259
290
 
260
291
  def _configure_logging(self):
261
292
  logging_level = logging._nameToLevel.get(self._logging_level, logging.DEBUG)
262
- logging.basicConfig(level=logging_level, format="%(asctime)s [%(levelname)s] %(name)s: %(message)s")
293
+ logging.basicConfig(
294
+ level=logging_level,
295
+ format="%(asctime)s [%(levelname)s] %(name)s: %(message)s",
296
+ )
263
297
  self._log = logging.getLogger(self.__class__.__name__)
264
298
  self._log.debug("Logging was configured")
265
299
 
@@ -4,5 +4,5 @@ def semver_2_vc(version):
4
4
  parts = version.split(".")
5
5
  version_code = 0
6
6
  for part in parts:
7
- version_code = version_code * 100 + int(part)
7
+ version_code = version_code * 1000 + int(part)
8
8
  return version_code
lennybot/lennybot.py CHANGED
@@ -47,7 +47,7 @@ class LennyBot:
47
47
  pickle.dump(plan, file_ptr)
48
48
 
49
49
  def ci_setup(self):
50
- self._log.debug(f"Setup CI")
50
+ self._log.debug("Setup CI")
51
51
  now = datetime.now().strftime("%Y%m%d%H%M%S")
52
52
  self._branch_name = f"{self._config.github_pr.branch_prefix}"
53
53
  if not self._branch_name.endswith("-"):
@@ -58,14 +58,14 @@ class LennyBot:
58
58
  if result != 0:
59
59
  self._log.error("Unexpected return code from git config")
60
60
  self._repo = Repo("./", odbt=GitDB) # type: ignore
61
- self._log.debug(f"Initialized repository")
61
+ self._log.debug("Initialized repository")
62
62
  head = self._repo.create_head(self._branch_name)
63
- self._log.debug(f"Created Head")
63
+ self._log.debug("Created Head")
64
64
  head.checkout()
65
65
  self._log.info(f"Working branch is {self._branch_name}")
66
66
 
67
67
  def ci_finalize(self, plan: LennyBotPlan, result):
68
- self._log.debug(f"Finalize CI")
68
+ self._log.debug("Finalize CI")
69
69
  if self._repo is None:
70
70
  raise Exception("Repository is non, ci_setup was not called")
71
71
  if not self._repo.index.diff(None) and not self._repo.untracked_files:
lennybot/model/plan.py CHANGED
@@ -1,4 +1,4 @@
1
- from typing import Any, List
1
+ from typing import List
2
2
 
3
3
  from ..actions.iaction import IAction
4
4
  from ..model.state import LennyBotState
lennybot/service/apply.py CHANGED
@@ -1,5 +1,4 @@
1
1
  import logging
2
- from typing import List
3
2
 
4
3
  from ..model.plan import LennyBotPlan
5
4
 
@@ -34,7 +34,9 @@ class GitHubService:
34
34
  if self._github is None:
35
35
  raise Exception("GitHub is not configured")
36
36
  repo = self._github.get_repo(self._config.github_pr.repository)
37
- new_pull = repo.create_pull(repo.default_branch, branch_name, title=title, body=body)
37
+ new_pull = repo.create_pull(
38
+ repo.default_branch, branch_name, title=title, body=body
39
+ ) # pyright: ignore [reportCallIssue]
38
40
  labels = self._get_or_create_labels(repo)
39
41
  new_pull.add_to_labels(*labels)
40
42
  pulls = self._find_own_pulls()
lennybot/service/plan.py CHANGED
@@ -1,9 +1,8 @@
1
1
  import logging
2
2
  from typing import List
3
3
 
4
- from lennybot.check import create_check
5
-
6
4
  from ..actions import IAction, create_action
5
+ from ..check import create_check
7
6
  from ..config import LennyBotAppConfig, LennyBotConfig
8
7
  from ..helper import semver_2_vc
9
8
  from ..model import LennyBotPlan, LennyBotState
@@ -31,7 +30,13 @@ class LennyBotApplication:
31
30
  self._current_version = state.current_version(self._name)
32
31
  self._latest_version = self._source.latest_version()
33
32
  for config in self._config._checks:
34
- check = create_check(self.name, self._current_version, self._latest_version, config, self._global_config)
33
+ check = create_check(
34
+ self.name,
35
+ self._current_version,
36
+ self._latest_version,
37
+ config,
38
+ self._global_config,
39
+ )
35
40
  self._checks.append(check)
36
41
 
37
42
  def should_update(self) -> bool:
@@ -47,7 +52,13 @@ class LennyBotApplication:
47
52
 
48
53
  for check in self._checks:
49
54
  if not check.check():
50
- self._log.warning("Check '%s' failed for application '%s'", check.__class__.__name__, self.name)
55
+ self._log.warning(
56
+ "Check '%s' failed for application '%s' with current version '%s' and latest version '%s'",
57
+ check.__class__.__name__,
58
+ self.name,
59
+ self._current_version,
60
+ self._latest_version,
61
+ )
51
62
  return False
52
63
  return True
53
64
 
@@ -2,6 +2,7 @@ from ...config import LennyBotSourceConfig
2
2
  from .isource import ISource
3
3
  from .source_github import GithubSource
4
4
  from .source_github_query import GithubQuerySource
5
+ from .source_nodejs import NodeJSVersionSource
5
6
 
6
7
 
7
8
  def create_source(name, config: LennyBotSourceConfig, github) -> ISource:
@@ -10,4 +11,6 @@ def create_source(name, config: LennyBotSourceConfig, github) -> ISource:
10
11
  return GithubSource(name, config, github)
11
12
  if source_type == "github-query":
12
13
  return GithubQuerySource(name, config, github)
14
+ if source_type == "nodejs-version":
15
+ return NodeJSVersionSource(name, config)
13
16
  raise Exception(f"Unknown Source Type: {source_type}")
@@ -1,7 +1,5 @@
1
1
  import re
2
2
 
3
- import requests
4
-
5
3
  from ...config import LennyBotSourceConfig
6
4
  from ..github import GitHubService
7
5
  from .isource import ISource
@@ -0,0 +1,57 @@
1
+ from typing import Any
2
+
3
+ import requests
4
+
5
+ from ...config import LennyBotSourceConfig
6
+ from .isource import ISource
7
+
8
+ NODEJS_ORG_VERSIONS_URL = "https://nodejs.org/dist/index.json"
9
+
10
+
11
+ class NodeJSVersionNotFoundException(Exception):
12
+ def __init__(self, data: Any, *args: object) -> None:
13
+ super().__init__(*args)
14
+ self._data = data
15
+
16
+
17
+ class NodeJSFormatException(Exception):
18
+ def __init__(self, *args: object) -> None:
19
+ super().__init__(*args)
20
+
21
+
22
+ class NodeJSVersionSource(ISource):
23
+ def __init__(self, name, config: LennyBotSourceConfig) -> None:
24
+ self._name = name
25
+ self._lts_only = config.lts_only
26
+ self._source_url = config.source_url
27
+
28
+ @property
29
+ def application(self) -> str:
30
+ return self._name
31
+
32
+ def latest_version(self) -> str:
33
+ headers = {"user-agent": "lennybot/0.0.1"}
34
+ response = requests.get(NODEJS_ORG_VERSIONS_URL, headers=headers)
35
+ response.raise_for_status()
36
+
37
+ releases = response.json()
38
+ sorted(releases, key=lambda x: x["version"])
39
+ for release in releases:
40
+ if not self._lts_only:
41
+ return self._extract_semver_version(release)
42
+ if release["lts"]:
43
+ return self._extract_semver_version(release)
44
+
45
+ raise NodeJSVersionNotFoundException(releases)
46
+
47
+ def _extract_semver_version(self, release) -> str:
48
+ if "version" not in release.keys():
49
+ raise NodeJSFormatException("Missing version field in release")
50
+ version = release["version"]
51
+
52
+ if not version.startswith("v"):
53
+ raise NodeJSFormatException("Invalid version format")
54
+
55
+ version = version.replace("v", "")
56
+
57
+ return version
@@ -31,7 +31,13 @@ The lennybot allows to define multiple applications.
31
31
  Each application has to have a version source, which can be queried to determine the latest version.
32
32
  If a newer version is available, the lennybot executes multiple pre defined actions per application.
33
33
  E.g. Update Docker Image Tags.
34
- The applications, sources and actions can be configured in the `config.yml` file.
34
+ Sometimes there are conditions which need to be fulfilled before the action can be executed.
35
+ These conditions can be specified as checks.
36
+ E.g. Check if the docker image is available in the registry, because sometimes a new version of an applications gets released, but the docker image is not available yet.
37
+
38
+ ![A graph showing the process of updating applications by the lennybot](./docs/LennyBot-Execution.drawio.png)
39
+
40
+ The applications, sources, checks and actions can be configured in the `config.yml` file.
35
41
  For more information see below.
36
42
 
37
43
  ## Configuration
@@ -52,19 +58,16 @@ Each section represents a configuration object.
52
58
 
53
59
  | Path | Description |
54
60
  |--------------------------------------------|------------------------------------------------------------------------|
55
- | state.file | The state file which is used to store the version of each application |
56
61
  | state.pr.enabled | Toggle PR creation in CI mode. Has to be either true or false |
57
62
  | state.pr.repository | The name of the repository in github on which the PR should be created |
58
63
  | state.pr.branchPrefix | Prefix for the branch name which should be used to create the PRs |
59
64
 
60
65
  ### Applications
61
66
 
62
- | Path | Description |
67
+ | Property | Description |
63
68
  |--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
64
69
  | applications[*].name | The name of the application which should be updated |
65
- | applications[*].source.type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
66
- | applications[*].source.repository | The GitHub Repository which should be used to determine the latest version |
67
- | applications[*].source.regex | The regex pattern which is used to extract the semver version code from the tag value |
70
+ | applications[*].source | The configuration for the source of the latest version. This is specific to the type of source, see below for the diffrent source types. |
68
71
  | applications[\*].actions[\*].type | The action has to be one of these types "image-tag-update", "download-resources" or "update-yaml". See below for details. |
69
72
  | applications[\*].actions[\*].url | |
70
73
  | applications[\*].actions[\*].target | |
@@ -75,21 +78,61 @@ Each section represents a configuration object.
75
78
  | applications[\*].actions[\*].yamlPath | |
76
79
  | applications[\*].actions[\*].valuePattern | |
77
80
 
81
+ ### Sources
82
+
78
83
  #### GitHub Source
84
+
79
85
  <TODO>
80
86
 
87
+ | Property | Description |
88
+ |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
89
+ | .type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
90
+ | .repository | The GitHub Repository which should be used to determine the latest version |
91
+ | .regex | The regex pattern which is used to extract the semver version code from the tag value |
92
+
93
+
81
94
  #### GitHub Query Source
95
+
96
+ <TODO>
97
+
98
+ | Property | Description |
99
+ |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
100
+ | .type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
101
+ | .repository | The GitHub Repository which should be used to determine the latest version |
102
+ | .regex | The regex pattern which is used to extract the semver version code from the tag value |
103
+
104
+
105
+ ### Checks
106
+
82
107
  <TODO>
83
108
 
109
+
110
+ ### Actions
111
+
84
112
  #### Image Tag Update Action
85
113
  <TODO>
86
114
 
115
+ | Property | Description |
116
+ |--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
117
+ | .type | The action has to be one of these types "image-tag-update", "download-resources" or "update-yaml". See below for details. |
118
+ | .url | |
119
+ | .target | |
120
+ | .image | |
121
+ | .kustomizePath | |
122
+ | .tagPattern | |
123
+ | .targetFile | |
124
+ | .yamlPath | |
125
+ | .valuePattern | |
126
+
87
127
  #### Download Resource Action
88
128
  <TODO>
89
129
 
90
130
  #### Update YAML Action
91
131
  <TODO>
92
132
 
133
+ #### Update JSON Action
134
+ <TODO>
135
+
93
136
  #### Update Dockerfile Action
94
137
  <TODO>
95
138
 
@@ -2,4 +2,5 @@ pyyaml
2
2
  yamlpath
3
3
  requests
4
4
  GitPython
5
- PyGithub
5
+ PyGithub
6
+ jsonpath-ng
@@ -0,0 +1 @@
1
+ 1.0.32
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.1
2
2
  Name: lennybot
3
- Version: 1.0.25
3
+ Version: 1.0.32
4
4
  Summary: Automatic Updates for Kustomize Resources
5
5
  Home-page: http://github.com/raynigon/lennybot
6
6
  Author: Simon Schneider
@@ -23,6 +23,7 @@ Requires-Dist: yamlpath
23
23
  Requires-Dist: requests
24
24
  Requires-Dist: GitPython
25
25
  Requires-Dist: PyGithub
26
+ Requires-Dist: jsonpath-ng
26
27
  Provides-Extra: dev
27
28
  Requires-Dist: setuptools ; extra == 'dev'
28
29
  Requires-Dist: wheel ; extra == 'dev'
@@ -64,7 +65,13 @@ The lennybot allows to define multiple applications.
64
65
  Each application has to have a version source, which can be queried to determine the latest version.
65
66
  If a newer version is available, the lennybot executes multiple pre defined actions per application.
66
67
  E.g. Update Docker Image Tags.
67
- The applications, sources and actions can be configured in the `config.yml` file.
68
+ Sometimes there are conditions which need to be fulfilled before the action can be executed.
69
+ These conditions can be specified as checks.
70
+ E.g. Check if the docker image is available in the registry, because sometimes a new version of an applications gets released, but the docker image is not available yet.
71
+
72
+ ![A graph showing the process of updating applications by the lennybot](./docs/LennyBot-Execution.drawio.png)
73
+
74
+ The applications, sources, checks and actions can be configured in the `config.yml` file.
68
75
  For more information see below.
69
76
 
70
77
  ## Configuration
@@ -85,19 +92,16 @@ Each section represents a configuration object.
85
92
 
86
93
  | Path | Description |
87
94
  |--------------------------------------------|------------------------------------------------------------------------|
88
- | state.file | The state file which is used to store the version of each application |
89
95
  | state.pr.enabled | Toggle PR creation in CI mode. Has to be either true or false |
90
96
  | state.pr.repository | The name of the repository in github on which the PR should be created |
91
97
  | state.pr.branchPrefix | Prefix for the branch name which should be used to create the PRs |
92
98
 
93
99
  ### Applications
94
100
 
95
- | Path | Description |
101
+ | Property | Description |
96
102
  |--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
97
103
  | applications[*].name | The name of the application which should be updated |
98
- | applications[*].source.type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
99
- | applications[*].source.repository | The GitHub Repository which should be used to determine the latest version |
100
- | applications[*].source.regex | The regex pattern which is used to extract the semver version code from the tag value |
104
+ | applications[*].source | The configuration for the source of the latest version. This is specific to the type of source, see below for the diffrent source types. |
101
105
  | applications[\*].actions[\*].type | The action has to be one of these types "image-tag-update", "download-resources" or "update-yaml". See below for details. |
102
106
  | applications[\*].actions[\*].url | |
103
107
  | applications[\*].actions[\*].target | |
@@ -108,21 +112,61 @@ Each section represents a configuration object.
108
112
  | applications[\*].actions[\*].yamlPath | |
109
113
  | applications[\*].actions[\*].valuePattern | |
110
114
 
115
+ ### Sources
116
+
111
117
  #### GitHub Source
118
+
112
119
  <TODO>
113
120
 
121
+ | Property | Description |
122
+ |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
123
+ | .type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
124
+ | .repository | The GitHub Repository which should be used to determine the latest version |
125
+ | .regex | The regex pattern which is used to extract the semver version code from the tag value |
126
+
127
+
114
128
  #### GitHub Query Source
129
+
130
+ <TODO>
131
+
132
+ | Property | Description |
133
+ |----------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
134
+ | .type | The source has to be either of the type "github" or of the type "github-query". See below for details. |
135
+ | .repository | The GitHub Repository which should be used to determine the latest version |
136
+ | .regex | The regex pattern which is used to extract the semver version code from the tag value |
137
+
138
+
139
+ ### Checks
140
+
115
141
  <TODO>
116
142
 
143
+
144
+ ### Actions
145
+
117
146
  #### Image Tag Update Action
118
147
  <TODO>
119
148
 
149
+ | Property | Description |
150
+ |--------------------------------------------|--------------------------------------------------------------------------------------------------------------------------------------------|
151
+ | .type | The action has to be one of these types "image-tag-update", "download-resources" or "update-yaml". See below for details. |
152
+ | .url | |
153
+ | .target | |
154
+ | .image | |
155
+ | .kustomizePath | |
156
+ | .tagPattern | |
157
+ | .targetFile | |
158
+ | .yamlPath | |
159
+ | .valuePattern | |
160
+
120
161
  #### Download Resource Action
121
162
  <TODO>
122
163
 
123
164
  #### Update YAML Action
124
165
  <TODO>
125
166
 
167
+ #### Update JSON Action
168
+ <TODO>
169
+
126
170
  #### Update Dockerfile Action
127
171
  <TODO>
128
172
 
@@ -0,0 +1,38 @@
1
+ lennybot/__init__.py,sha256=X5rwD93YiHnGhTfYKMx1r160P-wZAf2zVwYnPCP_YCg,2700
2
+ lennybot/__main__.py,sha256=iPpiz09xKqtAjrhONS99OYp6R2dQ6Anbhw1qPIN8ELo,80
3
+ lennybot/lennybot.py,sha256=oCVbCYqHOHuYq-ecN_p_0sWuBro0h0xyQ9oWBLctRNw,3786
4
+ lennybot/actions/__init__.py,sha256=3nR2DlivXdylqdTsccL9yvkHKqo0FO5JyczGvvKTXWI,1249
5
+ lennybot/actions/download_resources.py,sha256=uEpde1tz2IRjpN01CCZRPYVLcF9NaTjenpKF2ZBOMws,1768
6
+ lennybot/actions/iaction.py,sha256=KR2IkxSNYQc_bKsiKuJjxPr5VTj6dUfB7P1V_uA4yVI,428
7
+ lennybot/actions/remove_checksums.py,sha256=3GMo_6vDdeBYTG5AYlYHB0iEiqa9tMD4PfIOxOXZ3cE,1797
8
+ lennybot/actions/update_dockerfile.py,sha256=zkQEmKaIWpECmIwb27moonLJ_7Jr-BBnc6LMrGWo6Rk,1699
9
+ lennybot/actions/update_image_tag.py,sha256=1XQ40Ls47qDNDair2qyuRWtRYzSNV5tkHGC_yPKY40E,1689
10
+ lennybot/actions/update_json.py,sha256=vnfHC3gNo0-g0H7ssU8h69_Uqk_zB3o4GxO8ZAM8hJs,1697
11
+ lennybot/actions/update_yaml.py,sha256=o7qywAVvDgLcBCYCL4MirmYKduELNemkil7TLxon-BY,1919
12
+ lennybot/check/__init__.py,sha256=-lyJziRPmxBd7_OWBFwlzmp9x56CVryC_GkRPFuNYGY,485
13
+ lennybot/check/docker_image_available.py,sha256=ynrJkFoTTmvOjdNsAWMUpVqWuGygWb0tb2HAC2GWHro,8416
14
+ lennybot/check/icheck.py,sha256=sCMy1y_rrjVNrKh4vAiHH2QpiZIaUWaF06qkGnyC-N8,500
15
+ lennybot/config/__init__.py,sha256=L85iDCHQJ1zH6U3s8XJuY3bzpj_r8ZOLm_djv84pG-U,119
16
+ lennybot/config/config.py,sha256=WlT2eGY3-1aSIWHtWzZwnmF0JbaJN0VOCwITLqIhTik,12237
17
+ lennybot/helper/__init__.py,sha256=u_-EsBGjsXi5qXxEtFlMsRkh2ocxH17w3RfPH2j2QWU,221
18
+ lennybot/model/__init__.py,sha256=e_P6FXQooilrRoSKFdewkEUWL8x6k_45lH97yxL1rks,64
19
+ lennybot/model/plan.py,sha256=yCJt4Kr1bVFFXZQyK55iDoxhjiqhORRDX4kPLe8dKbw,1091
20
+ lennybot/model/state.py,sha256=UK9ALA3O5tGYQW5WCxQpybHeXrrwrQMgtvoZ4W_N9ok,1453
21
+ lennybot/service/__init__.py,sha256=jU103QJj6LHYY6-R7wYEdu1oiwRT0FfwLG4wgZYbMAo,96
22
+ lennybot/service/apply.py,sha256=8XdbyU4oMBobaPlrplGiyS6wPJoeqQsPmQsICqYM0N0,671
23
+ lennybot/service/github.py,sha256=6BHQiu30aRVKPe6Rc6O2ZWMPAvZTRW7rJZw_f9AhGLE,2973
24
+ lennybot/service/plan.py,sha256=rzEKoT9q4DMS9ic6ECS6xAhaSQNrEXKF_Ui373LSfYI,3434
25
+ lennybot/service/source/__init__.py,sha256=h7idvlw1BfeyBawAEDslnfgjIFHLhDWjcVKBJ9E13IY,639
26
+ lennybot/service/source/isource.py,sha256=s7T95siVMyKvCX2Ta4O7Jarc5BFAoYWfN74ocyLQiRM,253
27
+ lennybot/service/source/source_github.py,sha256=MMkg0bJZMWOTv6pr3tf5iLg7HnSe7lSc3iXWtrR8lXo,1056
28
+ lennybot/service/source/source_github_query.py,sha256=Dn764TBPw6PABhNa_A1JIGCfLoBhcvmScEBHHmCbEbI,1072
29
+ lennybot/service/source/source_nodejs.py,sha256=-N86ymk4LjtgBEI42SOe0WGCQvB4I8r9rhGtY0gmPnw,1711
30
+ lennybot-1.0.32.data/data/generic/README.md,sha256=80AiUnPW9CnHB3Iwa8qGggGQl2XXUe5tVNtAny-_1nk,9831
31
+ lennybot-1.0.32.data/data/generic/requirements.txt,sha256=ehp2P57fAPHl3tX8r5t3vyyPmW6tflMIKBBB0vKpvws,55
32
+ lennybot-1.0.32.data/data/generic/version.txt,sha256=lJlaFE-y4dFjsYr6jbTGb5uzUQ_dp_LO5e9G4R2TeMk,6
33
+ lennybot-1.0.32.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
34
+ lennybot-1.0.32.dist-info/METADATA,sha256=BtdWYvsMqcwag1DmyROAcKzV_tyf-Atih4VreGbQiys,11017
35
+ lennybot-1.0.32.dist-info/WHEEL,sha256=P9jw-gEje8ByB7_hXoICnHtVCrEwMQh-630tKvQWehc,91
36
+ lennybot-1.0.32.dist-info/entry_points.txt,sha256=TOjzBcHTJaiBU2arbNIMVr7_clYPAYjBZf5WqiZ8Uhw,43
37
+ lennybot-1.0.32.dist-info/top_level.txt,sha256=Hrq9FY_KliVyEMH7LEA9rhCumLFTpKOHdSaZqzfHxhw,9
38
+ lennybot-1.0.32.dist-info/RECORD,,
@@ -1,5 +1,5 @@
1
1
  Wheel-Version: 1.0
2
- Generator: bdist_wheel (0.43.0)
2
+ Generator: setuptools (75.3.0)
3
3
  Root-Is-Purelib: true
4
4
  Tag: py3-none-any
5
5
 
@@ -1 +0,0 @@
1
- 1.0.25
@@ -1,36 +0,0 @@
1
- lennybot/__init__.py,sha256=xlswzbdsh3hj2f3UxHKUW7sZhQkS_7ONEtUIV9QJEy8,2696
2
- lennybot/__main__.py,sha256=iPpiz09xKqtAjrhONS99OYp6R2dQ6Anbhw1qPIN8ELo,80
3
- lennybot/lennybot.py,sha256=6Sm1cvzDkopeqtNEf1RsB-i9CttB94oj4UneZEm3oD4,3790
4
- lennybot/actions/__init__.py,sha256=uXIFOBIrTgVF5wIqHIgEgs9l9JrU5gzjdRUQWKsZpGI,1071
5
- lennybot/actions/download_resources.py,sha256=tdoidM07SWKRhr3f7yFL7NPtmBS7eDiQvmcIjdCr190,1260
6
- lennybot/actions/iaction.py,sha256=KR2IkxSNYQc_bKsiKuJjxPr5VTj6dUfB7P1V_uA4yVI,428
7
- lennybot/actions/remove_checksums.py,sha256=3GMo_6vDdeBYTG5AYlYHB0iEiqa9tMD4PfIOxOXZ3cE,1797
8
- lennybot/actions/update_dockerfile.py,sha256=zkQEmKaIWpECmIwb27moonLJ_7Jr-BBnc6LMrGWo6Rk,1699
9
- lennybot/actions/update_image_tag.py,sha256=1XQ40Ls47qDNDair2qyuRWtRYzSNV5tkHGC_yPKY40E,1689
10
- lennybot/actions/update_yaml.py,sha256=o7qywAVvDgLcBCYCL4MirmYKduELNemkil7TLxon-BY,1919
11
- lennybot/check/__init__.py,sha256=I5Q6bb2zeOX9TDTczsnnFUlQbV5Us5l18LybbNPxhXw,493
12
- lennybot/check/docker_image_available.py,sha256=LdVyfS-vVmD0FDrvHZNF8qIwkGZRFX3eJrBBxMKujmQ,8224
13
- lennybot/check/icheck.py,sha256=sCMy1y_rrjVNrKh4vAiHH2QpiZIaUWaF06qkGnyC-N8,500
14
- lennybot/config/__init__.py,sha256=L85iDCHQJ1zH6U3s8XJuY3bzpj_r8ZOLm_djv84pG-U,119
15
- lennybot/config/config.py,sha256=Z-D_YML-Go3MmcZGN8ij6vdTSPGTNgwCYcK0esGJcLw,11410
16
- lennybot/helper/__init__.py,sha256=UxQeNPPeaZm26vc0JPPBhOfXbT1QZysLP_3HLZq8QPs,220
17
- lennybot/model/__init__.py,sha256=e_P6FXQooilrRoSKFdewkEUWL8x6k_45lH97yxL1rks,64
18
- lennybot/model/plan.py,sha256=KwITeVucCSxjM_SyetyUtGSw8hCXfZqO4yrY-330ba4,1096
19
- lennybot/model/state.py,sha256=UK9ALA3O5tGYQW5WCxQpybHeXrrwrQMgtvoZ4W_N9ok,1453
20
- lennybot/service/__init__.py,sha256=jU103QJj6LHYY6-R7wYEdu1oiwRT0FfwLG4wgZYbMAo,96
21
- lennybot/service/apply.py,sha256=P-Nkp5zsGRIEt7vkYkNJ_QuBgoN463XvABd5mRUDM0o,695
22
- lennybot/service/github.py,sha256=bWBUq02_dgDMVXpU9h28-teylNuTf4Ae28EHJ3kByxs,2914
23
- lennybot/service/plan.py,sha256=x8pzbeK9veaxLox9DoGtLRaUM5O97oMEjz9qkY3iTIM,3133
24
- lennybot/service/source/__init__.py,sha256=MX1dINBfsTIv7TDVbX-qbqiMsZN8XM6I4lhudcPnYlM,503
25
- lennybot/service/source/isource.py,sha256=s7T95siVMyKvCX2Ta4O7Jarc5BFAoYWfN74ocyLQiRM,253
26
- lennybot/service/source/source_github.py,sha256=z3xV4nH-opDagCGTgCKDjfeGHqbd4kdpmCvk0LCm04w,1073
27
- lennybot/service/source/source_github_query.py,sha256=Dn764TBPw6PABhNa_A1JIGCfLoBhcvmScEBHHmCbEbI,1072
28
- lennybot-1.0.25.data/data/generic/README.md,sha256=uNfqoDP3AAZD3AD01JlQ4xje60Se1DgxSFhfJvWHbT0,6228
29
- lennybot-1.0.25.data/data/generic/requirements.txt,sha256=YChJFa4_Okg8UWzn6EPKeMl5gISIZ_k_9sgZSSLycXY,43
30
- lennybot-1.0.25.data/data/generic/version.txt,sha256=g68-alC5ZPPI3XsrxUra7Vi69ztfWGBJHODg-kMqXc4,6
31
- lennybot-1.0.25.dist-info/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
32
- lennybot-1.0.25.dist-info/METADATA,sha256=CVgyyGyqhMPMWR7jL969CzTnZNKqrfqc4Kg6fi9D1ZY,7387
33
- lennybot-1.0.25.dist-info/WHEEL,sha256=GJ7t_kWBFywbagK5eo9IoUwLW6oyOeTKmQ-9iHFVNxQ,92
34
- lennybot-1.0.25.dist-info/entry_points.txt,sha256=TOjzBcHTJaiBU2arbNIMVr7_clYPAYjBZf5WqiZ8Uhw,43
35
- lennybot-1.0.25.dist-info/top_level.txt,sha256=Hrq9FY_KliVyEMH7LEA9rhCumLFTpKOHdSaZqzfHxhw,9
36
- lennybot-1.0.25.dist-info/RECORD,,