Skip to content

Commit

Permalink
prefetching-dependencies: Add one shared procedure section
Browse files Browse the repository at this point in the history
Signed-off-by: Michal Šoltis <[email protected]>
  • Loading branch information
slimreaper35 committed Jan 3, 2025
1 parent 1c87d66 commit 714e944
Showing 1 changed file with 48 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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": "<package_manager>", "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": "<package_manager>", "path": "."}, {"type": "<package_manager>", "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*.
Expand Down

0 comments on commit 714e944

Please sign in to comment.