Skip to content

feat: generic dependency build pattern for /run-e2e - #1006

Closed
Ladas wants to merge 2 commits into
rossoctl:mainfrom
Ladas:feat/ci-dep-build-pattern
Closed

Ladas wants to merge 2 commits into
rossoctl:mainfrom
Ladas:feat/ci-dep-build-pattern

Conversation

@Ladas

@Ladas Ladas commented Mar 17, 2026

Copy link
Copy Markdown
Contributor

Summary

Replace the kagenti-extensions-specific webhook build with a generic pattern that supports building from any dependency repo's branch or PR during HyperShift E2E tests.

Usage

# Build from branch on upstream repo
/run-e2e --build kagenti/kagenti-extensions=fix/my-branch

# Build from PR (works with forks)
/run-e2e --build kagenti/kagenti-extensions=pr/234

# Multiple dependencies
/run-e2e --build kagenti/kagenti-extensions=fix/webhook-fix --build kagenti/kagenti-operator=feat/new-crd

# Legacy (backwards compatible)
/run-e2e --extensions-ref fix/proxy-init-drop-privileged

# No builds (uses default until webhook chart is updated)
/run-e2e

How it works

  1. /run-e2e comment is parsed for --build org/repo=ref flags
  2. Only repos in the allow list are accepted (kagenti/kagenti-extensions, kagenti/kagenti-operator)
  3. Deploy splits into 3 phases: install platform → build deps → deploy agents
  4. Each dep is built using OpenShift BuildConfig (HyperShift) or docker+kind load (Kind)
  5. Helm values are overridden to use the custom images
  6. All custom builds are logged to CI output and GitHub step summary

Adding a new dependency

Edit 31-build-deps-from-refs.sh and add a case to the build_dep() function:

your-org/your-repo)
    DEP_REPO="$repo" DEP_REF="$ref" \
    DEP_CONTEXT="subdir-with-dockerfile" \
    DEP_IMAGE_NAME="image-name" \
    DEP_DEPLOY_NS="target-namespace" \
    DEP_HELM_SET="chart.image.path" \
    bash "$SCRIPT_DIR/30-build-dep-image.sh"
    ;;

Then add it to ALLOWED_REPOS in the workflow parser.

Test plan

  • /run-e2e with default (builds kagenti-extensions webhook)
  • /run-e2e --build kagenti/kagenti-extensions=fix/proxy-init-drop-privileged
  • /run-e2e --build kagenti/kagenti-extensions=pr/234
  • Verify allow list rejects unknown repos
  • Verify GitHub step summary shows custom builds

🤖 Generated with Claude Code

Replace the kagenti-extensions-specific webhook build with a generic
pattern that supports building from any dependency repo's branch or PR.

Usage in /run-e2e comments:
  /run-e2e --build kagenti/kagenti-extensions=fix/my-branch
  /run-e2e --build kagenti/kagenti-extensions=pr/234
  /run-e2e --build kagenti/kagenti-extensions=pr/234 --build kagenti/kagenti-operator=feat/new-crd

Features:
- Supports branch refs (upstream) and pr/<number> (works with forks)
- Allow list restricts builds to trusted repos only
- Dependency registry maps repos to build configs (context, namespace, helm path)
- Logs all custom builds to CI output and GitHub step summary
- Backwards compatible with --extensions-ref
- Default builds kagenti-extensions webhook until chart fix is released

New scripts:
- 30-build-dep-image.sh: Generic image builder (OpenShift BuildConfig + Kind docker)
- 31-build-deps-from-refs.sh: Orchestrator with dependency registry

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
The deployment name may differ from the image name depending on
helm chart naming. Fall back to finding any deployment in the
target namespace.

Signed-off-by: Ladislav Smola <[email protected]>
Assisted-By: Claude (Anthropic AI) <[email protected]>
Signed-off-by: Ladislav Smola <[email protected]>
@evaline-ju

Copy link
Copy Markdown
Contributor

fyi just merged #1012 to avoid the direct shell parsing - that may be relevant to port here as well

@Ladas

Ladas commented Mar 17, 2026

Copy link
Copy Markdown
Contributor Author

Combined into new CI infra PR.

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

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants