Skip to content

Conversation

@elai-shalev
Copy link
Contributor

Overview

This PR implements real Kubernetes job creation for the X2A migration plugin, enabling the init phase to run x2a migration jobs on Kubernetes with full git flow.

Key Changes

  1. New Job Script Template (templates/x2a-job-script.sh)
  • Complete bash script for executing x2a tool phases (init, analyze, migrate)
  • Clones source/target git repos, runs x2a tool, commits results, and pushes to target repo
  • Includes callback to Backstage backend with artifact URLs on completion
  1. JobResourceBuilder Enhancements
  • buildProjectSecret() - Creates K8s secrets for LLM + AAP credentials (long-lived)
  • buildJobSecret() - Creates ephemeral K8s secrets for git credentials (auto-deleted with job)
  • buildJobSpec() - Builds complete K8s Job spec with init container for git clone
  • Git fetch init container using alpine/git image
  • Main container executes the x2a-job-script.sh template
  1. Router Updates
  • POST /projects/:projectId/run - Creates and launches init phase K8s jobs
  • POST /projects/:projectId/modules/:moduleId/run - Creates jobs for analyze/migrate/publish phases
  • GET /projects/:projectId/modules/:moduleId/log - Retrieves job logs (from K8s or DB)
  • POST /projects/:projectId/modules - CRUD endpoint for modules (temporary for testing)
  1. Database Service Additions
  • Module CRUD operations (createModule, getModule, listModules, deleteModule)
  • Job tracking with k8sJobName, callbackToken, and artifacts
  • listJobsForProject() and listJobsForModule() queries
  1. KubeService
  • Added getJobLogs() for fetching logs from running K8s jobs

TODOs

  • Implement real job creation for non-init phases - Currently analyze/migrate/publish phases have the skeleton infrastructure but need to be fully wired up
    with actual x2a tool integration
  • Implement /collectArtifacts callback endpoints - These endpoints need to be created to receive callbacks from completed K8s jobs with artifact URLs and update job status in the database
  • Publish phase needs changes in the x2a code

https://issues.redhat.com/browse/FLPATH-3086

@rhdh-gh-app
Copy link

rhdh-gh-app bot commented Feb 8, 2026

Missing Changesets

The following package(s) are changed by this PR but do not have a changeset:

  • @red-hat-developer-hub/backstage-plugin-x2a-backend

See CONTRIBUTING.md for more information about how to add changesets.

Changed Packages

Package Name Package Path Changeset Bump Current Version
@red-hat-developer-hub/backstage-plugin-x2a-backend workspaces/x2a/plugins/x2a-backend none v1.0.0

@elai-shalev elai-shalev changed the title K8s job expand K8s jobs real implementation - framework + init Feb 8, 2026
@elai-shalev elai-shalev changed the title K8s jobs real implementation - framework + init feat(x2a): K8s jobs real implementation - framework + init Feb 8, 2026
# Git commit
echo "=== Committing changes to git ==="
cd ${TARGET_BASE}
git add "${PROJECT_DIR}"
Copy link
Member

Choose a reason for hiding this comment

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

Just for heads-up:
Do we want to commit everything? Including temporary data like the checklist?
Or should we focus on the artifacts only?

Can be good for debugging but messy otherwise.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could commit less, but we need to decide what the user should see and approve, and what not
lets discuss separately on what would be included

@sonarqubecloud
Copy link

sonarqubecloud bot commented Feb 9, 2026

Quality Gate Failed Quality Gate failed

Failed conditions
7.5% Duplication on New Code (required ≤ 3%)

See analysis details on SonarQube Cloud

@mareklibra
Copy link
Member

LGTM.
@eloycoto can you please have a look as well?

@elai-shalev elai-shalev merged commit 3fadb68 into redhat-developer:main Feb 9, 2026
8 of 9 checks passed
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.

3 participants