c2cciutils 1.8.0.dev64__py3-none-any.whl → 1.8.0.dev68__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.
Potentially problematic release.
This version of c2cciutils might be problematic. Click here for more details.
- c2cciutils/__init__.py +1 -194
- c2cciutils/applications-versions.yaml +0 -1
- c2cciutils/configuration.py +1 -598
- c2cciutils/schema.json +2 -317
- {c2cciutils-1.8.0.dev64.dist-info → c2cciutils-1.8.0.dev68.dist-info}/METADATA +1 -219
- c2cciutils-1.8.0.dev68.dist-info/RECORD +25 -0
- c2cciutils-1.8.0.dev68.dist-info/entry_points.txt +9 -0
- c2cciutils/lib/docker.py +0 -141
- c2cciutils/lib/oidc.py +0 -188
- c2cciutils/package-lock.json +0 -370
- c2cciutils/package.json +0 -9
- c2cciutils/publish.py +0 -451
- c2cciutils/schema-applications.json +0 -50
- c2cciutils/scripts/clean.py +0 -103
- c2cciutils/scripts/docker_versions_gen.py +0 -33
- c2cciutils/scripts/pin_pipenv.py +0 -54
- c2cciutils/scripts/publish.py +0 -477
- c2cciutils/scripts/trigger_image_update.py +0 -84
- c2cciutils/scripts/version.py +0 -245
- c2cciutils-1.8.0.dev64.dist-info/RECORD +0 -37
- c2cciutils-1.8.0.dev64.dist-info/entry_points.txt +0 -18
- {c2cciutils-1.8.0.dev64.dist-info → c2cciutils-1.8.0.dev68.dist-info}/LICENSE +0 -0
- {c2cciutils-1.8.0.dev64.dist-info → c2cciutils-1.8.0.dev68.dist-info}/WHEEL +0 -0
c2cciutils/schema.json
CHANGED
|
@@ -6,251 +6,6 @@
|
|
|
6
6
|
"description": "C2C CI utils configuration file",
|
|
7
7
|
"additionalProperties": false,
|
|
8
8
|
"definitions": {
|
|
9
|
-
"publish_docker": {
|
|
10
|
-
"title": "Publish Docker",
|
|
11
|
-
"description": "The configuration used to publish on Docker",
|
|
12
|
-
"oneOf": [
|
|
13
|
-
{
|
|
14
|
-
"title": "Publish Docker config",
|
|
15
|
-
"description": "The configuration used to publish on Docker",
|
|
16
|
-
"type": "object",
|
|
17
|
-
"properties": {
|
|
18
|
-
"latest": {
|
|
19
|
-
"description": "Publish the latest version on tag latest",
|
|
20
|
-
"title": "Publish Docker latest",
|
|
21
|
-
"default": true,
|
|
22
|
-
"type": "boolean"
|
|
23
|
-
},
|
|
24
|
-
"images": {
|
|
25
|
-
"description": "List of images to be published",
|
|
26
|
-
"type": "array",
|
|
27
|
-
"items": {
|
|
28
|
-
"title": "Publish Docker image",
|
|
29
|
-
"type": "object",
|
|
30
|
-
"properties": {
|
|
31
|
-
"group": {
|
|
32
|
-
"description": "The image is in the group, should be used with the --group option of c2cciutils-publish script",
|
|
33
|
-
"title": "Publish Docker image group",
|
|
34
|
-
"default": "default",
|
|
35
|
-
"type": "string"
|
|
36
|
-
},
|
|
37
|
-
"name": {
|
|
38
|
-
"description": "The image name",
|
|
39
|
-
"type": "string"
|
|
40
|
-
},
|
|
41
|
-
"tags": {
|
|
42
|
-
"description": "The tag name, will be formatted with the version=<the version>, the image with version=latest should be present when we call the c2cciutils-publish script",
|
|
43
|
-
"title": "publish docker image tags",
|
|
44
|
-
"type": "array",
|
|
45
|
-
"default": ["{version}"],
|
|
46
|
-
"items": {
|
|
47
|
-
"type": "string"
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
}
|
|
51
|
-
}
|
|
52
|
-
},
|
|
53
|
-
"repository": {
|
|
54
|
-
"title": "Docker repository",
|
|
55
|
-
"description": "The repository where we should publish the images",
|
|
56
|
-
"default": {
|
|
57
|
-
"github": {
|
|
58
|
-
"server": "ghcr.io",
|
|
59
|
-
"versions": ["version_tag", "version_branch", "rebuild"]
|
|
60
|
-
},
|
|
61
|
-
"dockerhub": {}
|
|
62
|
-
},
|
|
63
|
-
"type": "object",
|
|
64
|
-
"additionalProperties": {
|
|
65
|
-
"title": "Publish Docker repository",
|
|
66
|
-
"type": "object",
|
|
67
|
-
"properties": {
|
|
68
|
-
"server": {
|
|
69
|
-
"description": "The server URL",
|
|
70
|
-
"type": "string"
|
|
71
|
-
},
|
|
72
|
-
"versions": {
|
|
73
|
-
"description": "The kind or version that should be published, tag, branch or value of the --version argument of the c2cciutils-publish script",
|
|
74
|
-
"title": "Publish Docker repository versions",
|
|
75
|
-
"type": "array",
|
|
76
|
-
"default": ["version_tag", "version_branch", "rebuild", "feature_branch"],
|
|
77
|
-
"items": {
|
|
78
|
-
"type": "string"
|
|
79
|
-
}
|
|
80
|
-
}
|
|
81
|
-
}
|
|
82
|
-
}
|
|
83
|
-
},
|
|
84
|
-
"dispatch": {
|
|
85
|
-
"description": "Send a dispatch event to an other repository",
|
|
86
|
-
"default": {},
|
|
87
|
-
"oneOf": [
|
|
88
|
-
{
|
|
89
|
-
"type": "object",
|
|
90
|
-
"title": "dispatch config",
|
|
91
|
-
"description": "Send a dispatch event to an other repository",
|
|
92
|
-
"properties": {
|
|
93
|
-
"repository": {
|
|
94
|
-
"title": "Docker dispatch repository",
|
|
95
|
-
"description": "The repository name to be triggered",
|
|
96
|
-
"default": "camptocamp/argocd-gs-gmf-apps",
|
|
97
|
-
"type": "string"
|
|
98
|
-
},
|
|
99
|
-
"event-type": {
|
|
100
|
-
"title": "Docker dispatch event type",
|
|
101
|
-
"description": "The event type to be triggered",
|
|
102
|
-
"default": "image-update",
|
|
103
|
-
"type": "string"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
},
|
|
107
|
-
{ "const": false }
|
|
108
|
-
]
|
|
109
|
-
},
|
|
110
|
-
"snyk": {
|
|
111
|
-
"description": "Checks the published images with Snyk",
|
|
112
|
-
"type": "object",
|
|
113
|
-
"properties": {
|
|
114
|
-
"monitor_args": {
|
|
115
|
-
"description": "The arguments to pass to the Snyk container monitor command",
|
|
116
|
-
"title": "Publish Docker Snyk monitor args",
|
|
117
|
-
"default": ["--app-vulns"],
|
|
118
|
-
"oneOf": [
|
|
119
|
-
{
|
|
120
|
-
"type": "array",
|
|
121
|
-
"items": {
|
|
122
|
-
"type": "string"
|
|
123
|
-
}
|
|
124
|
-
},
|
|
125
|
-
{ "const": false }
|
|
126
|
-
]
|
|
127
|
-
},
|
|
128
|
-
"test_args": {
|
|
129
|
-
"description": "The arguments to pass to the Snyk container test command",
|
|
130
|
-
"title": "Publish Docker Snyk test args",
|
|
131
|
-
"default": ["--app-vulns", "--severity-threshold=critical"],
|
|
132
|
-
"oneOf": [
|
|
133
|
-
{
|
|
134
|
-
"type": "array",
|
|
135
|
-
"items": {
|
|
136
|
-
"type": "string"
|
|
137
|
-
}
|
|
138
|
-
},
|
|
139
|
-
{ "const": false }
|
|
140
|
-
]
|
|
141
|
-
}
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
}
|
|
145
|
-
},
|
|
146
|
-
{ "const": false }
|
|
147
|
-
]
|
|
148
|
-
},
|
|
149
|
-
"publish_google_calendar": {
|
|
150
|
-
"title": "Publish Google calendar",
|
|
151
|
-
"description": "The configuration to publish on Google Calendar",
|
|
152
|
-
"default": {},
|
|
153
|
-
"oneOf": [
|
|
154
|
-
{
|
|
155
|
-
"title": "Publish Google calendar config",
|
|
156
|
-
"description": "The configuration to publish on Google Calendar",
|
|
157
|
-
"type": "object",
|
|
158
|
-
"properties": {
|
|
159
|
-
"on": {
|
|
160
|
-
"title": "Publish Google calendar on",
|
|
161
|
-
"default": ["version_branch", "version_tag", "rebuild"],
|
|
162
|
-
"type": "array",
|
|
163
|
-
"items": {
|
|
164
|
-
"type": "string"
|
|
165
|
-
}
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
},
|
|
169
|
-
{ "const": false }
|
|
170
|
-
]
|
|
171
|
-
},
|
|
172
|
-
"publish_pypi": {
|
|
173
|
-
"title": "publish pypi",
|
|
174
|
-
"description": "Configuration to publish on pypi",
|
|
175
|
-
"default": {},
|
|
176
|
-
"oneOf": [
|
|
177
|
-
{
|
|
178
|
-
"title": "publish pypi config",
|
|
179
|
-
"description": "Configuration to publish on pypi",
|
|
180
|
-
"type": "object",
|
|
181
|
-
"properties": {
|
|
182
|
-
"packages": {
|
|
183
|
-
"description": "The configuration of packages that will be published",
|
|
184
|
-
"type": "array",
|
|
185
|
-
"items": {
|
|
186
|
-
"title": "publish pypi package",
|
|
187
|
-
"description": "The configuration of package that will be published",
|
|
188
|
-
"type": "object",
|
|
189
|
-
"properties": {
|
|
190
|
-
"group": {
|
|
191
|
-
"description": "The image is in the group, should be used with the --group option of c2cciutils-publish script",
|
|
192
|
-
"title": "Publish pip package group",
|
|
193
|
-
"default": "default",
|
|
194
|
-
"type": "string"
|
|
195
|
-
},
|
|
196
|
-
"path": {
|
|
197
|
-
"description": "The path of the pypi package",
|
|
198
|
-
"type": "string"
|
|
199
|
-
},
|
|
200
|
-
"build_command": {
|
|
201
|
-
"description": "The command used to do the build",
|
|
202
|
-
"type": "array",
|
|
203
|
-
"items": {
|
|
204
|
-
"type": "string"
|
|
205
|
-
}
|
|
206
|
-
}
|
|
207
|
-
}
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
"versions": {
|
|
211
|
-
"description": "The kind or version that should be published, tag, branch or value of the --version argument of the c2cciutils-publish script",
|
|
212
|
-
"type": "array",
|
|
213
|
-
"items": {
|
|
214
|
-
"type": "string"
|
|
215
|
-
}
|
|
216
|
-
}
|
|
217
|
-
}
|
|
218
|
-
},
|
|
219
|
-
{
|
|
220
|
-
"const": false
|
|
221
|
-
}
|
|
222
|
-
]
|
|
223
|
-
},
|
|
224
|
-
"publish_helm": {
|
|
225
|
-
"title": "publish helm",
|
|
226
|
-
"description": "Configuration to publish Helm charts on GitHub release",
|
|
227
|
-
"oneOf": [
|
|
228
|
-
{
|
|
229
|
-
"title": "publish helm config",
|
|
230
|
-
"description": "Configuration to publish on Helm charts on GitHub release",
|
|
231
|
-
"type": "object",
|
|
232
|
-
"properties": {
|
|
233
|
-
"folders": {
|
|
234
|
-
"description": "The folders that will be published",
|
|
235
|
-
"type": "array",
|
|
236
|
-
"items": {
|
|
237
|
-
"type": "string"
|
|
238
|
-
}
|
|
239
|
-
},
|
|
240
|
-
"versions": {
|
|
241
|
-
"description": "The kind or version that should be published, tag, branch or value of the --version argument of the c2cciutils-publish script",
|
|
242
|
-
"type": "array",
|
|
243
|
-
"items": {
|
|
244
|
-
"type": "string"
|
|
245
|
-
}
|
|
246
|
-
}
|
|
247
|
-
}
|
|
248
|
-
},
|
|
249
|
-
{
|
|
250
|
-
"const": false
|
|
251
|
-
}
|
|
252
|
-
]
|
|
253
|
-
},
|
|
254
9
|
"print_versions": {
|
|
255
10
|
"title": "Print versions",
|
|
256
11
|
"description": "The print versions configuration",
|
|
@@ -290,58 +45,12 @@
|
|
|
290
45
|
}
|
|
291
46
|
}
|
|
292
47
|
}
|
|
293
|
-
},
|
|
294
|
-
"version_transform": {
|
|
295
|
-
"title": "Version transform",
|
|
296
|
-
"description": "A version transformer definition",
|
|
297
|
-
"type": "array",
|
|
298
|
-
"items": {
|
|
299
|
-
"type": "object",
|
|
300
|
-
"properties": {
|
|
301
|
-
"from": {
|
|
302
|
-
"description": "The from regular expression",
|
|
303
|
-
"type": "string"
|
|
304
|
-
},
|
|
305
|
-
"to": {
|
|
306
|
-
"description": "The expand regular expression: https://docs.python.org/3/library/re.html#re.Match.expand",
|
|
307
|
-
"type": "string"
|
|
308
|
-
}
|
|
309
|
-
}
|
|
310
|
-
}
|
|
311
48
|
}
|
|
312
49
|
},
|
|
50
|
+
|
|
313
51
|
"properties": {
|
|
314
52
|
"print_versions": { "$ref": "#/definitions/print_versions" },
|
|
315
|
-
|
|
316
|
-
"title": "Publish",
|
|
317
|
-
"description": "The publishing configurations",
|
|
318
|
-
"default": {
|
|
319
|
-
"pypi": { "versions": ["version_tag"], "packages": "<auto-detected>" },
|
|
320
|
-
"docker": {
|
|
321
|
-
"images": "<auto-detected>"
|
|
322
|
-
},
|
|
323
|
-
"helm": {
|
|
324
|
-
"versions": ["version_tag"],
|
|
325
|
-
"folders": "<auto-detected>"
|
|
326
|
-
}
|
|
327
|
-
},
|
|
328
|
-
"type": "object",
|
|
329
|
-
"properties": {
|
|
330
|
-
"docker": { "$ref": "#/definitions/publish_docker" },
|
|
331
|
-
"pypi": { "$ref": "#/definitions/publish_pypi" },
|
|
332
|
-
"helm": { "$ref": "#/definitions/publish_helm" },
|
|
333
|
-
"google_calendar": { "$ref": "#/definitions/publish_google_calendar" }
|
|
334
|
-
}
|
|
335
|
-
},
|
|
336
|
-
"version": {
|
|
337
|
-
"title": "Version",
|
|
338
|
-
"description": "The version configurations",
|
|
339
|
-
"type": "object",
|
|
340
|
-
"properties": {
|
|
341
|
-
"branch_to_version_re": { "$ref": "#/definitions/version_transform" },
|
|
342
|
-
"tag_to_version_re": { "$ref": "#/definitions/version_transform" }
|
|
343
|
-
}
|
|
344
|
-
},
|
|
53
|
+
|
|
345
54
|
"k8s": {
|
|
346
55
|
"title": "K8s configuration",
|
|
347
56
|
"default": {},
|
|
@@ -388,30 +97,6 @@
|
|
|
388
97
|
}
|
|
389
98
|
}
|
|
390
99
|
}
|
|
391
|
-
},
|
|
392
|
-
"dpkg": {
|
|
393
|
-
"title": "dpkg",
|
|
394
|
-
"description": "The configuration use t manage the dpkg packages",
|
|
395
|
-
"type": "object",
|
|
396
|
-
"additionalProperties": false,
|
|
397
|
-
"properties": {
|
|
398
|
-
"packages_mapping": {
|
|
399
|
-
"title": "dpkg packages mapping",
|
|
400
|
-
"description": "The mapping of source package found in the image to package present in repology.org",
|
|
401
|
-
"type": "object",
|
|
402
|
-
"additionalProperties": {
|
|
403
|
-
"type": "string"
|
|
404
|
-
}
|
|
405
|
-
},
|
|
406
|
-
"ignored_packages": {
|
|
407
|
-
"title": "dpkg ignored packages",
|
|
408
|
-
"description": "The list of packages that should be ignored",
|
|
409
|
-
"type": "array",
|
|
410
|
-
"items": {
|
|
411
|
-
"type": "string"
|
|
412
|
-
}
|
|
413
|
-
}
|
|
414
|
-
}
|
|
415
100
|
}
|
|
416
101
|
}
|
|
417
102
|
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
Metadata-Version: 2.3
|
|
2
2
|
Name: c2cciutils
|
|
3
|
-
Version: 1.8.0.
|
|
3
|
+
Version: 1.8.0.dev68
|
|
4
4
|
Summary: Common utilities for Camptocamp CI
|
|
5
5
|
License: FreeBSD
|
|
6
6
|
Keywords: ci
|
|
@@ -21,24 +21,9 @@ Classifier: Programming Language :: Python :: 3.11
|
|
|
21
21
|
Classifier: Programming Language :: Python :: 3.12
|
|
22
22
|
Classifier: Programming Language :: Python :: 3.13
|
|
23
23
|
Classifier: Typing :: Typed
|
|
24
|
-
Provides-Extra: audit
|
|
25
|
-
Provides-Extra: checks
|
|
26
|
-
Provides-Extra: pr-checks
|
|
27
|
-
Provides-Extra: publish
|
|
28
|
-
Provides-Extra: publish-plugins
|
|
29
|
-
Provides-Extra: version
|
|
30
24
|
Requires-Dist: PyYAML (==6.0.2)
|
|
31
|
-
Requires-Dist: debian-inspector (==31.1.0)
|
|
32
|
-
Requires-Dist: defusedxml (==0.7.1)
|
|
33
|
-
Requires-Dist: google-api-python-client (==2.160.0) ; extra == "publish"
|
|
34
|
-
Requires-Dist: google-auth-httplib2 (==0.2.0) ; extra == "publish"
|
|
35
|
-
Requires-Dist: google-auth-oauthlib (==1.2.1) ; extra == "publish"
|
|
36
|
-
Requires-Dist: id (==1.5.0) ; extra == "publish"
|
|
37
|
-
Requires-Dist: multi-repo-automation (==1.5.0) ; extra == "version"
|
|
38
25
|
Requires-Dist: requests (==2.32.3)
|
|
39
26
|
Requires-Dist: ruamel.yaml (==0.18.10)
|
|
40
|
-
Requires-Dist: security-md (==1.0.0)
|
|
41
|
-
Requires-Dist: twine (==6.1.0) ; extra == "publish"
|
|
42
27
|
Project-URL: Repository, https://github.com/camptocamp/c2cciutils
|
|
43
28
|
Description-Content-Type: text/markdown
|
|
44
29
|
|
|
@@ -90,7 +75,6 @@ C2cciutils make easier to have those workflows in a project:
|
|
|
90
75
|
|
|
91
76
|
- `auto-review.yaml`: Auto review the Renovate pull requests
|
|
92
77
|
- `backport.yaml`: Trigger the backports (work with labels)
|
|
93
|
-
- `clean.yaml`: Clean the Docker images related on a deleted feature branch
|
|
94
78
|
- `main.yaml`: Main workflow especially with the c2cciutils-checks command
|
|
95
79
|
|
|
96
80
|
All the provided commands used in the workflow:
|
|
@@ -98,8 +82,6 @@ All the provided commands used in the workflow:
|
|
|
98
82
|
- `c2cciutils`: some generic tools.
|
|
99
83
|
- `c2cciutils-version`: Create a new version of the project.
|
|
100
84
|
- `c2cciutils-env`: Print some environment information.
|
|
101
|
-
- `c2cciutils-publish`: Publish the project.
|
|
102
|
-
- `c2cciutils-clean`: Delete Docker images on Docker Hub after corresponding branch have been deleted.
|
|
103
85
|
|
|
104
86
|
## Utilities
|
|
105
87
|
|
|
@@ -146,7 +128,6 @@ In the CI we need to have the following secrets::
|
|
|
146
128
|
## Use locally, in the projects that use c2cciutils
|
|
147
129
|
|
|
148
130
|
Install it: `python3 -m pip install --user --requirement ci/requirements.txt`
|
|
149
|
-
Dry run publish: `GITHUB_REF=... c2cciutils-publish --dry-run ...`
|
|
150
131
|
|
|
151
132
|
## Configuration
|
|
152
133
|
|
|
@@ -203,205 +184,6 @@ Select a formatter:
|
|
|
203
184
|
- Configure Default Formatter...
|
|
204
185
|
- Select the formatter
|
|
205
186
|
|
|
206
|
-
## Publishing
|
|
207
|
-
|
|
208
|
-
### To pypi
|
|
209
|
-
|
|
210
|
-
The config is like this:
|
|
211
|
-
|
|
212
|
-
```yaml
|
|
213
|
-
versions:
|
|
214
|
-
# List of kinds of versions you want to publish, that can be:
|
|
215
|
-
# rebuild (specified with --type),
|
|
216
|
-
# version_tag, version_branch, feature_branch, feature_tag (for pull request)
|
|
217
|
-
```
|
|
218
|
-
|
|
219
|
-
It we have a `setup.py` file, we will be in legacy mode:
|
|
220
|
-
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:
|
|
221
|
-
|
|
222
|
-
```python
|
|
223
|
-
VERSION = os.environ.get("VERSION", "1.0.0")
|
|
224
|
-
```
|
|
225
|
-
|
|
226
|
-
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.
|
|
227
|
-
|
|
228
|
-
Example of configuration:
|
|
229
|
-
|
|
230
|
-
```toml
|
|
231
|
-
[tool.poetry-dynamic-versioning]
|
|
232
|
-
enable = true
|
|
233
|
-
vcs = "git"
|
|
234
|
-
pattern = "^(?P<base>\\d+(\\.\\d+)*)"
|
|
235
|
-
format-jinja = """
|
|
236
|
-
{%- if env.get("VERSION_TYPE") == "version_branch" -%}
|
|
237
|
-
{{serialize_pep440(bump_version(base, 1 if env.get("IS_MASTER") == "TRUE" else 2), dev=distance)}}
|
|
238
|
-
{%- elif distance == 0 -%}
|
|
239
|
-
{{serialize_pep440(base)}}
|
|
240
|
-
{%- else -%}
|
|
241
|
-
{{serialize_pep440(bump_version(base), dev=distance)}}
|
|
242
|
-
{%- endif -%}
|
|
243
|
-
"""
|
|
244
|
-
|
|
245
|
-
```
|
|
246
|
-
|
|
247
|
-
Note that we can access to the environment variables `VERSION`,`VERSION_TYPE` and `IS_MASTER`.
|
|
248
|
-
|
|
249
|
-
Then by default:
|
|
250
|
-
|
|
251
|
-
- Tag with `1.2.3` => release `1.2.3`
|
|
252
|
-
- Commit on feature branch just do a validation
|
|
253
|
-
- Commit on `master` branch after the tag 1.3.0 => release `1.4.0.dev1`
|
|
254
|
-
- Commit on `1.3` branch after the tag 1.3.0 => release `1.3.1.dev1`
|
|
255
|
-
|
|
256
|
-
#### Authentication
|
|
257
|
-
|
|
258
|
-
If the file `~/.pypirc` exists we consider that we ar already logged in also
|
|
259
|
-
we will do the login with the `pypi` server with OpenID Connect (OIDC).
|
|
260
|
-
|
|
261
|
-
The OIDC login is recommended because it didn't needs any additional secrets,
|
|
262
|
-
but it need some configuration on pypi in the package,
|
|
263
|
-
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).
|
|
264
|
-
|
|
265
|
-
#### Integration if the package directly in a Docker image
|
|
266
|
-
|
|
267
|
-
To make it working in the `Dockerfile` you should have in the `poetry` stage:
|
|
268
|
-
|
|
269
|
-
```Dockerfile
|
|
270
|
-
ENV POETRY_DYNAMIC_VERSIONING_BYPASS=dev
|
|
271
|
-
RUN poetry export --extras=checks --extras=publish --output=requirements.txt \
|
|
272
|
-
&& poetry export --with=dev --output=requirements-dev.txt
|
|
273
|
-
```
|
|
274
|
-
|
|
275
|
-
And in the `run` stage
|
|
276
|
-
|
|
277
|
-
```Dockerfile
|
|
278
|
-
ARG VERSION=dev
|
|
279
|
-
RUN --mount=type=cache,target=/root/.cache \
|
|
280
|
-
POETRY_DYNAMIC_VERSIONING_BYPASS=${VERSION} python3 -m pip install --disable-pip-version-check --no-deps --editable=.
|
|
281
|
-
```
|
|
282
|
-
|
|
283
|
-
And in the `Makefile`:
|
|
284
|
-
|
|
285
|
-
```Makefile
|
|
286
|
-
VERSION = $(strip $(shell poetry version --short))
|
|
287
|
-
|
|
288
|
-
.PHONY: build
|
|
289
|
-
build: ## Build the Docker images
|
|
290
|
-
docker build --build-arg=VERSION=$(VERSION) --tag=$(GITHUB_REPOSITORY) .
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
### To Docker registry
|
|
294
|
-
|
|
295
|
-
The config is like this:
|
|
296
|
-
|
|
297
|
-
```yaml
|
|
298
|
-
latest: True
|
|
299
|
-
images:
|
|
300
|
-
- # The base name of the image we want to publish
|
|
301
|
-
name:
|
|
302
|
-
repository:
|
|
303
|
-
<internal_name>:
|
|
304
|
-
# The fqdn name of the server if not Docker hub
|
|
305
|
-
server:
|
|
306
|
-
# List of kinds of versions you want to publish, that can be: rebuild (specified using --type),
|
|
307
|
-
# version_tag, version_branch, feature_branch, feature_tag (for pull request)
|
|
308
|
-
version:
|
|
309
|
-
# List of tags we want to publish interpreted with `format(version=version)`
|
|
310
|
-
# e.g. if you use `{version}-lite` when you publish the version `1.2.3` the source tag
|
|
311
|
-
# (that should be built by the application build) is `latest-lite`, and it will be published
|
|
312
|
-
# with the tag `1.2.3-lite`.
|
|
313
|
-
tags:
|
|
314
|
-
# If your images are published by different jobs you can separate them in different groups
|
|
315
|
-
# and publish them with `c2cciutils-publish --group=<group>`
|
|
316
|
-
group:
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
By default, the last line of the `SECURITY.md` file will be published (`docker`) with the tag
|
|
320
|
-
`latest`. Set `latest` to `False` to disable it.
|
|
321
|
-
|
|
322
|
-
With the `c2cciutils-clean` the images on Docker hub for `feature_branch` will be removed on branch removing.
|
|
323
|
-
|
|
324
|
-
## Download applications
|
|
325
|
-
|
|
326
|
-
In case some executables or applications from GitHub releases or any other URLs are required on the CI host
|
|
327
|
-
and are not handled by any dependency manager, we provide a set of tools to install them and manage upgrades
|
|
328
|
-
through Renovate.
|
|
329
|
-
|
|
330
|
-
Create an application file (e.-g. `applications.yaml`) with:
|
|
331
|
-
|
|
332
|
-
```yaml
|
|
333
|
-
# yaml-language-server: $schema=https://raw.githubusercontent.com/camptocamp/c2cciutils/master/c2cciutils/schema-applications.json
|
|
334
|
-
|
|
335
|
-
# Application from GitHub release
|
|
336
|
-
<organization>/<project>:
|
|
337
|
-
get-file-name: <file name present in the release>
|
|
338
|
-
to-file-name: <The file name you want to create in ~/.local/bin>
|
|
339
|
-
finish-command: # The command you want to run after the file is downloaded
|
|
340
|
-
- - chmod # To be executable (usually required)
|
|
341
|
-
- +x
|
|
342
|
-
- <to-file-name>
|
|
343
|
-
- - <to-file-name> # Print the version of the application
|
|
344
|
-
- --version
|
|
345
|
-
# Application from GitHub release in a tar file (or tar.gz)
|
|
346
|
-
<organization>/<project>:
|
|
347
|
-
get-file-name: <file name present in the release>
|
|
348
|
-
type: tar
|
|
349
|
-
tar-file-name: <The file name available in the tar file>
|
|
350
|
-
to-file-name: <The file name you want to create in ~/.local/bin>
|
|
351
|
-
finish-command: [...] # The command you want to run after the file is downloaded
|
|
352
|
-
# Application from an URL
|
|
353
|
-
<application reference name>:
|
|
354
|
-
url-pattern: <The URL used to download the application>
|
|
355
|
-
to-file-name: <The file name you want to create in ~/.local/bin>
|
|
356
|
-
finish-command: [...] # The command you want to run after the file is downloaded
|
|
357
|
-
```
|
|
358
|
-
|
|
359
|
-
In the attributes `url-pattern`, `get-file-name` you can use the following variables:
|
|
360
|
-
|
|
361
|
-
- `{version}`: The version of the application present in the version file.
|
|
362
|
-
- `{version_quote}`: The URL encoded version.
|
|
363
|
-
- `{short_version}`: The version without the `v` prefix.
|
|
364
|
-
|
|
365
|
-
The `applications-versions.yaml` file is a map of applications and their versions.
|
|
366
|
-
|
|
367
|
-
Add in your Renovate configuration:
|
|
368
|
-
|
|
369
|
-
```json5
|
|
370
|
-
regexManagers: [
|
|
371
|
-
{
|
|
372
|
-
fileMatch: ['^applications-versions.yaml$'],
|
|
373
|
-
matchStrings: [
|
|
374
|
-
'(?<depName>[^\\s]+): (?<currentValue>[^\\s]+) # (?<datasource>[^\\s]+)',
|
|
375
|
-
],
|
|
376
|
-
},
|
|
377
|
-
],
|
|
378
|
-
```
|
|
379
|
-
|
|
380
|
-
Now you need to call `c2cciutils-download-applications --applications-file=applications.yaml --versions-file=applications-version.yaml`
|
|
381
|
-
to install required applications on CI host before using them (an already installed application is installed only if needed).
|
|
382
|
-
|
|
383
|
-
## Use Renovate to trigger a new build instead of the legacy rebuild
|
|
384
|
-
|
|
385
|
-
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`.
|
|
386
|
-
|
|
387
|
-
Add in your renovate configuration:
|
|
388
|
-
|
|
389
|
-
```javascript
|
|
390
|
-
regexManagers: [
|
|
391
|
-
{
|
|
392
|
-
fileMatch: ['^ci/dpkg-versions.yaml$'],
|
|
393
|
-
matchStrings: [" *(?<depName>[^'\\s]+): '?(?<currentValue>[^'\\s/]*[0-9][^'\\s/]*)'?"],
|
|
394
|
-
datasourceTemplate: 'repology',
|
|
395
|
-
versioningTemplate: 'loose',
|
|
396
|
-
},
|
|
397
|
-
],
|
|
398
|
-
```
|
|
399
|
-
|
|
400
|
-
When a new version of a Debian package will be available:
|
|
401
|
-
|
|
402
|
-
- Renovate will automatically open a pull request to update the file `ci/dpkg-versions.yaml`.
|
|
403
|
-
- And the continuous integration will build a new fresh Docker image with latest versions of all Debian packages.
|
|
404
|
-
|
|
405
187
|
## Kubernetes
|
|
406
188
|
|
|
407
189
|
C2cciutils provide some commands for Kubernetes.
|
|
@@ -0,0 +1,25 @@
|
|
|
1
|
+
c2cciutils/__init__.py,sha256=h9YYi4HL_Ck5XH7CP91dpMEjWk0wV9q4IRNMfzmWoxs,7704
|
|
2
|
+
c2cciutils/applications-versions.yaml,sha256=-hJ_fx-rxYYfYuhTA-2R2jiKFHYOK7U-NfkElslEvu4,179
|
|
3
|
+
c2cciutils/applications.yaml,sha256=yn0XRi08cS29A_jXPofcBPxsGBv7PEBliztjRC3WtfM,504
|
|
4
|
+
c2cciutils/applications_definition.py,sha256=inAh3vJitu3S9n62Ntv6N-avNUQlUd5FatNvDq4VpxM,1305
|
|
5
|
+
c2cciutils/branches.graphql,sha256=UZrj1RO-H527M1SKqWm1VnkWtNsuKTnPTf4BCU2YcOU,358
|
|
6
|
+
c2cciutils/commits.graphql,sha256=3HAuIEig5V7j1L-6mqBaOkiTD3Fb8_gl1ilpZjPJf74,308
|
|
7
|
+
c2cciutils/configuration.py,sha256=Y-bSN7dbRDPGiuEXhiOu98LWpgEJkCwp6CSaUwZjIuI,4323
|
|
8
|
+
c2cciutils/default_branch.graphql,sha256=CaP3rRsNiyg_7RvqbMk0tOJr0aqWd8cOeSV-ZKgvKY4,131
|
|
9
|
+
c2cciutils/env.py,sha256=daNqFY-6-X7PGuPz5OaN634KqYtsawj9Dj-Zt-bxctw,3338
|
|
10
|
+
c2cciutils/schema.json,sha256=8VNH64PdlZruYKPbBTd0t7WjTBE0cjRrVJuyziEXo38,3323
|
|
11
|
+
c2cciutils/scripts/__init__.py,sha256=YvySYhMJ9eUqBc9FgH6hNbZHbTU25D7z6FIbYJiRW_U,34
|
|
12
|
+
c2cciutils/scripts/docker_logs.py,sha256=m8ETno2N1mqh-xHvmCi2zxXfvX_vc14dgsOqqMsxpdQ,1790
|
|
13
|
+
c2cciutils/scripts/download_applications.py,sha256=x0SPm4MCWCIYMp1AWekIpbOicwUixitEAJ69quMq698,4488
|
|
14
|
+
c2cciutils/scripts/env.py,sha256=YZwV39D_vQ454ytHByI84gXP6VrtTW3eM8MdFLUBCw0,363
|
|
15
|
+
c2cciutils/scripts/k8s/__init__.py,sha256=m8_lELJYRmzbAW7aGZL_T3tNwuFi1t8ot8F271HZp9E,67
|
|
16
|
+
c2cciutils/scripts/k8s/db.py,sha256=GK1tzzyCqrCyIJzcBdIXjyNJUXrBPFNa-9fdtwxyrlU,3268
|
|
17
|
+
c2cciutils/scripts/k8s/install.py,sha256=OIQ8KHA3Pst2pjO2E-J5FYNaBHW-i-fqCXlAUcG1tw0,933
|
|
18
|
+
c2cciutils/scripts/k8s/logs.py,sha256=-xJYu8BBUmSmMrPEwiTBKZjJBRyIlMp1depCB04_NWs,2655
|
|
19
|
+
c2cciutils/scripts/k8s/wait.py,sha256=zgPToNMN42qRTAq3RyzCApOqxOPJmmVUsIqbEuXCdiE,5689
|
|
20
|
+
c2cciutils/scripts/main.py,sha256=DfljDzEGCWwP7FZG0RRZaXD6PmOVaXMJjnNBQ0-rAWM,785
|
|
21
|
+
c2cciutils-1.8.0.dev68.dist-info/LICENSE,sha256=K_e76Y2cY12AHvtanvNmIEJ0nWsNh_WFMDK020TxMcY,1307
|
|
22
|
+
c2cciutils-1.8.0.dev68.dist-info/METADATA,sha256=jFVaDKRLUsl_AGeUuUzWk1fRU0yrHeLbpBB5PTedMdk,9486
|
|
23
|
+
c2cciutils-1.8.0.dev68.dist-info/WHEEL,sha256=XbeZDeTWKc1w7CSIyre5aMDU_-PohRwTQceYnisIYYY,88
|
|
24
|
+
c2cciutils-1.8.0.dev68.dist-info/entry_points.txt,sha256=w1Sdz21V5YnbdnChRYvCg_h8tj-g1LeG0TdNcU_Lqjo,375
|
|
25
|
+
c2cciutils-1.8.0.dev68.dist-info/RECORD,,
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
[console_scripts]
|
|
2
|
+
c2cciutils=c2cciutils.scripts.main:main
|
|
3
|
+
c2cciutils-docker-logs=c2cciutils.scripts.docker_logs:main
|
|
4
|
+
c2cciutils-env=c2cciutils.scripts.env:main
|
|
5
|
+
c2cciutils-k8s-db=c2cciutils.scripts.k8s.db:main
|
|
6
|
+
c2cciutils-k8s-install=c2cciutils.scripts.k8s.install:main
|
|
7
|
+
c2cciutils-k8s-logs=c2cciutils.scripts.k8s.logs:main
|
|
8
|
+
c2cciutils-k8s-wait=c2cciutils.scripts.k8s.wait:main
|
|
9
|
+
|