Skip to content

feat: support custom cli image for verify-enterprise-contract task#9

Merged
cuipinghuo merged 1 commit into
conforma:mainfrom
cuipinghuo:customize-cli
Jun 30, 2026
Merged

feat: support custom cli image for verify-enterprise-contract task#9
cuipinghuo merged 1 commit into
conforma:mainfrom
cuipinghuo:customize-cli

Conversation

@cuipinghuo

Copy link
Copy Markdown
Contributor

When CUSTOM_EC_CLI_IMAGE and CUSTOM_EC_TASK_YAML env vars are set, the e2e tests load the task definition from disk, replace all quay.io/conforma/cli step images with the custom image, and embed the patched task inline instead of resolving it from a bundle. This enables CLI PRs to be validated against their own code rather than the mainline release.

Ref: EC-1913

@coderabbitai

coderabbitai Bot commented Jun 22, 2026

Copy link
Copy Markdown

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: 67b41033-e071-47dc-84ae-783c6067f8a8

📥 Commits

Reviewing files that changed from the base of the PR and between 02e1dce and 303becd.

📒 Files selected for processing (5)
  • .tekton/pipelines/conforma-e2e/pipeline.yaml
  • README.md
  • pkg/utils/tekton/generators.go
  • pkg/utils/tekton/task_override.go
  • tests/contract/contract.go
✅ Files skipped from review due to trivial changes (1)
  • README.md
🚧 Files skipped from review as they are similar to previous changes (1)
  • .tekton/pipelines/conforma-e2e/pipeline.yaml

📝 Walkthrough

Walkthrough

The pipeline adds optional custom ec CLI inputs and a conditional build/push path. The contract test can now load a patched embedded Tekton task spec from environment variables instead of always using the default ConfigMap bundle. README instructions and config entries were updated accordingly.

Changes

Custom ec CLI support

Layer / File(s) Summary
Pipeline inputs and custom image build
.tekton/pipelines/conforma-e2e/pipeline.yaml
Adds custom-ec-cli-url and custom-ec-cli-revision, passes them through the task, exports them to the e2e step, and conditionally clones, builds, layers, and pushes a custom ec image while setting downstream selection env vars.
Task image patching helper
pkg/utils/tekton/task_override.go
Adds LoadAndPatchTaskImage, which reads a task YAML file, replaces matching quay.io/conforma/cli step images, and returns an embedded task spec.
Generator TaskSpec support
pkg/utils/tekton/generators.go
Adds TaskSpec to VerifyEnterpriseContract, builds the task explicitly, and wires either an embedded task spec or the existing bundle resolver into the generated pipeline.
Contract task spec selection
tests/contract/contract.go
Reads CUSTOM_EC_CLI_IMAGE and CUSTOM_EC_TASK_YAML, enforces that they appear together, loads a patched task spec when present, and passes it into the Tekton generator.
README updates
README.md
Documents the custom CLI build flow, new environment variables, and the task image patching note in the project structure section.

Estimated code review effort

🎯 4 (Complex) | ⏱️ ~45 minutes

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: supporting a custom CLI image for the verify-enterprise-contract task.
Description check ✅ Passed The description directly describes the custom CLI image override behavior and matches the implemented changes.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@cuipinghuo cuipinghuo changed the title feat: Support custom CLI image for verify-enterprise-contract task feat: support custom cli image for verify-enterprise-contract task Jun 23, 2026
@github-actions github-actions Bot added size: L and removed size: M labels Jun 25, 2026
@cuipinghuo
cuipinghuo force-pushed the customize-cli branch 3 times, most recently from 01f5fe8 to 400ba73 Compare June 29, 2026 15:32
@cuipinghuo
cuipinghuo marked this pull request as ready for review June 29, 2026 15:33
@cuipinghuo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@coderabbitai coderabbitai 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.

Actionable comments posted: 4

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In @.tekton/pipelines/conforma-e2e/pipeline.yaml:
- Around line 252-253: The image tag generation in the pipeline is using
CUSTOM_EC_CLI_REVISION directly, which can be a branch name and produce invalid
tags like cli-pr-feature/foo. Update the tagging logic in the pipeline step that
sets CLI_SHA and CUSTOM_IMAGE to derive the short SHA from the checked-out
commit after checkout (using the checked-out commit’s revision) instead of
slicing the raw revision string. Keep the existing variables, but ensure the tag
is always based on a valid commit hash.
- Line 244: The credentialed pipeline step currently installs crane with a
moving `@latest` tag, which makes the build non-reproducible and can pull unvetted
binaries. Update the install in the pipeline step to use a specific vetted
release/version instead of `@latest`, and keep the change localized to the crane
installation command in the Tekton pipeline definition.

In `@tests/contract/contract.go`:
- Around line 190-193: The contract test setup is overriding the generator with
customTaskSpec, which forces task embedding and bypasses TaskRef. Remove that
override from the shared BeforeEach in contract.go so the release-policy cases
continue to exercise the TaskRef path via tekton.VerifyEnterpriseContract and
pkg/utils/tekton/generators.go, and keep the custom task spec only in tests that
explicitly verify embedded task behavior.
- Around line 177-187: The custom EC CLI setup in the contract test currently
falls back to verify_ec_task_bundle when only one of CUSTOM_EC_CLI_IMAGE or
CUSTOM_EC_TASK_YAML is set, which hides misconfiguration. Update the logic in
contract.go around the customImage/taskYAML handling to explicitly detect
partial configuration and fail fast with an assertion or fatal error if exactly
one env var is present. Keep the existing LoadAndPatchTaskImage path for the
full custom setup and the ConfigMap fallback only when both env vars are unset.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Enterprise

