From 714e94402aaa339e5d7529d962ad8468e292395b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Michal=20=C5=A0oltis?= Date: Fri, 3 Jan 2025 10:20:36 +0100 Subject: [PATCH] prefetching-dependencies: Add one shared procedure section MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Michal Ĺ oltis --- .../configuring/prefetching-dependencies.adoc | 48 +++++++++++++++++++ 1 file changed, 48 insertions(+) diff --git a/docs/modules/ROOT/pages/how-tos/configuring/prefetching-dependencies.adoc b/docs/modules/ROOT/pages/how-tos/configuring/prefetching-dependencies.adoc index 756f6a2a..9b7dceac 100644 --- a/docs/modules/ROOT/pages/how-tos/configuring/prefetching-dependencies.adoc +++ b/docs/modules/ROOT/pages/how-tos/configuring/prefetching-dependencies.adoc @@ -448,6 +448,54 @@ spec: ---- <1> The `*prefetch-input*` parameter specifies the path to the directory that has the lockfile. In this example, the `.` indicates that the lockfile is in the repository root. Additionally, if you have multiple directories, you can provide the path to those directories in the JSON array format. For example, `[{"path": ".", "type": "generic"}, {"path": "subpath/to/the/other/directory", "type": "generic"}]`. Alternatively, if your lockfile is generated as part of your pipeline and is not commited to the repository, you can specify an absolute path to it, like this: `{"type": "generic", "path": ".", "lockfile": "/absolute/path/to/artifacts.lock.yaml"}`. +== Procedure +To prefetch dependencies for a component build, complete the following steps: + +. Go to the `.tekton` directory and find the `.yaml` files related to the `*pull request*` and `*push*` processes. + +. Configure the hermetic pipeline by adding the following parameters in both `.yaml` files: + ++ +[source,yaml] +---- +pipelineSpec: + params: + ... + - name: hermetic + type: string + description: Execute the build with network isolation + default: "true" +---- + ++ +[source,yaml] +---- +spec: + params: + ... + - name: prefetch-input + value: '{"type": "", "path": "."}' <1> +---- +NOTE: The prefetch-input parameter specifies the path to the directory of the project. In this example, the `.` indicates the repository root. If you have multiple directories, you can provide the path to those directories in the JSON array format: `[{"type": "", "path": "."}, {"type": "", "path": "subpath/to/the/other/directory"}]`. + +. Additionally, pass an extra parameter to the `prefetch-dependencies` task in the `spec.pipelineSpec.tasks` section to indicate that "dev package managers" should be enabled. + ++ +[source,yaml] +---- +tasks: + ... + - name: prefetch-dependencies + params: + ... + - name: dev-package-managers + value: "true" +---- +NOTE: You won't find `dev-package-managers` as a param on the `prefetch-dependencies` task. You have to add it, and set it to true. This is because Cachi2 hasn't declared stable support for the feature yet. Use it at your own risk. + +. Create a pull request by committing your changes to the repository of the component. + +. Review and merge the pull request. == Verification * From the {ProductName} *Applications* view, go to *Activity > Pipeline runs*.