Skip to content

Conversation

@lingyzhuang
Copy link
Contributor

@lingyzhuang lingyzhuang commented Jul 2, 2025

  1. Add integration for TAS
  2. Move tssc-tas chart in front of tssc-pipelines
  3. Update value of transparency.url to the value of rekor_url in integration secret tssc-tas-integration

Jira: RHTAP-5258

Summary by CodeRabbit

  • New Features

    • The transparency URL used by pipelines is now dynamically configurable via a Kubernetes Secret, allowing for easier customization without code changes.
  • Chores

    • Updated the order of dependencies in the configuration to improve deployment sequencing.

@lingyzhuang lingyzhuang requested a review from Roming22 July 2, 2025 15:06
@openshift-ci openshift-ci bot requested review from jkopriva and prietyc123 July 2, 2025 15:06
@lingyzhuang lingyzhuang requested review from otaviof and removed request for jkopriva and prietyc123 July 2, 2025 15:06
@coderabbitai
Copy link

coderabbitai bot commented Jul 2, 2025

Walkthrough

The updates modify the TektonConfig Helm template to dynamically set the transparency.url from a Kubernetes Secret if present, otherwise leaving it empty. Additionally, the tssc-tas chart dependency order is changed in the configuration file without altering any chart properties or flags.

Changes

File(s) Change Summary
installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl Helm template updated to set spec.chain.transparency.url dynamically from a Secret's decoded rekor_url.
installer/config.yaml Adjusted order of tssc-tas in the dependencies list; no changes to chart properties or enabled flags.

Poem

In the warren of charts, a secret’s revealed,
A URL now fetched, not statically sealed.
Dependencies shuffled, a hop to the left,
Helm templates adapt, with secrets bereft.
With paws on the YAML, this bunny delights—
Dynamic and nimble, the pipeline ignites!
🐇✨


📜 Recent review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between ce64e0c and c7bb9c0.

📒 Files selected for processing (2)
  • installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl (2 hunks)
  • installer/config.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (2)
  • installer/config.yaml
  • installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Red Hat Konflux / rhtap-cli-on-pull-request

🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 0

🧹 Nitpick comments (2)
pkg/integrations/tas.go (2)

43-46: Inconsistent logging behavior for sensitive data.

The logger logs the actual rekorURL value but only the length of tufURL. For consistency and security, consider logging the length for both URLs or use a consistent approach for sensitive data logging.

func (t *TASIntegration) log() *slog.Logger {
	return t.logger.With(
		"force", t.force,
-		"rekor-url", t.rekorURL,
-		"tuf-url", len(t.tufURL),
+		"rekor-url", len(t.rekorURL),
+		"tuf-url", len(t.tufURL),
	)
}

54-62: Consider more robust URL validation.

The current validation only checks for the presence of :// which is minimal. Consider validating that the URLs are well-formed and use expected protocols (http/https).

+import "net/url"