Run ID: a96157ef-8984-445e-9d15-21cca2e2781d

📥 Commits

Reviewing files that changed from the base of the PR and between 741eb3b and 400ba73.

📒 Files selected for processing (4)
  • .tekton/pipelines/conforma-e2e/pipeline.yaml
  • pkg/utils/tekton/generators.go
  • pkg/utils/tekton/task_override.go
  • tests/contract/contract.go

Comment thread .tekton/pipelines/conforma-e2e/pipeline.yaml
Comment thread .tekton/pipelines/conforma-e2e/pipeline.yaml Outdated
Comment thread tests/contract/contract.go Outdated
Comment thread tests/contract/contract.go
@cuipinghuo
cuipinghuo force-pushed the customize-cli branch 2 times, most recently from 55e7065 to 02e1dce Compare June 29, 2026 19:03
@github-actions github-actions Bot added size: M and removed size: L labels Jun 29, 2026
@cuipinghuo

cuipinghuo commented Jun 29, 2026

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cuipinghuo
cuipinghuo changed the base branch from customize-cli to main June 29, 2026 19:09
@github-actions github-actions Bot added size: L and removed size: M labels Jun 29, 2026
@cuipinghuo

Copy link
Copy Markdown
Contributor Author

@coderabbitai review

@coderabbitai

coderabbitai Bot commented Jun 29, 2026

Copy link
Copy Markdown
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@cuipinghuo

Copy link
Copy Markdown
Contributor Author
$ tkn pipeline start conforma-e2e-pipeline \
    --param git-url=https://github.com/conforma/e2e-tests.git \
    --param revision=customize-cli \
    --param oci-container-repo=quay.io/conforma/e2e-tests \
    --param oci-container-repo-credentials-secret=konflux-test-infra \
    --param custom-ec-cli-url=https://github.com/conforma/cli.git \
    --param custom-ec-cli-revision=**ac7089fa233acc0466ea0473bf31e10cb8ce24f9** \
    --use-param-defaults \
    --showlog
...

[conforma-e2e-tests : e2e-test]   *** Logs from pod 'verify-enterprise-contract-e1c7c11b16ffb783083847e34872df4e-pod', container 'step-version':
[conforma-e2e-tests : e2e-test]   ----- START -----Version            development
[conforma-e2e-tests : e2e-test]   Source ID          **ac7089fa233acc0466ea0473bf31e10cb8ce24f9**
[conforma-e2e-tests : e2e-test]   Change date        2026-06-22 13:36:44 +0000 UTC (1 week ago)
[conforma-e2e-tests : e2e-test]   ECC                v0.1.7
[conforma-e2e-tests : e2e-test]   OPA                v1.15.2
[conforma-e2e-tests : e2e-test]   Conftest           v0.68.2
[conforma-e2e-tests : e2e-test]   Cosign             v3.0.4
[conforma-e2e-tests : e2e-test]   Sigstore           v1.10.5
[conforma-e2e-tests : e2e-test]   Rekor              v1.5.0
[conforma-e2e-tests : e2e-test]   Tekton Pipeline    v1.12.0
[conforma-e2e-tests : e2e-test]   Kubernetes Client  v0.35.4

....
[conforma-e2e-tests : e2e-test] • [17.463 seconds]
[conforma-e2e-tests : e2e-test] ------------------------------
[conforma-e2e-tests : e2e-test] [ReportAfterSuite] Autogenerated ReportAfterSuite for --junit-report
[conforma-e2e-tests : e2e-test] autogenerated by Ginkgo
[conforma-e2e-tests : e2e-test] [ReportAfterSuite] PASSED [0.009 seconds]
[conforma-e2e-tests : e2e-test] ------------------------------
[conforma-e2e-tests : e2e-test]
[conforma-e2e-tests : e2e-test] Ran 12 of 12 Specs in 397.530 seconds
[conforma-e2e-tests : e2e-test] SUCCESS! -- 12 Passed | 0 Failed | 0 Pending | 0 Skipped
[conforma-e2e-tests : e2e-test] PASS
[conforma-e2e-tests : e2e-test]
[conforma-e2e-tests : e2e-test] Ginkgo ran 1 suite in 7m49.642969062s
[conforma-e2e-tests : e2e-test] Test Suite Passed

test pass with ec vesion same as custom-ec-cli-revision

When CUSTOM_EC_CLI_IMAGE and CUSTOM_EC_TASK_YAML env vars are set, the
e2e tests load the task definition from disk, replace all
quay.io/conforma/cli step images with the custom image, and embed the
patched task inline instead of resolving it from a bundle. This enables
cli PRs to be validated against their own code rather than the mainline
release.

The pipeline accepts optional custom-ec-cli-url and custom-ec-cli-revision
params. When provided, it clones the cli repo, builds the binary, layers
it onto the base image with crane, and pushes a throwaway tag for tests.

docs: add custom cli testing instructions to README

Ref: EC-1913

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

@robnester-rh robnester-rh 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.

Looks good, my only comment would have been pinning crane for reproducibility, but your explanation makes sense as to why it's not a concern.

@cuipinghuo
cuipinghuo merged commit f49f4a2 into conforma:main Jun 30, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants