Skip to content

Commit 52583d3

Browse files
feat(GitOpsConfig)!: release apiVersion 2
No breaking changes - just a major release with `.gitops.config.yaml` API version v2. Convert your current GitOps config with https://christiansiegel.github.io/gitopscli-config-converter/
1 parent b74e56d commit 52583d3

File tree

5 files changed

+54
-5
lines changed

5 files changed

+54
-5
lines changed

docs/includes/preview-configuration.md

Lines changed: 50 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ Make sure that your *app repository* contains a `.gitops.config.yaml` file. This
2727
4. find repository and branch where the preview should be created (i.e. your *deployment config repository*)
2828

2929
```yaml
30-
apiVersion: v1
30+
apiVersion: v2
3131
applicationName: app-xy
3232
previewConfig:
3333
host: '{PREVIEW_NAMESPACE}.example.tld'
@@ -40,9 +40,10 @@ previewConfig:
4040
organisation: deployments
4141
repository: deployment-config-repo
4242
# branch: master # optional (defaults to repo's default branch)
43-
namespace: '{APPLICATION_NAME}-{PREVIEW_ID_HASH}-preview' # optional (default: '{APPLICATION_NAME}-{PREVIEW_ID}-{PREVIEW_ID_HASH}-preview',
43+
namespace: '{APPLICATION_NAME}-{PREVIEW_ID_HASH}-preview' # optional (default: '{APPLICATION_NAME}-{PREVIEW_ID}-{PREVIEW_ID_HASH_SHORT}-preview',
4444
# Invalid characters in PREVIEW_ID will be replaced. PREVIEW_ID will be
45-
# truncated if max namespace length exceeds 63 chars.)
45+
# truncated if max namespace length exceeds `maxNamespaceLength` chars.)
46+
# maxNamespaceLength: 63 # optional (default: 53)
4647
replace:
4748
Chart.yaml:
4849
- path: name
@@ -54,6 +55,52 @@ previewConfig:
5455
value: '{PREVIEW_HOST}'
5556
```
5657
58+
!!! info
59+
If you currently use the _old_ `.gitops.config.yaml` format (_v0_) you may find this [online converter](https://christiansiegel.github.io/gitopscli-config-converter/) helpful to transition to the current `apiVersion v2`.
60+
61+
!!! warning
62+
The _old_ (_v0_) version and `apiVersion v1` are marked deprecated and will be removed in `gitopscli` version 6.0.0.
63+
64+
Equivalent example:
65+
66+
```yaml
67+
# old 'v0' format
68+
deploymentConfig:
69+
org: deployments
70+
repository: deployment-config-repo
71+
applicationName: app-xy
72+
previewConfig:
73+
route:
74+
host:
75+
template: app-xy-{SHA256_8CHAR_BRANCH_HASH}.example.tld
76+
replace:
77+
- path: image.tag
78+
variable: GIT_COMMIT
79+
- path: route.host
80+
variable: ROUTE_HOST
81+
```
82+
83+
```yaml
84+
# v2 format
85+
apiVersion: v2
86+
applicationName: app-xy
87+
previewConfig:
88+
host: ${PREVIEW_NAMESPACE}.example.tld
89+
target:
90+
organisation: deployments
91+
repository: deployment-config-repo
92+
namespace: ${APPLICATION_NAME}-${PREVIEW_ID_HASH}-preview
93+
replace:
94+
Chart.yaml:
95+
- path: name
96+
value: ${PREVIEW_NAMESPACE}
97+
values.yaml:
98+
- path: image.tag
99+
value: ${GIT_HASH}
100+
- path: route.host
101+
value: ${PREVIEW_HOST}
102+
```
103+
57104
#### Variables
58105
- `APPLICATION_NAME`: value from `applicationName`
59106
- `GIT_HASH`:

gitopscli/gitops_config.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -237,7 +237,7 @@ def parse(self) -> GitOpsConfig:
237237
return self.__parse_v0()
238238
if api_version == "v1":
239239
return self.__parse_v1()
240-
if api_version == "v2_beta":
240+
if api_version == "v2":
241241
return self.__parse_v2()
242242
raise GitOpsException(f"GitOps config apiVersion '{api_version}' is not supported!")
243243

mkdocs.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ extra_css:
4747
# Extensions
4848
markdown_extensions:
4949
- markdown.extensions.attr_list
50+
- pymdownx.superfences
5051
- admonition
5152
- codehilite:
5253
guess_lang: false

requirements-dev.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ pytest==5.4.2
55
mkdocs==1.0.4
66
mkdocs-material==4.6.3
77
markdown-include==0.6.0
8+
pymdown-extensions==8.2
89
mypy==0.790
910
typeguard==2.10.0
1011
pre-commit==2.13.0

tests/test_gitops_config_v2.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@
88
class GitOpsConfigV2Test(unittest.TestCase):
99
def setUp(self):
1010
self.yaml = {
11-
"apiVersion": "v2_beta",
11+
"apiVersion": "v2",
1212
"applicationName": "my-app",
1313
"previewConfig": {
1414
"host": "my-${PREVIEW_ID}-${PREVIEW_ID_HASH}-host-template",

0 commit comments

Comments
 (0)