Skip to content

Red Hat Konflux kflux-prd-rh03 update task-build-npm-package - #303

Open
red-hat-konflux-kflux-prd-rh03[bot] wants to merge 1 commit into
mainfrom
konflux-task-build-npm-package
Open

Red Hat Konflux kflux-prd-rh03 update task-build-npm-package#303
red-hat-konflux-kflux-prd-rh03[bot] wants to merge 1 commit into
mainfrom
konflux-task-build-npm-package

Conversation

@red-hat-konflux-kflux-prd-rh03

@red-hat-konflux-kflux-prd-rh03 red-hat-konflux-kflux-prd-rh03 Bot commented Jun 22, 2026

Copy link
Copy Markdown
Contributor

Pipelines as Code configuration proposal

To start the PipelineRun, add a new comment with content /ok-to-test

For more detailed information about running a PipelineRun, please refer to Pipelines as Code documentation Running the PipelineRun

To customize the proposed PipelineRuns after merge, please refer to Build Pipeline customization

Please follow the block sequence indentation style introduced by the proprosed PipelineRuns YAMLs, or keep using consistent indentation level through your customized PipelineRuns. When different levels are mixed, it will be changed to the proposed style.

Summary by Sourcery

Add Tekton PipelineRun definitions to build and scan the task-build-npm-package image for pull requests and pushes to main.

New Features:

  • Introduce a pull-request PipelineRun that builds the task-build-npm-package image with ephemeral tagging and optional SAST checks.
  • Introduce a push PipelineRun that builds and tags the task-build-npm-package image on main branch updates, including image index creation and security checks.

Signed-off-by: red-hat-konflux-kflux-prd-rh03 <konflux@no-reply.konflux-ci.dev>
@sourcery-ai

sourcery-ai Bot commented Jun 22, 2026

Copy link
Copy Markdown

Reviewer's Guide

Adds two Konflux Pipelines-as-Code Tekton PipelineRun definitions for the task-build-npm-package component, one triggered on pull requests to main and one on pushes to main, wiring together standard Konflux catalog tasks to clone the repo, prefetch dependencies, build and index a container image, run SAST checks, and apply tags, with appropriate metadata, parameters, and workspaces.

File-Level Changes

Change Details Files
Introduce a pull-request-triggered PipelineRun for building the task-build-npm-package image with temporary, expiring tags.
  • Create a PipelineRun spec that triggers via Pipelines-as-Code on pull_request events targeting main with cancel-in-progress enabled and limited run retention.
  • Define build parameters (git-url, revision, output-image, image-expires-after, dockerfile, path-context, cache/proxy and SAST-related options) and wire them into the pipelineSpec.
  • Compose a task graph using Konflux catalog bundle tasks for init, git clone via OCI, dependency prefetch via OCI, image build via tkn-bundle, image index creation, SAST shell/unicode checks conditioned on skip-checks, and apply-tags.
  • Configure workspaces and serviceAccountName and set the output image naming convention to on-pr- with a short expiration time.
.tekton/task-build-npm-package-pull-request.yaml
Introduce a push-triggered PipelineRun for building and tagging the task-build-npm-package image on main branch updates.
  • Create a PipelineRun spec that triggers via Pipelines-as-Code on push events to main with cancel-in-progress disabled and limited run retention.
  • Define build parameters similar to the pull-request pipeline but without an explicit image expiration and with a non-expiring output image tag based on revision.
  • Reuse the same Konflux catalog task chain (init, git clone OCI, dependency prefetch OCI, build container, build image index, conditional SAST checks, apply-tags) configured for push builds.
  • Configure workspaces and serviceAccountName and set metadata labels/annotations for integration with AppStudio/Build/App signing chains.
.tekton/task-build-npm-package-push.yaml

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@sourcery-ai sourcery-ai Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hey - I've found 2 issues, and left some high level feedback:

  • The pull-request and push PipelineRun YAMLs are almost identical; consider factoring out the common pipelineSpec into a reusable template or referencing a shared Pipeline to reduce duplication and the risk of the two diverging unintentionally.
  • Several params defined in pipelineSpec (e.g., dockerfile, hermetic, build-source-image) are not actually passed into any tasks; either wire these through to the relevant tasks or remove them to avoid confusion about their effect.
Prompt for AI Agents
Please address the comments from this code review:

## Overall Comments
- The pull-request and push PipelineRun YAMLs are almost identical; consider factoring out the common `pipelineSpec` into a reusable template or referencing a shared Pipeline to reduce duplication and the risk of the two diverging unintentionally.
- Several params defined in `pipelineSpec` (e.g., `dockerfile`, `hermetic`, `build-source-image`) are not actually passed into any tasks; either wire these through to the relevant tasks or remove them to avoid confusion about their effect.

