Skip to content

RHINENG-22499: jeniknsfile for gh-pr-and-build job#2055

Draft
MichaelMraka wants to merge 1 commit intoRedHatInsights:masterfrom
MichaelMraka:pr1
Draft

RHINENG-22499: jeniknsfile for gh-pr-and-build job#2055
MichaelMraka wants to merge 1 commit intoRedHatInsights:masterfrom
MichaelMraka:pr1

Conversation

@MichaelMraka
Copy link
Collaborator

@MichaelMraka MichaelMraka commented Feb 13, 2026

replacement of gh-build-master and gh-pr-check

Secure Coding Practices Checklist GitHub Link

Secure Coding Checklist

  • Input Validation
  • Output Encoding
  • Authentication and Password Management
  • Session Management
  • Access Control
  • Cryptographic Practices
  • Error Handling and Logging
  • Data Protection
  • Communication Security
  • System Configuration
  • Database Security
  • File Management
  • Memory Management
  • General Coding Practices

Summary by Sourcery

Introduce a Jenkins pipeline to run PR checks and main-branch builds with secure secret handling and workspace cleanup.

Build:

  • Add a Jenkinsfile defining the gh-pr-and-build pipeline using an rhel8-spot agent with timestamped logs.

CI:

  • Configure separate PR check and main-branch build stages, including Vault-based secret injection for build/deploy and automatic workspace cleanup.

@sourcery-ai
Copy link

sourcery-ai bot commented Feb 13, 2026

Reviewer's Guide

Introduces a new Jenkins declarative pipeline (Jenkinsfile) that replaces existing gh-build-master and gh-pr-check jobs with a PR-only validation stage and a main-branch-only build/deploy stage that uses Vault-managed Quay credentials, plus workspace cleanup after each run.

Sequence diagram for PR-only validation stage in Jenkins pipeline

sequenceDiagram
    actor Developer
    participant GitHub
    participant Jenkins
    participant ScriptPR as pr_check_sh

    Developer->>GitHub: Open_or_update_pull_request
    GitHub-->>Jenkins: Webhook_push_with_CHANGE_ID
    Jenkins->>Jenkins: Evaluate_changeRequest_condition
    alt Is_pull_request
        Jenkins->>ScriptPR: Execute_pr_check_sh
        ScriptPR-->>Jenkins: Validation_results
        Jenkins-->>GitHub: Report_PR_check_status
    else Not_pull_request
        Jenkins-->>GitHub: Skip_PR_Check_stage
    end
Loading

Sequence diagram for main branch build and deploy with Vault-managed credentials

sequenceDiagram
    actor Developer
    participant GitHub
    participant Jenkins
    participant Vault as VaultBuildWrapper
    participant ScriptBuild as build_deploy_sh
    participant Quay

    Developer->>GitHub: Merge_to_main
    GitHub-->>Jenkins: Webhook_push_to_main
    Jenkins->>Jenkins: Evaluate_branch_main_condition
    alt Is_main_branch
        Jenkins->>Vault: Wrap_Build_stage
        Vault-->>Jenkins: Inject_QUAY_USER_and_QUAY_TOKEN_env
        Jenkins->>ScriptBuild: Execute_build_deploy_sh
        ScriptBuild->>Quay: Push_image_with_QUAY_credentials
        Quay-->>ScriptBuild: Push_result
        ScriptBuild-->>Jenkins: Build_deploy_status
    else Not_main_branch
        Jenkins-->>GitHub: Skip_Build_stage
    end
    Jenkins->>Jenkins: Clean_workspace
Loading

Flow diagram for Jenkinsfile stages and branch conditions

flowchart TD
    Start[[Pipeline start]]
    PRCheck{Is_changeRequest}
    RunPR[Run pr_check.sh]
    BuildCheck{Is_branch_main}
    WrapVault[Wrap Build stage with VaultBuildWrapper
and inject QUAY_USER and QUAY_TOKEN]
    RunBuild[Run build_deploy.sh]
    Clean[Clean workspace with cleanWs]
    End[[Pipeline end]]

    Start --> PRCheck
    PRCheck -->|Yes| RunPR
    PRCheck -->|No| BuildCheck
    RunPR --> BuildCheck

    BuildCheck -->|Yes| WrapVault
    BuildCheck -->|No| Clean

    WrapVault --> RunBuild --> Clean --> End
Loading

File-Level Changes

Change Details Files
Add a new Jenkins declarative pipeline for PR checks and main-branch builds.
  • Define pipeline agent to run on rhel8-spot labeled nodes with timestamped logs.
  • Add a PR Check stage gated by changeRequest() that runs ./pr_check.sh.
  • Add a Build stage gated to the main branch that wraps execution in VaultBuildWrapper to inject Quay credentials and runs ./build_deploy.sh.
  • Configure post actions to always clean the workspace after builds.
Jenkinsfile

Tips and commands

Interacting with Sourcery

  • Trigger a new review: Comment @sourcery-ai review on the pull request.
  • Continue discussions: Reply directly to Sourcery's review comments.
  • Generate a GitHub issue from a review comment: Ask Sourcery to create an
    issue from a review comment by replying to it. You can also reply to a
    review comment with @sourcery-ai issue to create an issue from it.
  • Generate a pull request title: Write @sourcery-ai anywhere in the pull
    request title to generate a title at any time. You can also comment
    @sourcery-ai title on the pull request to (re-)generate the title at any time.
  • Generate a pull request summary: Write @sourcery-ai summary anywhere in
    the pull request body to generate a PR summary at any time exactly where you
    want it. You can also comment @sourcery-ai summary on the pull request to
    (re-)generate the summary at any time.
  • Generate reviewer's guide: Comment @sourcery-ai guide on the pull
    request to (re-)generate the reviewer's guide at any time.
  • Resolve all Sourcery comments: Comment @sourcery-ai resolve on the
    pull request to resolve all Sourcery comments. Useful if you've already
    addressed all the comments and don't want to see them anymore.
  • Dismiss all Sourcery reviews: Comment @sourcery-ai dismiss on the pull
    request to dismiss all existing Sourcery reviews. Especially useful if you
    want to start fresh with a new review - don't forget to comment
    @sourcery-ai review to trigger a new review!

Customizing Your Experience

Access your dashboard to:

  • Enable or disable review features such as the Sourcery-generated pull request
    summary, the reviewer's guide, and others.
  • Change the review language.
  • Add, remove or edit custom review instructions.
  • Adjust other review settings.

Getting Help

@github-actions
Copy link

github-actions bot commented Feb 13, 2026

SC Environment Impact Assessment

Overall Impact: 🟢 LOW

View full report

Summary

  • Total Issues: 1
  • 🟢 Low: 1

Detailed Findings

🟢 LOW Impact

Environment configuration change detected

  • File: Jenkinsfile
  • Category: environment_config
  • Details:
    • Found Environment in Jenkinsfile at line 42
    • Found environment in Jenkinsfile at line 67
  • Recommendation: Review environment-specific settings to ensure SC Environment is properly configured.

Required Actions

  • Review all findings above
  • Verify SC Environment compatibility for all detected changes
  • Update deployment documentation if needed
  • Coordinate with ROSA Core team or deployment timeline

This assessment was automatically generated. Please review carefully and consult with the ROSA Core team for critical/high impact changes.

@MichaelMraka MichaelMraka force-pushed the pr1 branch 2 times, most recently from a3748dd to 1a200a6 Compare February 13, 2026 15:08
replacement of gh-build-master and gh-pr-check
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.

1 participant