Repository navigation
Conversation
Signed-off-by: Álvaro Cerdá <[email protected]>
|
Important This PR includes changes that affect public-facing API. Please ensure you are adding/updating documentation for new features or behavior. Changed Packages
|
|
Hi @vinzscam just a quick ping on this one 🙂 Let me know if there's anything I can change or add to help get it reviewed. Thanks you in advance! |
| } | ||
| throw err; | ||
| } | ||
| const projectsByInstance = await Promise.all( |
There was a problem hiding this comment.
With Promise.all, a single unreachable instance hides results from the healthy ones. That's documented in the README, but would Promise.allSettled with per-instance errors make sense here?
Rough idea:
const results = await Promise.allSettled(jenkinsInstances.map(/* ... */));plus an errors: [{ instanceName, message }] array for the rejected ones
| ...project, | ||
| instanceName: jenkinsInfo.instanceName, | ||
| })); | ||
| } catch (error) { |
There was a problem hiding this comment.
Previously only the AggregateError case was wrapped and other errors were rethrown as-is. Now every error becomes a plain Error, so typed errors (e.g. NotFoundError, NotAllowedError from @backstage/errors) turn into 500s. Could this use ForwardedError from @backstage/errors so the original status is kept?
| return ( | ||
| (await response.json()).projects?.map((p: Project) => ({ | ||
| ...p, | ||
| instanceName: p.instanceName ?? 'default', |
There was a problem hiding this comment.
defaulting to 'default' on the client means every link/retry sends ?instanceName=default even when the backend didn't return one. It doesn't break anything, but leaving it undefined would let the backend's resolution logic decide.
Signed-off-by: Álvaro Cerdá <[email protected]>
|
Hi @Shubhammete Thank you for your comments!
|
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues require further changes.
No open issues 🎉
What changed in this PR
Extends the Jenkins frontend and backend so one catalog entity can reference jobs across multiple named instances, addressing #10301 while preserving single-instance compatibility.
Changes:
- Groups jobs by instance and carries instance selection through API requests, navigation, and backend actions.
- Returns partial results when some instances fail, with warnings and a conditional Instance column.
- Adds regression tests, public API updates, documentation, examples, and release changesets.
Paths below are relative to workspaces/jenkins/.
| File | Description |
|---|---|
plugins/jenkins/src/components/useJobRuns.ts |
Passes instance selection to history requests. |
plugins/jenkins/src/components/useBuildWithSteps.ts |
Fetches builds by instance and catches request failures. |
plugins/jenkins/src/components/useBuilds.ts |
Handles partial failures and instance-aware retries. |
plugins/jenkins/src/components/JobRunsTable/JobRunsTable.tsx |
Reads instance selection from the URL. |
plugins/jenkins/src/components/BuildWithStepsPage/BuildWithStepsPage.tsx |
Passes URL instance selection to build fetching. |
plugins/jenkins/src/components/BuildsPage/lib/CITable/presets.ts |
Adds the default Instance column. |
plugins/jenkins/src/components/BuildsPage/lib/CITable/columns.tsx |
Preserves instance selection in build and history links. |
plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.tsx |
Displays failure warnings and conditional instance labels. |
plugins/jenkins/src/components/BuildsPage/lib/CITable/CITable.test.tsx |
Tests instance columns, warnings, and build links. |
plugins/jenkins/src/api/JenkinsApi.ts |
Adds instance-aware requests and partial-result handling. |
plugins/jenkins/src/api/JenkinsApi.test.ts |
Tests request routing, retries, and error responses. |
plugins/jenkins/src/api/index.ts |
Exports partial-result and instance-error types. |
plugins/jenkins/report.api.md |
Records frontend public API additions. |
plugins/jenkins/README.md |
Documents multi-instance usage and failure displays. |
plugins/jenkins-backend/src/service/jenkinsInfoProvider.ts |
Resolves annotation jobs into instance-specific configurations. |
plugins/jenkins-backend/src/service/jenkinsInfoProvider.test.ts |
Tests grouping, selection, and annotation validation. |
plugins/jenkins-backend/src/service/JenkinsBuilder.ts |
Routes instance selectors and aggregates project results. |
plugins/jenkins-backend/src/service/JenkinsBuilder.test.ts |
Tests routing, partial failures, and error preservation. |
plugins/jenkins-backend/src/service/index.ts |
Exports provider options. |
plugins/jenkins-backend/src/service/getProjectsFromInstances.ts |
Queries instances concurrently and collects failures. |
plugins/jenkins-backend/src/service/getJenkinsInstances.ts |
Supports plural providers with a legacy fallback. |
plugins/jenkins-backend/src/actions/createTriggerBuildAction.ts |
Accepts instance selection for triggering builds. |
plugins/jenkins-backend/src/actions/createTriggerBuildAction.test.ts |
Verifies trigger instance forwarding. |
plugins/jenkins-backend/src/actions/createListBuildsAction.ts |
Returns builds across instances with failure details. |
plugins/jenkins-backend/src/actions/createListBuildsAction.test.ts |
Tests duplicate job names and partial results. |
plugins/jenkins-backend/src/actions/createGetBuildLogsAction.ts |
Passes job and instance selection to the provider. |
plugins/jenkins-backend/src/actions/createGetBuildLogsAction.test.ts |
Verifies log-request provider arguments. |
plugins/jenkins-backend/src/actions/createGetBuildAction.ts |
Accepts instance selection for build details. |
plugins/jenkins-backend/src/actions/createGetBuildAction.test.ts |
Verifies build-detail instance forwarding. |
plugins/jenkins-backend/README.md |
Documents configuration, actions, failures, and custom providers. |
examples/entities.yaml |
Demonstrates jobs spanning default and named instances. |
app-config.yaml |
Adds a named instance for the example. |
.changeset/calm-dragons-build.md |
Announces frontend and backend feature releases. |
Review effort: Balanced
Hey, I just made a Pull Request!
This allows a single catalog entity to reference jobs from multiple named Jenkins instances.
Jobs are scoped by both instance name and full job name, so identically named jobs on different instances do not collide. Unprefixed jobs continue to resolve through the
defaultinstance, preserving existing single-instance behavior.The originating instance is retained when listing builds, opening build details, viewing history and logs, or retrying a build.
Closes #10301
Validation
✔️ Checklist
Signed-off-byline in the message. (more info)