## Individual Comments

### Comment 1
<location path=".tekton/task-build-npm-package-pull-request.yaml" line_range="53-62" />
<code_context>
+        1h, 2d, 3w for hours, days, and weeks, respectively.
+      name: image-expires-after
+      type: string
+    - default: "false"
+      description: Build a source image.
+      name: build-source-image
+      type: string
+    - default: "false"
+      description: Add built image into an OCI image index
+      name: build-image-index
+      type: string
+    - default: "false"
+      description: Enable cache proxy configuration
+      name: enable-cache-proxy
+    - default: "true"
+      description: Use the package registry proxy when prefetching dependencies
</code_context>
<issue_to_address>
**suggestion:** The `enable-cache-proxy` param is missing an explicit `type`, unlike the other params.

`enable-cache-proxy` (and the equivalent in the push manifest) doesn’t declare `type: string` like the other params, and Tekton v1 generally expects an explicit type. Please add `type: string` here (and to `enable-package-registry-proxy` for consistency), unless there’s a deliberate reason to rely on the implicit default.

Suggested implementation:

```
    - default: "false"
      description: Enable cache proxy configuration
      name: enable-cache-proxy
      type: string
    - default: "true"
      description: Use the package registry proxy when prefetching dependencies
      name: enable-package-registry-proxy
      type: string

```

You mentioned an equivalent parameter in the push manifest. To keep behavior consistent, apply the same `type: string` addition to `enable-cache-proxy` and `enable-package-registry-proxy` (or their equivalents) in the push task YAML (likely something like `.tekton/task-build-npm-package.yaml` or similar) using the same pattern.
</issue_to_address>

### Comment 2
<location path=".tekton/task-build-npm-package-push.yaml" line_range="121-122" />
<code_context>
+        value: $(params.revision)
+      - name: ociStorage
+        value: $(params.output-image).git
+      - name: ociArtifactExpiresAfter
+        value: $(params.image-expires-after)
+      runAfter:
+      - init
</code_context>
<issue_to_address>
**issue (bug_risk):** The push PipelineRun never sets `image-expires-after`, so OCI artifacts may not expire as intended.

`image-expires-after` is declared in `pipelineSpec.params` and used for `ociArtifactExpiresAfter` in `clone-repository` and `prefetch-dependencies`, but the PipelineRun’s top-level `spec.params` doesn’t set it. This leaves it as an empty string, which usually means no expiration. Since the pull-request PipelineRun sets `image-expires-after: 5d`, consider adding a corresponding `image-expires-after` value to the push PipelineRun `spec.params` to ensure push artifacts expire as intended.
</issue_to_address>

Sourcery is free for open source - if you like our reviews please consider sharing them ✨
Help me be more useful! Please click 👍 or 👎 on each comment and I'll use the feedback to improve your reviews.

Comment on lines +53 to +62
- default: "false"
description: Skip checks against built image
name: skip-checks
type: string
- default: "false"
description: Execute the build with network isolation
name: hermetic
type: string
- default: ""
description: Build dependencies to be prefetched

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

suggestion: The enable-cache-proxy param is missing an explicit type, unlike the other params.

enable-cache-proxy (and the equivalent in the push manifest) doesn’t declare type: string like the other params, and Tekton v1 generally expects an explicit type. Please add type: string here (and to enable-package-registry-proxy for consistency), unless there’s a deliberate reason to rely on the implicit default.

Suggested implementation:

    - default: "false"
      description: Enable cache proxy configuration
      name: enable-cache-proxy
      type: string
    - default: "true"
      description: Use the package registry proxy when prefetching dependencies
      name: enable-package-registry-proxy
      type: string

You mentioned an equivalent parameter in the push manifest. To keep behavior consistent, apply the same type: string addition to enable-cache-proxy and enable-package-registry-proxy (or their equivalents) in the push task YAML (likely something like .tekton/task-build-npm-package.yaml or similar) using the same pattern.

Comment on lines +121 to +122
- name: ociArtifactExpiresAfter
value: $(params.image-expires-after)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

issue (bug_risk): The push PipelineRun never sets image-expires-after, so OCI artifacts may not expire as intended.

image-expires-after is declared in pipelineSpec.params and used for ociArtifactExpiresAfter in clone-repository and prefetch-dependencies, but the PipelineRun’s top-level spec.params doesn’t set it. This leaves it as an empty string, which usually means no expiration. Since the pull-request PipelineRun sets image-expires-after: 5d, consider adding a corresponding image-expires-after value to the push PipelineRun spec.params to ensure push artifacts expire as intended.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

0 participants