func (t *TASIntegration) Validate() error {
	if t.rekorURL == "" {
		return fmt.Errorf("rekor-url is required")
	}
-	if !strings.Contains(t.rekorURL, "://") {
-		return fmt.Errorf("invalid rekor url, the protocol should be specified")
+	if _, err := url.Parse(t.rekorURL); err != nil {
+		return fmt.Errorf("invalid rekor url: %w", err)
	}
	if t.tufURL == "" {
		return fmt.Errorf("tuf url is required")
	}
-	if !strings.Contains(t.tufURL, "://") {
-		return fmt.Errorf("invalid tuf url, the protocol should be specified")
+	if _, err := url.Parse(t.tufURL); err != nil {
+		return fmt.Errorf("invalid tuf url: %w", err)
	}
	return nil
}
📜 Review details

Configuration used: CodeRabbit UI
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between effdd7d and acb5473.

📒 Files selected for processing (5)
  • installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl (2 hunks)
  • installer/config.yaml (1 hunks)
  • pkg/integrations/tas.go (1 hunks)
  • pkg/subcmd/integration.go (1 hunks)
  • pkg/subcmd/integration_tas.go (1 hunks)
🧰 Additional context used
🧬 Code Graph Analysis (2)
pkg/subcmd/integration.go (2)
pkg/subcmd/runner.go (1)
  • NewRunner (17-28)
pkg/subcmd/integration_tas.go (1)
  • NewIntegrationTAS (64-87)
pkg/integrations/tas.go (4)
pkg/k8s/kube.go (1)
  • Kube (20-22)
pkg/config/manager.go (1)
  • Name (26-26)
pkg/k8s/secret.go (2)
  • SecretExists (27-40)
  • DeleteSecret (43-54)
pkg/integrations/common.go (1)
  • ErrSecretAlreadyExists (8-8)
⏰ Context from checks skipped due to timeout of 90000ms (1)
  • GitHub Check: Red Hat Konflux / rhtap-cli-on-pull-request
🔇 Additional comments (11)
pkg/integrations/tas.go (3)

80-87: Good design with lazy secret name generation.

The lazy generation of the secret name ensures configuration is loaded before use. The hardcoded secret name "tssc-tas-integration" correctly matches the template consumption.


89-111: Proper secret existence handling with force flag support.

The logic correctly handles existing secrets with appropriate error messaging and force flag behavior. The error wrapping with ErrSecretAlreadyExists follows the established pattern from pkg/integrations/common.go.


113-145: Secure secret storage implementation.

The secret creation follows Kubernetes best practices with proper type annotation, namespace assignment, and binary data encoding. The logging provides good observability without exposing sensitive data.

installer/config.yaml (1)

76-78: Logical dependency reordering for TAS integration.

Moving tssc-tas before tssc-pipelines ensures the TAS integration secret is available when the pipeline template references it. This aligns with the dynamic configuration changes in the Tekton template.

pkg/subcmd/integration.go (1)

25-25: Consistent integration command registration.

The TAS integration subcommand follows the established pattern and maintains proper alphabetical ordering in the command list.

installer/charts/tssc-pipelines/templates/tektonconfig/patch._tpl (2)

2-7: Robust dynamic configuration with proper fallbacks.

The template correctly uses Helm's lookup function to dynamically read the rekor_url from the TAS integration secret, with proper base64 decoding and graceful handling of missing secrets or data fields.


18-18: Appropriate fallback URL for missing secret.

The fallback URL http://rekor-server.tssc-tas.svc provides a reasonable default that matches the expected service naming convention when the integration secret is not available.

pkg/subcmd/integration_tas.go (4)

27-27: Proper interface compliance verification.

The compile-time interface check ensures IntegrationTAS correctly implements the Interface contract, following Go best practices.


29-35: Clear and informative command description.

The long description properly explains the command's purpose, credential storage mechanism, and target namespace, providing users with sufficient context.


42-60: Standard subcommand lifecycle implementation.

The Complete/Validate/Run pattern follows the established convention with proper error handling and context propagation. The namespace creation before secret management is a good defensive practice.


64-87: Well-structured constructor with proper dependency injection.

The constructor properly initializes all dependencies, sets up the Cobra command with appropriate metadata, and correctly binds the integration's persistent flags.

Copy link
Member

@Roming22 Roming22 left a comment

Choose a reason for hiding this comment

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

The work on the integration might now be obsolete because of the cli focusing on demos/PoCs, but the explicit integration between Tekton and TAS is valuable IMO.

Please handle my comment, and we'll proceed with the merge.

@lingyzhuang lingyzhuang force-pushed the new-tas-integration branch from acb5473 to ce64e0c Compare July 3, 2025 04:35
@lingyzhuang
Copy link
Contributor Author

@Roming22 Removed related files.

@lingyzhuang lingyzhuang force-pushed the new-tas-integration branch from ce64e0c to c7bb9c0 Compare July 3, 2025 13:27
@sonarqubecloud
Copy link

sonarqubecloud bot commented Jul 3, 2025

Copy link
Member

@Roming22 Roming22 left a comment

Choose a reason for hiding this comment

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

/lgtm

@openshift-ci
Copy link

openshift-ci bot commented Jul 3, 2025

[APPROVALNOTIFIER] This PR is APPROVED

This pull-request has been approved by: lingyzhuang, Roming22

The full list of commands accepted by this bot can be found here.

The pull request process is described here

Details Needs approval from an approver in each of these files:

Approvers can indicate their approval by writing /approve in a comment
Approvers can cancel approval by writing /approve cancel in a comment

@openshift-ci openshift-ci bot added the approved label Jul 3, 2025
@Roming22
Copy link
Member

Roming22 commented Jul 3, 2025

/retest

@openshift-merge-bot openshift-merge-bot bot merged commit f661b91 into redhat-appstudio:main Jul 3, 2025
12 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants