You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
=== Prefetching `pip` dependencies from custom index servers
219
+
=== [[custom-index-servers]]Prefetching `pip` dependencies from custom index servers
220
220
221
221
Cachi2 supports the link:https://pip.pypa.io/en/stable/cli/pip_install/#install-index-url[--index-url] option.
222
222
You can add this option to your `requirements.txt` file(s), instructing Cachi2 to download packages from the specified
@@ -232,43 +232,8 @@ requests==2.32.2 \
232
232
# ...other packages
233
233
----
234
234
235
-
WARNING: Do not include credentials in the index url. If needed, provide authentication through a `.netrc` file (as described below).
236
-
237
-
To provide `.netrc` authentication for the index server:
238
-
239
-
. Create a key/value secret (see xref:/how-tos/configuring/creating-secrets.adoc[creating secrets for your builds]).
240
-
Set `.netrc` as the key. Upload the content of your `.netrc` file as the value. For more details on netrc files,
241
-
review the link:https://pip.pypa.io/en/stable/topics/authentication/#netrc-support[pip documentation for netrc support].
242
-
243
-
. In your `.tekton/` PipelineRun files, add the newly created secret to the `.spec.workspaces` section:
244
-
245
-
+
246
-
[source,yaml]
247
-
----
248
-
spec:
249
-
# ...
250
-
workspaces:
251
-
# ...
252
-
- name: netrc
253
-
secret:
254
-
secretName: my-netrc # the name you assigned to the secret in step 1
255
-
----
256
-
257
-
. In the `.spec.pipelineSpec.tasks` section, find the entry with `name: prefetch-dependencies`.
258
-
Add the `netrc` workspace to the list of workspaces (if not present):
259
-
260
-
+
261
-
[source,yaml]
262
-
----
263
-
tasks:
264
-
# ...
265
-
- name: prefetch-dependencies
266
-
# ...
267
-
workspaces:
268
-
# ...
269
-
- name: netrc
270
-
workspace: netrc
271
-
----
235
+
WARNING: Do not include credentials in the index URL. If needed, provide authentication through a `.netrc` file (as described xref:netrc[below]).
236
+
For more pip-specific details on netrc files, review the link:https://pip.pypa.io/en/stable/topics/authentication/#netrc-support[pip documentation for netrc support].
272
237
273
238
== [[npm]]Enabling prefetch builds for `npm`
274
239
Cachi2 supports `npm` by fetching any dependencies you declare in your `package.json` and `package-lock.json` project files. The npm CLI manages the `package-lock.json` file automatically, and Cachi2 fetches any dependencies and enables your build to install them without network access.
@@ -499,6 +464,48 @@ In {ProductName}, from the *Applications* view, select the application build you
499
464
* Select the *Logs* tab.
500
465
* Alternatively, you can click *build-container*. When the right panel opens, select the *Logs* tab to see a partial view of the log for that build.
501
466
467
+
== [[netrc]]Creating the netrc secret
468
+
469
+
The `prefetch-dependencies` task supports link:https://everything.curl.dev/usingcurl/netrc.html[.netrc] files for authentication.
470
+
For example, it is useful for:
471
+
472
+
* xref:custom-index-servers[pip packages from private index servers]
473
+
474
+
To create a netrc Secret for use in your pipelines:
475
+
476
+
. Create the `.netrc` file locally. See the link:https://everything.curl.dev/usingcurl/netrc.html[.netrc] docs for more details on the file format.
477
+
. Create a key/value secret (see xref:/how-tos/configuring/creating-secrets.adoc[creating secrets for your builds]).
478
+
Set `.netrc` as the key. Upload the content of your `.netrc` file as the value.
479
+
. In your `.tekton/` PipelineRun files, add the newly created secret to the `.spec.workspaces` section:
480
+
481
+
+
482
+
[source,yaml]
483
+
----
484
+
spec:
485
+
# ...
486
+
workspaces:
487
+
# ...
488
+
- name: netrc
489
+
secret:
490
+
secretName: my-netrc # the name you assigned to the secret in step 2
491
+
----
492
+
493
+
. In the `.spec.pipelineSpec.tasks` section, find the entry with `name: prefetch-dependencies`.
494
+
Add the `netrc` workspace to the list of workspaces (if not present):
495
+
496
+
+
497
+
[source,yaml]
498
+
----
499
+
tasks:
500
+
# ...
501
+
- name: prefetch-dependencies
502
+
# ...
503
+
workspaces:
504
+
# ...
505
+
- name: netrc
506
+
workspace: netrc
507
+
----
508
+
502
509
== Additional resources
503
510
504
511
* To troubleshoot any issues you might experience when you enable prefetch builds for `pip` or `pip` with source dependencies, see link:https://github.com/containerbuildsystem/cachi2/blob/main/docs/pip.md#troubleshooting[Troubleshooting].
0 commit comments