Skip to content

Warn or Prevent Jenkins Restart When UI-Based Config Differs from CasC YAML #2689

@ravisalamani

Description

@ravisalamani

What feature do you want to see added?

Feature Request: Warn or Prevent Jenkins Restart When UI-Based Config Differs from CasC YAML

Describe the feature

We are using the Jenkins Configuration as Code (CasC) plugin to manage our Jenkins configuration via YAML files. Although the plugin allows exporting the current configuration, Jenkins still permits a restart even when configuration changes have been made directly through the UI and not yet synced back to the CasC YAML.

This behavior can result in accidental configuration loss, as Jenkins will reload only what's defined in the CasC file upon restart—discarding any UI-based updates.

Proposed enhancement

Introduce a mechanism in the CasC plugin to:

  1. Detect differences between the current live Jenkins configuration and the CasC YAML.
  2. Warn the user or block Jenkins restart if unsynced UI changes are detected.
  3. Optionally, display a diff or prompt users to export changes before proceeding.

Use case example

  • A user modifies global configuration or credentials directly via the UI.
  • Before exporting these changes back to YAML, Jenkins is restarted.
  • The UI-based changes are lost because Jenkins reloads from the CasC-defined state.

Why this matters

  • Helps prevent accidental loss of configuration.
  • Encourages teams to maintain sync between UI changes and CasC YAML.
  • Improves overall safety and predictability in hybrid CasC + UI usage workflows.
  • Especially useful in environments where restarts are automated or frequent.

Additional context

Export functionality exists and works well, but there's currently no safeguard against restarts when unsynced changes are present. This feature would be a valuable enhancement for maintaining configuration integrity.

Upstream changes

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions