c2cciutils 1.8.0.dev64__tar.gz → 1.9.0.dev29__tar.gz

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.
Files changed (42) hide show
  1. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/LICENSE +1 -1
  2. c2cciutils-1.8.0.dev64/README.md → c2cciutils-1.9.0.dev29/PKG-INFO +29 -203
  3. c2cciutils-1.9.0.dev29/README.md +219 -0
  4. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/__init__.py +28 -212
  5. c2cciutils-1.9.0.dev29/c2cciutils/applications-versions.yaml +2 -0
  6. c2cciutils-1.9.0.dev29/c2cciutils/configuration.py +210 -0
  7. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/env.py +9 -6
  8. c2cciutils-1.9.0.dev29/c2cciutils/schema.json +102 -0
  9. c2cciutils-1.9.0.dev29/c2cciutils/scripts/__init__.py +3 -0
  10. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/docker_logs.py +17 -13
  11. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/env.py +1 -0
  12. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/k8s/__init__.py +2 -0
  13. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/k8s/db.py +16 -15
  14. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/k8s/install.py +6 -3
  15. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/k8s/logs.py +13 -12
  16. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/k8s/wait.py +16 -12
  17. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/scripts/main.py +3 -3
  18. c2cciutils-1.9.0.dev29/pyproject.toml +111 -0
  19. c2cciutils-1.8.0.dev64/PKG-INFO +0 -467
  20. c2cciutils-1.8.0.dev64/c2cciutils/applications-versions.yaml +0 -4
  21. c2cciutils-1.8.0.dev64/c2cciutils/applications.yaml +0 -22
  22. c2cciutils-1.8.0.dev64/c2cciutils/applications_definition.py +0 -51
  23. c2cciutils-1.8.0.dev64/c2cciutils/configuration.py +0 -803
  24. c2cciutils-1.8.0.dev64/c2cciutils/lib/docker.py +0 -141
  25. c2cciutils-1.8.0.dev64/c2cciutils/lib/oidc.py +0 -188
  26. c2cciutils-1.8.0.dev64/c2cciutils/package-lock.json +0 -370
  27. c2cciutils-1.8.0.dev64/c2cciutils/package.json +0 -9
  28. c2cciutils-1.8.0.dev64/c2cciutils/publish.py +0 -451
  29. c2cciutils-1.8.0.dev64/c2cciutils/schema-applications.json +0 -50
  30. c2cciutils-1.8.0.dev64/c2cciutils/schema.json +0 -417
  31. c2cciutils-1.8.0.dev64/c2cciutils/scripts/__init__.py +0 -1
  32. c2cciutils-1.8.0.dev64/c2cciutils/scripts/clean.py +0 -103
  33. c2cciutils-1.8.0.dev64/c2cciutils/scripts/docker_versions_gen.py +0 -33
  34. c2cciutils-1.8.0.dev64/c2cciutils/scripts/download_applications.py +0 -108
  35. c2cciutils-1.8.0.dev64/c2cciutils/scripts/pin_pipenv.py +0 -54
  36. c2cciutils-1.8.0.dev64/c2cciutils/scripts/publish.py +0 -477
  37. c2cciutils-1.8.0.dev64/c2cciutils/scripts/trigger_image_update.py +0 -84
  38. c2cciutils-1.8.0.dev64/c2cciutils/scripts/version.py +0 -245
  39. c2cciutils-1.8.0.dev64/pyproject.toml +0 -124
  40. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/branches.graphql +0 -0
  41. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/commits.graphql +0 -0
  42. {c2cciutils-1.8.0.dev64 → c2cciutils-1.9.0.dev29}/c2cciutils/default_branch.graphql +0 -0
@@ -1,4 +1,4 @@
1
- Copyright (c) 2020-2025, Camptocamp SA
1
+ Copyright (c) 2020-2026, Camptocamp SA
2
2
  All rights reserved.
3
3
 
4
4
  Redistribution and use in source and binary forms, with or without
@@ -1,3 +1,31 @@
1
+ Metadata-Version: 2.4
2
+ Name: c2cciutils
3
+ Version: 1.9.0.dev29
4
+ Summary: Common utilities for Camptocamp CI
5
+ License: FreeBSD
6
+ License-File: LICENSE
7
+ Keywords: ci
8
+ Author: Camptocamp
9
+ Author-email: info@camptocamp.com
10
+ Requires-Python: >=3.11
11
+ Classifier: Development Status :: 5 - Production/Stable
12
+ Classifier: Environment :: Console
13
+ Classifier: Intended Audience :: Developers
14
+ Classifier: Operating System :: OS Independent
15
+ Classifier: Programming Language :: Python
16
+ Classifier: Programming Language :: Python :: 3
17
+ Classifier: Programming Language :: Python :: 3.11
18
+ Classifier: Programming Language :: Python :: 3.12
19
+ Classifier: Programming Language :: Python :: 3.13
20
+ Classifier: Typing :: Typed
21
+ Requires-Dist: PyYAML (>=6,<7)
22
+ Requires-Dist: applications-download (>=1,<2)
23
+ Requires-Dist: requests (>=2,<3)
24
+ Requires-Dist: ruamel.yaml (>=0,<1)
25
+ Project-URL: Bug Tracker, https://github.com/camptocamp/c2cciutils/issues
26
+ Project-URL: Repository, https://github.com/camptocamp/c2cciutils
27
+ Description-Content-Type: text/markdown
28
+
1
29
  # C2C CI utils
2
30
 
3
31
  ## Publishing
@@ -46,7 +74,6 @@ C2cciutils make easier to have those workflows in a project:
46
74
 
47
75
  - `auto-review.yaml`: Auto review the Renovate pull requests
48
76
  - `backport.yaml`: Trigger the backports (work with labels)
49
- - `clean.yaml`: Clean the Docker images related on a deleted feature branch
50
77
  - `main.yaml`: Main workflow especially with the c2cciutils-checks command
51
78
 
52
79
  All the provided commands used in the workflow:
@@ -54,8 +81,6 @@ All the provided commands used in the workflow:
54
81
  - `c2cciutils`: some generic tools.
55
82
  - `c2cciutils-version`: Create a new version of the project.
56
83
  - `c2cciutils-env`: Print some environment information.
57
- - `c2cciutils-publish`: Publish the project.
58
- - `c2cciutils-clean`: Delete Docker images on Docker Hub after corresponding branch have been deleted.
59
84
 
60
85
  ## Utilities
61
86
 
@@ -102,7 +127,6 @@ In the CI we need to have the following secrets::
102
127
  ## Use locally, in the projects that use c2cciutils
103
128
 
104
129
  Install it: `python3 -m pip install --user --requirement ci/requirements.txt`
105
- Dry run publish: `GITHUB_REF=... c2cciutils-publish --dry-run ...`
106
130
 
107
131
  ## Configuration
108
132
 
@@ -159,205 +183,6 @@ Select a formatter:
159
183
  - Configure Default Formatter...
160
184
  - Select the formatter
161
185
 
162
- ## Publishing
163
-
164
- ### To pypi
165
-
166
- The config is like this:
167
-
168
- ```yaml
169
- versions:
170
- # List of kinds of versions you want to publish, that can be:
171
- # rebuild (specified with --type),
172
- # version_tag, version_branch, feature_branch, feature_tag (for pull request)
173
- ```
174
-
175
- It we have a `setup.py` file, we will be in legacy mode:
176
- When publishing, the version computed from arguments or `GITHUB_REF` is put in environment variable `VERSION`, thus you should use it in `setup.py`, example:
177
-
178
- ```python
179
- VERSION = os.environ.get("VERSION", "1.0.0")
180
- ```
181
-
182
- Also we consider that we use `poetry` with [poetry-dynamic-versioning](https://pypi.org/project/poetry-dynamic-versioning/) to manage the version, and [poetry-plugin-tweak-dependencies-version](https://pypi.org/project/poetry-plugin-tweak-dependencies-version/) to manage the dependencies versions.
183
-
184
- Example of configuration:
185
-
186
- ```toml
187
- [tool.poetry-dynamic-versioning]
188
- enable = true
189
- vcs = "git"
190
- pattern = "^(?P<base>\\d+(\\.\\d+)*)"
191
- format-jinja = """
192
- {%- if env.get("VERSION_TYPE") == "version_branch" -%}
193
- {{serialize_pep440(bump_version(base, 1 if env.get("IS_MASTER") == "TRUE" else 2), dev=distance)}}
194
- {%- elif distance == 0 -%}
195
- {{serialize_pep440(base)}}
196
- {%- else -%}
197
- {{serialize_pep440(bump_version(base), dev=distance)}}
198
- {%- endif -%}
199
- """
200
-
201
- ```
202
-
203
- Note that we can access to the environment variables `VERSION`,`VERSION_TYPE` and `IS_MASTER`.
204
-
205
- Then by default:
206
-
207
- - Tag with `1.2.3` => release `1.2.3`
208
- - Commit on feature branch just do a validation
209
- - Commit on `master` branch after the tag 1.3.0 => release `1.4.0.dev1`
210
- - Commit on `1.3` branch after the tag 1.3.0 => release `1.3.1.dev1`
211
-
212
- #### Authentication
213
-
214
- If the file `~/.pypirc` exists we consider that we ar already logged in also
215
- we will do the login with the `pypi` server with OpenID Connect (OIDC).
216
-
217
- The OIDC login is recommended because it didn't needs any additional secrets,
218
- but it need some configuration on pypi in the package,
219
- see the [GitHub Documentation](https://docs.github.com/en/actions/security-for-github-actions/security-hardening-your-deployments/configuring-openid-connect-in-pypi#adding-the-identity-provider-to-pypi).
220
-
221
- #### Integration if the package directly in a Docker image
222
-
223
- To make it working in the `Dockerfile` you should have in the `poetry` stage:
224
-
225
- ```Dockerfile
226
- ENV POETRY_DYNAMIC_VERSIONING_BYPASS=dev
227
- RUN poetry export --extras=checks --extras=publish --output=requirements.txt \
228
- && poetry export --with=dev --output=requirements-dev.txt
229
- ```
230
-
231
- And in the `run` stage
232
-
233
- ```Dockerfile
234
- ARG VERSION=dev
235
- RUN --mount=type=cache,target=/root/.cache \
236
- POETRY_DYNAMIC_VERSIONING_BYPASS=${VERSION} python3 -m pip install --disable-pip-version-check --no-deps --editable=.
237
- ```
238
-
239
- And in the `Makefile`:
240
-
241
- ```Makefile
242
- VERSION = $(strip $(shell poetry version --short))
243
-
244
- .PHONY: build
245
- build: ## Build the Docker images
246
- docker build --build-arg=VERSION=$(VERSION) --tag=$(GITHUB_REPOSITORY) .
247
- ```
248
-
249
- ### To Docker registry
250
-
251
- The config is like this:
252
-
253
- ```yaml
254
- latest: True
255
- images:
256
- - # The base name of the image we want to publish
257
- name:
258
- repository:
259
- <internal_name>:
260
- # The fqdn name of the server if not Docker hub
261
- server:
262
- # List of kinds of versions you want to publish, that can be: rebuild (specified using --type),
263
- # version_tag, version_branch, feature_branch, feature_tag (for pull request)
264
- version:
265
- # List of tags we want to publish interpreted with `format(version=version)`
266
- # e.g. if you use `{version}-lite` when you publish the version `1.2.3` the source tag
267
- # (that should be built by the application build) is `latest-lite`, and it will be published
268
- # with the tag `1.2.3-lite`.
269
- tags:
270
- # If your images are published by different jobs you can separate them in different groups
271
- # and publish them with `c2cciutils-publish --group=<group>`
272
- group:
273
- ```
274
-
275
- By default, the last line of the `SECURITY.md` file will be published (`docker`) with the tag
276
- `latest`. Set `latest` to `False` to disable it.
277
-
278
- With the `c2cciutils-clean` the images on Docker hub for `feature_branch` will be removed on branch removing.
279
-
280
- ## Download applications
281
-
282
- In case some executables or applications from GitHub releases or any other URLs are required on the CI host
283
- and are not handled by any dependency manager, we provide a set of tools to install them and manage upgrades
284
- through Renovate.
285
-
286
- Create an application file (e.-g. `applications.yaml`) with:
287
-
288
- ```yaml
289
- # yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/c2cciutils/master/c2cciutils/schema-applications.json
290
-
291
- # Application from GitHub release
292
- <organization>/<project>:
293
- get-file-name: <file name present in the release>
294
- to-file-name: <The file name you want to create in ~/.local/bin>
295
- finish-command: # The command you want to run after the file is downloaded
296
- - - chmod # To be executable (usually required)
297
- - +x
298
- - <to-file-name>
299
- - - <to-file-name> # Print the version of the application
300
- - --version
301
- # Application from GitHub release in a tar file (or tar.gz)
302
- <organization>/<project>:
303
- get-file-name: <file name present in the release>
304
- type: tar
305
- tar-file-name: <The file name available in the tar file>
306
- to-file-name: <The file name you want to create in ~/.local/bin>
307
- finish-command: [...] # The command you want to run after the file is downloaded
308
- # Application from an URL
309
- <application reference name>:
310
- url-pattern: <The URL used to download the application>
311
- to-file-name: <The file name you want to create in ~/.local/bin>
312
- finish-command: [...] # The command you want to run after the file is downloaded
313
- ```
314
-
315
- In the attributes `url-pattern`, `get-file-name` you can use the following variables:
316
-
317
- - `{version}`: The version of the application present in the version file.
318
- - `{version_quote}`: The URL encoded version.
319
- - `{short_version}`: The version without the `v` prefix.
320
-
321
- The `applications-versions.yaml` file is a map of applications and their versions.
322
-
323
- Add in your Renovate configuration:
324
-
325
- ```json5
326
- regexManagers: [
327
- {
328
- fileMatch: ['^applications-versions.yaml$'],
329
- matchStrings: [
330
- '(?<depName>[^\\s]+): (?<currentValue>[^\\s]+) # (?<datasource>[^\\s]+)',
331
- ],
332
- },
333
- ],
334
- ```
335
-
336
- Now you need to call `c2cciutils-download-applications --applications-file=applications.yaml --versions-file=applications-version.yaml`
337
- to install required applications on CI host before using them (an already installed application is installed only if needed).
338
-
339
- ## Use Renovate to trigger a new build instead of the legacy rebuild
340
-
341
- Run the command `c2cciutils-docker-versions-gen camptocamp/image[:tag]` to generate a file that is a kind of package lock of the Debian packages in the file `ci/dpkg-versions.yaml`.
342
-
343
- Add in your renovate configuration:
344
-
345
- ```javascript
346
- regexManagers: [
347
- {
348
- fileMatch: ['^ci/dpkg-versions.yaml$'],
349
- matchStrings: [" *(?<depName>[^'\\s]+): '?(?<currentValue>[^'\\s/]*[0-9][^'\\s/]*)'?"],
350
- datasourceTemplate: 'repology',
351
- versioningTemplate: 'loose',
352
- },
353
- ],
354
- ```
355
-
356
- When a new version of a Debian package will be available:
357
-
358
- - Renovate will automatically open a pull request to update the file `ci/dpkg-versions.yaml`.
359
- - And the continuous integration will build a new fresh Docker image with latest versions of all Debian packages.
360
-
361
186
  ## Kubernetes
362
187
 
363
188
  C2cciutils provide some commands for Kubernetes.
@@ -420,3 +245,4 @@ Install the pre-commit hooks:
420
245
  pip install pre-commit
421
246
  pre-commit install --allow-missing-config
422
247
  ```
248
+
@@ -0,0 +1,219 @@
1
+ # C2C CI utils
2
+
3
+ ## Publishing
4
+
5
+ The main goals of C2C CI utils is to offer the commands to publish the project,
6
+ see the [documentation](https://github.com/camptocamp/c2cciutils/wiki/Publishing).
7
+
8
+ ## Changelog
9
+
10
+ When we create a tag by default with the `changelog` workflow a release is created on GitHub, a changelog is
11
+ generated and added to the release.
12
+
13
+ ## Checks
14
+
15
+ C2C CI utils will no more provide a tool to do a check of the project, this is replaced by `pre-commit`,
16
+ a base configuration is provided in the example project.
17
+
18
+ ## Pull request checks
19
+
20
+ A workflow is provided to run the checks on the pull requests, it will run the `c2cciutils-pr-checks` command.
21
+
22
+ - Check that the commit message and the pull request title start with a capital letter.
23
+ - Check that there aren't any spelling issue in the commit message and in the pull request title.
24
+ - Add a message to the pull request with a link to the JIRA issue if the pull request branch name starts with
25
+ `[a-zA-Z]+-[0-9]+-` or end with `-[a-zA-Z]+-[0-9]+`.
26
+
27
+ ## Dependencies
28
+
29
+ In the example project there is a basic Renovate configuration, it will update the dependencies of the project.
30
+ There is also a workflow to add a review on the Renovate pull requests to make the auto merge working on
31
+ repository that required a review.
32
+
33
+ ## Backports
34
+
35
+ A workflow is provided to backport the pull requests on the stabilization branches, it will be triggered by
36
+ adding a label named `backport <destination_branch>` on the pull request.
37
+
38
+ ## Old workflows
39
+
40
+ GitHub will retain all the old workflows, so we need to delete them, the `delete-old-workflows-run`
41
+ workflow will delete the workflows older than 500 days.
42
+
43
+ ## Workflows
44
+
45
+ C2cciutils make easier to have those workflows in a project:
46
+
47
+ - `auto-review.yaml`: Auto review the Renovate pull requests
48
+ - `backport.yaml`: Trigger the backports (work with labels)
49
+ - `main.yaml`: Main workflow especially with the c2cciutils-checks command
50
+
51
+ All the provided commands used in the workflow:
52
+
53
+ - `c2cciutils`: some generic tools.
54
+ - `c2cciutils-version`: Create a new version of the project.
55
+ - `c2cciutils-env`: Print some environment information.
56
+
57
+ ## Utilities
58
+
59
+ The following utilities are provided:
60
+
61
+ - `c2cciutils`: some generic tools.
62
+ - `c2cciutils-download-applications`: Download the applications with version managed by Renovate, see below.
63
+ - `c2cciutils-docker-logs`: Display the logs of the application in Docker (compose).
64
+ - `c2cciutils-k8s-install`: Install a k3d / k3s cluster, see below.
65
+ - `c2cciutils-k8s-logs`: Display the logs of the application in the k8s cluster, see below.
66
+ - `c2cciutils-k8s-db`: Create a database in the k8s cluster, see below.
67
+ - `c2cciutils-k8s-wait`: Wait that the application started correctly in the cluster, see below.
68
+ - `c2cciutils-docker-versions-gen`: Generate the Docker package versions file (`ci/dpkg-versions.yaml`), see below.
69
+ - `c2cciutils-pin-pipenv`: Display all the dependencies that's in the `Pipenv.lock` but not in the `Pipenv` to be able to pin them.
70
+ - `c2cciutils-trigger-image-update`: Trigger the ArgoCD repository about image update on the CI (automatically done in the publishing).
71
+ - `c2cciutils-google-calendar`: Tool to test the Google credentials for calendar API and refresh them if needed. See `c2cciutils-google-calendar -h` for more information.
72
+
73
+ ## New project
74
+
75
+ The content of `example-project` can be a good base for a new project.
76
+
77
+ ## New version
78
+
79
+ Requirements: the right version (>= 1.6) of `c2cciutils` should be installed with the `version` extra.
80
+
81
+ To create a new minor version you just should run `c2cciutils-version --version=<version>`.
82
+
83
+ You are welcome to run `c2cciutils-version --help` to see what's it's done.
84
+
85
+ Note that it didn't create a tag, you should do it manually.
86
+
87
+ To create a patch version you should just create tag.
88
+
89
+ ## Secrets
90
+
91
+ In the CI we need to have the following secrets::
92
+
93
+ - `HAS_SECRETS` to be set to 'HAS_SECRETS', to avoid error errors from external
94
+ pull requests, already set globally on Camptocamp organization.
95
+ - `GOPASS_CI_GITHUB_TOKEN` and `CI_GPG_PRIVATE_KEY` required to initialize the gopass password store,
96
+ the secrets exists in the Camptocamp organization but not shared on all project, then you should add
97
+ your project to the shared list.
98
+
99
+ ## Use locally, in the projects that use c2cciutils
100
+
101
+ Install it: `python3 -m pip install --user --requirement ci/requirements.txt`
102
+
103
+ ## Configuration
104
+
105
+ You can get the current configuration with `c2cciutils --get-config`, the default configuration depends on your project.
106
+ Note that it didn't contain the default defined the schema and visible in the [generated documentation](./config.md).
107
+
108
+ You can override the configuration with the file `ci/config.yaml`.
109
+
110
+ At the base of the configuration you have:
111
+
112
+ - `version`: Contains some regular expressions to find the versions branches and tags, and to convert them into application versions.
113
+ - `publish`: The publishing configuration, see `c2cciutils/publish.py` for more information.
114
+
115
+ Many actions can be disabled by setting the corresponding configuration part to `False`.
116
+
117
+ ## SECURITY.md
118
+
119
+ The `SECURITY.md` file should contain the security policy of the repository, especially the end of
120
+ support dates.
121
+
122
+ For compatibility with `c2cciutils` it should contain an array with at least the columns
123
+ `Version` and `Supported Until`. The `Version` column will contain the concerned version.
124
+ The `Supported Until` will contain the date of end of support `dd/mm/yyyy`.
125
+ It can also contain the following sentences:
126
+
127
+ - `Unsupported`: no longer supported => no audit, no rebuild.
128
+ - `Best effort`: the support is ended, it is still rebuilt and audited, but this can be stopped without any notice.
129
+ - `To be defined`: not yet released or the date will be set related of another project release date (like for GeoMapFish).
130
+
131
+ See also [GitHub Documentation](https://docs.github.com/en/github/managing-security-vulnerabilities/adding-a-security-policy-to-your-repository)
132
+
133
+ ## IDE
134
+
135
+ The IDE should be configured as:
136
+
137
+ - using `black` and `isort` without any arguments,
138
+ - using the `editorconfig` configuration.
139
+
140
+ ### VScode
141
+
142
+ - Recommend extensions to work well with c2cciutils:
143
+ - [Prettier](https://marketplace.visualstudio.com/items?itemName=esbenp.prettier-vscode) And use EditorConfig
144
+ - [shell-format](https://marketplace.visualstudio.com/items?itemName=foxundermoon.shell-format) With the configuration
145
+ `"shellformat.flag": "-bn"`.
146
+ - [Better TOML](https://marketplace.visualstudio.com/items?itemName=bodil.prettier-toml)
147
+ - Other recommend extensions:
148
+ - [hadolint](https://marketplace.visualstudio.com/items?itemName=exiasr.hadolint)
149
+ - [Code Spell Checker](https://marketplace.visualstudio.com/items?itemName=streetsidesoftware.code-spell-checker)
150
+
151
+ Select a formatter:
152
+
153
+ - `CTRL+MAJ+P`
154
+ - Format document With...
155
+ - Configure Default Formatter...
156
+ - Select the formatter
157
+
158
+ ## Kubernetes
159
+
160
+ C2cciutils provide some commands for Kubernetes.
161
+
162
+ You can define a workflow like that:
163
+
164
+ ```yaml
165
+ - name: Install k3s/k3d (Kubernetes cluster)
166
+ run: c2cciutils-k8s-install
167
+
168
+ - name: Create a database to do the tests
169
+ run: c2cciutils-k8s-db --script=<my_script>.sql
170
+
171
+ - name: Install the application in the Kubernetes cluster
172
+ run: kubectl apply -f <my_application>.yaml
173
+
174
+ - name: Wait that the application is ready
175
+ run: c2cciutils-k8s-wait
176
+ - name: Print the application status and logs
177
+ run: c2cciutils-k8s-logs
178
+ if: always()
179
+
180
+ - name: Uninstall the application
181
+ run: kubectl delete -f <my_application>.yaml || true
182
+
183
+ - name: Cleanup the database
184
+ run: c2cciutils-k8s-db --cleanup
185
+ ```
186
+
187
+ `c2cciutils-k8s-install` can be configured in the `ci/config.yaml` file, in section `k8s/k3d/install-commands`, default is:
188
+
189
+ ```yaml
190
+ - - k3d
191
+ cluster
192
+ create
193
+ test-cluster
194
+ --no-lb
195
+ --no-rollback
196
+ ```
197
+
198
+ See also: [K3d cluster create documentation](https://k3d.io/v4.4.8/usage/commands/k3d_cluster_create/).
199
+
200
+ `c2cciutils-k8s-db` can be configured in the `ci/config.yaml` file, in section `k8s/db/chart-options`, default is:
201
+
202
+ ```yaml
203
+ persistence.enabled: 'false'
204
+ tls.enabled: 'true'
205
+ tls.autoGenerated: 'true'
206
+ postgresqlPassword: mySuperTestingPassword
207
+ volumePermissions.enabled: 'true'
208
+ ```
209
+
210
+ See also: [Parameters documentations](https://github.com/bitnami/charts/tree/master/bitnami/postgresql#parameters).
211
+
212
+ ## Contributing
213
+
214
+ Install the pre-commit hooks:
215
+
216
+ ```bash
217
+ pip install pre-commit
218
+ pre-commit install --allow-missing-config
219
+ ```