Uploaded image for project: 'FlightPath'
  1. FlightPath
  2. FLPATH-3195

x2a-convertor publish cannot update an existing GitHub repository on subsequent runs

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Unresolved
    • Icon: Undefined Undefined
    • None
    • None
    • None
    • False
    • Hide

      None

      Show
      None
    • False

      Summary

      The x2a-convertor publish command does not handle the case where a GitHub repository already exists from a previous run. When running the publish command multiple times for the same role (e.g., fastapi_tutorial), the tool should either:

      1. Update the existing repository with the new/updated generated Ansible code, OR
      2. Gracefully handle the "repository already exists" response from the GitHub API

      Currently, it appears the tool attempts to create a new repository each time without checking whether one already exists, which can result in errors or stale published code.

      Steps to Reproduce

      1. Run the full x2ansible workflow (init, analyze, migrate, publish) for a module (e.g., fastapi-tutorial)
      2. The publish stage creates a GitHub repo (e.g., fastapi_tutorial) under the configured owner and pushes generated Ansible code — this succeeds
      3. Make changes or re-run the same pipeline with the same module name
      4. The publish stage attempts to create the same repo again

      Expected Behavior

      The publish command should:

      • Check if the GitHub repository already exists before attempting creation
      • If the repo exists, push updated code to it (force-push or new commit)
      • Return success regardless of whether the repo was newly created or updated

      Actual Behavior

      The publish command does not cleanly handle the "repo already exists" case. It may:

      • Receive a 422 (already exists) or 403 from the GitHub API on the create call
      • Not update the existing repo with the latest generated code
      • The overall publish may still report success even if the code was not actually updated

      Environment

      • x2a-convertor image: quay.io/x2ansible/x2a-convertor:latest
      • Publish target: GitHub (via -github-owner and -github-branch flags)
      • Invoked via: Jenkins CI pipeline (podman run)

      Additional Context

      This was discovered during CI nightly job development for x2ansible. The publish stage is run repeatedly for the same module, and idempotent behavior is required for CI reliability.

      Related log output from a successful first run followed by a subsequent run:

      INFO:x2convertor.src.publishers.publish: Publish completed successfully for role(s) fastapi_tutorial!
      

      The publish reports success but the GitHub repo may not have been updated with the latest code.

              rh-ee-eshalev Elai Shalev
              gharden1 Gary Harden
              Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

                Created:
                Updated: