Skip to content

Commit 71df9a6

Browse files
committed
prefetch: extract netrc docs into separate section
The procedure for creating netrc secrets will be relevant for Go as well Signed-off-by: Adam Cmiel <[email protected]>
1 parent 442aad1 commit 71df9a6

File tree

1 file changed

+45
-38
lines changed

1 file changed

+45
-38
lines changed

docs/modules/ROOT/pages/how-tos/configuring/prefetching-dependencies.adoc

Lines changed: 45 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ spec:
216216
* From the {ProductName} *Applications* view, go to *Activity > Latest commits*.
217217
//include::../partials/con_hermetic_verification.adoc[]
218218

219-
=== Prefetching `pip` dependencies from custom index servers
219+
=== [[custom-index-servers]]Prefetching `pip` dependencies from custom index servers
220220

221221
Cachi2 supports the link:https://pip.pypa.io/en/stable/cli/pip_install/#install-index-url[--index-url] option.
222222
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 \
232232
# ...other packages
233233
----
234234

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].
272237

273238
== [[npm]]Enabling prefetch builds for `npm`
274239
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
499464
* Select the *Logs* tab.
500465
* 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.
501466

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+
502509
== Additional resources
503510

504511
* 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

Comments
 (0)