Commit 8e9a9ce
authored
feat: build from private repositories (#1250)
* feat: add private image prefix to config
* feat(repositories/db): add token getter
This will be used to create the secret allowing
Shipwright to create images out of private repositories.
* feat(session/models): add authentication secret
This will allow to pass authentication information to
the Shipwright client for private repositories.
* feat(session/k8s_client): implement support for clone secret
When getting an authentication secret in the parameter, the
client will now:
- create a secret for the BuildRun
- configure the BuildRun to use it
- patch the secret to be owned by the BuildRun object
The last one ensures that the secret is delete alongside
the BuildRun object.
Behaviour change: the BuildRun object is refreshed so that
the cache will contain its UID which is mandatory for the
ownership setup.
* feat(session/db): implement repo visibility check and token retrieval
Now retrieving the build parameter will include the token
for private repositories.
* feat(session/constants): update default buildstragy to v3
It's the name of the current strategy in components/renku_pack_builder.
* refactor(test): allow reuse of existing cluster in tests
This allows to reduce testing time with regard to cluster
creation and setup.
* feat(test): add optional Shipwright setup
This allows to run tests that will create BuildRun objects.
* feat(test): implement support for real Shipwright client
This will allow to run tests as they are currently as well
as with Shipwright deployed.
* refactor(test_sessions): update tests for builds
They now can run with and without builds activated.
Note: nothing will get pushed nor will BuildRun succeed
to finish. The goal is to ensure that thing are properly
working from an object creation point of view.
* refactor(k8s/client): cache object once created
Currently the cache is populated before the object is
created and the entry is deleted if creation failed.
This has two drawbacks:
- requires two operations to the cache that might fail
- does not store the latest version of the object if
refresh is true
For the latter, a third call could be done to update the
cache content but it's sub-optimal.
An up to date cache content is required for the support of
setting the owner references of the clone secret for BuildRuns
that must manage private repositories.
* feat(session): push images from private repo to a different registry
This allows to cleanly separate were both set of images are
stored.
* refactor(test/session): add BuildRun validation
These checks ensure that the BuildRun objects are:
- Using the proper registry to push to
- Get the secret for private builds
* refactor(session/db): better handling of union return types
* fix(test/utils): improve fake get_repository return
- "/some/repo" now returns a GitUrlError
- Not managed cases calls base class implementation
* refactor(test/utils): only use FakeGitRepositoriesRepository when testing builds
* refactor(k8s/client): change create back to almost original implementation
The optimization done somehow breaks information retrieval
during test with getting duplicated entries in some tests.
Revert back to the original implementation but with added
cache update when object refresh is requested.
* fix(test): move cluster-creation option handling in main conftest
* refactor(test/sessions): move BuildRun content check behind feature check
* fix: add "sessions" marker to pyproject.toml
This addresses a warning from pytest
* feat: ensure kind configuration file is test run specific
* fix(session/db): add missing parameter to make_session_environment_repo
* refactor(test): rename class starting with Test
They are detected by pytest as potential tests cases
although they are only helpers.
Renaming fixes the associated warning.
* fix(builds): add missing secret annotation for Shipwright
* refactor: port deprecated Config use to model_config
This fixes all the pydantic warnings and makes the
code base consistant.
* feat: add configuration for push secret for private registry
* fix(test): make DummyAuthenticator return a AuthenticatedAPIUser
This matches the behaviour of real authenticator
* feat(notebooks): add check based on build parameters
Ensure, when a session start, that if an image is from
a built environment, the image source repository is
contained in the list of repositories from the project.
* feat(test): fix and implement session start tests
* feat(builds): add repo accessibility check when starting a session
Ensure that the user has pull access from the repository when
starting a session that was built.
Visibility is not enough as for example in the case of GitLab,
a user can have access to the code in GitLab but is not allowed
to clone the repository.
See https://docs.gitlab.com/user/permissions/ and more specifically
the guest role.
* chore(tests): fix tuple deprecation warnings from SQLAlchemy
* refactor(DummyAuthenticator): return an empty APIUser in case of missing id
This distinguishes between a successful and a failed authentication
attempt vs an anonymous user.
* chore(test): fix handling of parametrize arguments
* feat(crc): make the config file pattern more flexible
While containing yaml, k8s config files do not end with
.yaml by default so if testing with a local cluster, the
tests will fail.
* fix(tests): fix authorisation headers for resource pool creation1 parent fe542a9 commit 8e9a9ce
51 files changed
Lines changed: 951 additions & 335 deletions
File tree
- bases/renku_data_services/data_api
- components/renku_data_services
- authn
- capacity_reservation
- connected_services
- crc
- data_connectors
- k8s
- namespace
- notebooks
- oci
- notifications
- platform
- project
- repositories
- resource_usage
- search
- secrets
- session
- storage
- users
- test
- bases/renku_data_services/data_api
- components/renku_data_services
- connected_services
- resource_usage
- search
- users
Some content is hidden
Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
221 | 221 | | |
222 | 222 | | |
223 | 223 | | |
| 224 | + | |
224 | 225 | | |
225 | 226 | | |
226 | 227 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | | - | |
295 | 294 | | |
296 | 295 | | |
297 | 296 | | |
| |||
342 | 341 | | |
343 | 342 | | |
344 | 343 | | |
| 344 | + | |
| 345 | + | |
| 346 | + | |
| 347 | + | |
| 348 | + | |
| 349 | + | |
| 350 | + | |
| 351 | + | |
345 | 352 | | |
346 | 353 | | |
347 | 354 | | |
348 | 355 | | |
349 | 356 | | |
350 | 357 | | |
| 358 | + | |
351 | 359 | | |
352 | 360 | | |
353 | 361 | | |
| |||
378 | 386 | | |
379 | 387 | | |
380 | 388 | | |
381 | | - | |
382 | | - | |
383 | | - | |
384 | | - | |
385 | | - | |
386 | | - | |
387 | 389 | | |
388 | 390 | | |
389 | 391 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
46 | 46 | | |
47 | 47 | | |
48 | 48 | | |
| 49 | + | |
49 | 50 | | |
50 | 51 | | |
51 | 52 | | |
| |||
60 | 61 | | |
61 | 62 | | |
62 | 63 | | |
63 | | - | |
64 | | - | |
65 | | - | |
66 | | - | |
67 | | - | |
68 | | - | |
69 | | - | |
70 | | - | |
| 64 | + | |
| 65 | + | |
71 | 66 | | |
72 | | - | |
| 67 | + | |
73 | 68 | | |
74 | | - | |
| 69 | + | |
75 | 70 | | |
76 | | - | |
77 | | - | |
78 | | - | |
79 | | - | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
80 | 75 | | |
81 | 76 | | |
82 | 77 | | |
Lines changed: 5 additions & 5 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
5 | | - | |
| 5 | + | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | 11 | | |
12 | | - | |
13 | | - | |
14 | | - | |
15 | | - | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
16 | 16 | | |
17 | 17 | | |
18 | 18 | | |
| |||
Lines changed: 8 additions & 14 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
25 | 25 | | |
26 | 26 | | |
27 | 27 | | |
28 | | - | |
29 | | - | |
30 | | - | |
31 | | - | |
| 28 | + | |
32 | 29 | | |
33 | 30 | | |
34 | 31 | | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | | - | |
40 | | - | |
41 | | - | |
42 | | - | |
| 36 | + | |
43 | 37 | | |
44 | 38 | | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
250 | 250 | | |
251 | 251 | | |
252 | 252 | | |
| 253 | + | |
| 254 | + | |
253 | 255 | | |
254 | 256 | | |
255 | 257 | | |
| |||
264 | 266 | | |
265 | 267 | | |
266 | 268 | | |
267 | | - | |
| 269 | + | |
268 | 270 | | |
269 | 271 | | |
270 | 272 | | |
| |||
301 | 303 | | |
302 | 304 | | |
303 | 305 | | |
304 | | - | |
| 306 | + | |
305 | 307 | | |
306 | 308 | | |
307 | 309 | | |
| |||
338 | 340 | | |
339 | 341 | | |
340 | 342 | | |
341 | | - | |
| 343 | + | |
342 | 344 | | |
343 | 345 | | |
344 | 346 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
3 | 3 | | |
4 | 4 | | |
5 | 5 | | |
6 | | - | |
| 6 | + | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
| |||
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
15 | | - | |
16 | | - | |
17 | | - | |
18 | | - | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
19 | 19 | | |
20 | 20 | | |
21 | 21 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
8 | 8 | | |
9 | 9 | | |
10 | 10 | | |
11 | | - | |
| 11 | + | |
12 | 12 | | |
13 | 13 | | |
14 | 14 | | |
| |||
28 | 28 | | |
29 | 29 | | |
30 | 30 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
| 31 | + | |
35 | 32 | | |
36 | 33 | | |
37 | 34 | | |
38 | 35 | | |
39 | 36 | | |
40 | | - | |
41 | | - | |
| 37 | + | |
42 | 38 | | |
43 | 39 | | |
44 | 40 | | |
| |||
61 | 57 | | |
62 | 58 | | |
63 | 59 | | |
64 | | - | |
65 | | - | |
| 60 | + | |
66 | 61 | | |
67 | 62 | | |
68 | 63 | | |
| |||
84 | 79 | | |
85 | 80 | | |
86 | 81 | | |
87 | | - | |
88 | | - | |
89 | | - | |
90 | | - | |
| 82 | + | |
91 | 83 | | |
92 | 84 | | |
93 | 85 | | |
| |||
Lines changed: 6 additions & 6 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | | - | |
| 3 | + | |
4 | 4 | | |
5 | 5 | | |
6 | 6 | | |
7 | 7 | | |
8 | 8 | | |
9 | 9 | | |
10 | | - | |
11 | | - | |
12 | | - | |
13 | | - | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
14 | 13 | | |
15 | 14 | | |
16 | | - | |
| 15 | + | |
| 16 | + | |
17 | 17 | | |
18 | 18 | | |
19 | 19 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
346 | 346 | | |
347 | 347 | | |
348 | 348 | | |
| 349 | + | |
349 | 350 | | |
350 | 351 | | |
351 | 352 | | |
352 | 353 | | |
353 | 354 | | |
354 | 355 | | |
355 | 356 | | |
| 357 | + | |
| 358 | + | |
| 359 | + | |
| 360 | + | |
356 | 361 | | |
357 | 362 | | |
358 | 363 | | |
| |||
0 commit comments