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
Some container builds may use parent images from registries that require authentication, for example, `registry.redhat.io`. Until these credentials have been configured, the builds will continue to fail due to the system being unable to pull the required images.
=== [[go-private]]Prefetching Go modules from private repos
72
+
73
+
To enable downloading modules from private repos, Go supports authentication via `.netrc`.
74
+
You can create a netrc Secret for your pipeline as described xref:netrc[below].
75
+
For more Go-specific `.netrc` details, see link:https://go.dev/doc/faq#git_https[the Go docs].
76
+
71
77
== [[pip]]Enabling prefetch builds for `pip`
72
78
Cachi2 supports pip by parsing of `pip` requirements files, including but not limited to, `requirements.txt` files placed in the root of your repository. By generically parsing `pip` requirements files, Cachi2 downloads the specified dependencies.
73
79
@@ -216,7 +222,7 @@ spec:
216
222
* From the {ProductName} *Applications* view, go to *Activity > Latest commits*.
=== Prefetching `pip` dependencies from custom index servers
225
+
=== [[custom-index-servers]]Prefetching `pip` dependencies from custom index servers
220
226
221
227
Cachi2 supports the link:https://pip.pypa.io/en/stable/cli/pip_install/#install-index-url[--index-url] option.
222
228
You can add this option to your `requirements.txt` file(s), instructing Cachi2 to download packages from the specified
@@ -232,43 +238,8 @@ requests==2.32.2 \
232
238
# ...other packages
233
239
----
234
240
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
-
----
241
+
WARNING: Do not include credentials in the index URL. If needed, provide authentication through a `.netrc` file (as described xref:netrc[below]).
242
+
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
243
273
244
== [[npm]]Enabling prefetch builds for `npm`
274
245
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 +470,49 @@ In {ProductName}, from the *Applications* view, select the application build you
499
470
* Select the *Logs* tab.
500
471
* 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
472
473
+
== [[netrc]]Creating the netrc secret
474
+
475
+
The `prefetch-dependencies` task supports link:https://everything.curl.dev/usingcurl/netrc.html[.netrc] files for authentication.
476
+
For example, it is useful for:
477
+
478
+
* xref:custom-index-servers[pip packages from private index servers]
479
+
* xref:go-private[Go modules from private repos]
480
+
481
+
To create a netrc Secret for use in your pipelines:
482
+
483
+
. Create the `.netrc` file locally. See the link:https://everything.curl.dev/usingcurl/netrc.html[.netrc] docs for more details on the file format.
484
+
. Create a key/value secret (see xref:/how-tos/configuring/creating-secrets.adoc[creating secrets for your builds]).
485
+
Set `.netrc` as the key. Upload the content of your `.netrc` file as the value.
486
+
. In your `.tekton/` PipelineRun files, add the newly created secret to the `.spec.workspaces` section:
487
+
488
+
+
489
+
[source,yaml]
490
+
----
491
+
spec:
492
+
# ...
493
+
workspaces:
494
+
# ...
495
+
- name: netrc
496
+
secret:
497
+
secretName: my-netrc # the name you assigned to the secret in step 2
498
+
----
499
+
500
+
. In the `.spec.pipelineSpec.tasks` section, find the entry with `name: prefetch-dependencies`.
501
+
Add the `netrc` workspace to the list of workspaces (if not present):
502
+
503
+
+
504
+
[source,yaml]
505
+
----
506
+
tasks:
507
+
# ...
508
+
- name: prefetch-dependencies
509
+
# ...
510
+
workspaces:
511
+
# ...
512
+
- name: netrc
513
+
workspace: netrc
514
+
----
515
+
502
516
== Additional resources
503
517
504
518
* 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