# GSoC 2022 Project proposal: Jenkins Configuration as Code (JCasC) drift detector

**URL:** <https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325>\
**Category:** GSoC\
**Created:** [January 25, 2022, 3:07pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325 "2022-01-25T15:07:22Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![Jmm](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/jmm/32/495_2.png) [@Jmm](https://community.jenkins.io/u/Jmm)\
**Post date:** [January 25, 2022, 3:07pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/1 "2022-01-25T15:07:22Z")

</div>

Hello,

Please find hereafter another GSoC Project proposal. Questions, comments, suggestions are welcome.

/- Jmm

* * *

**Goal** : Report differences between a Jenkins active configuration and a given JCasC definition.

**Context:**  
A well designed Configuration Process will only allow updating Jenkins via Configuration as Code. It will thus periodically and “blindly” overwrite the controller to make sure that the configuration code is equivalent to the running one. This is the recommended practice (best if the interval is kept very short).

But experience shows that compromises need to be made. These exceptions range from interactively validating touchy configuration change on Production, to allowing a developer to experiment the best parameters for a feature, or to an emergency interactive configuration change.

This is typically the case when trying to reach the ideal Configuration Process maturity level.

Another use case is to be able to compare the configuration of two Jenkins controllers (ex: Test vs. Production)

**Project proposal:**

This project intents to create the tooling, similar to the `terraform plan` command, to:

- Show what configuration elements would be created or changed if the supplied JCasC file was applied to the given Jenkins system.
  - Ability to configure the details displayed for sensitive elements (credentials, sensitive configuration, etc)
  - Ability to opt out above mentioned sensitive elements. These elements may be absent or encrypted in the supplied JCasC file.

- Generate a JCasC yaml with only the detected delta.
- Give a boolean result whether the controller’s configuration is equivalent to the supplied JCasC configuration (did the configuration drift?)

---

<div class="post-metadata">

**Author:** ![pushker001](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/pushker001/32/2793_2.png) [@pushker001](https://community.jenkins.io/u/pushker001)\
**Post date:** [January 21, 2023, 4:48pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/2 "2023-01-21T16:48:23Z")

</div>

@Jmm i would like to work on this project what thinks I need to do regarding project if you guide me this would be very beneficial to me

---

<div class="post-metadata">

**Author:** ![Jmm](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/jmm/32/495_2.png) [@Jmm](https://community.jenkins.io/u/Jmm)\
**Post date:** [January 24, 2023, 5:01pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/3 "2023-01-24T17:01:18Z")

</div>

Ooops ! This message slipped under the radar screens. I apologize for this.

In order to get to speed for an efficient mentoring, the first and probably most important thing to do is to become very proficient on JCasC (practical and hands-on experience). Another need-to-know is the use of the CLI (various flavour). The third preparation work is to work on your own on several architectural ideas to solve the drift detection as well as project plans and scopes ideas. The contributors will work on their own interpretation of the problem, but the more we thought about this beforehand the better we can guide them (pointing to forgotten topics or questions, hint for exploration paths, etc).

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [January 25, 2023, 3:19am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/4 "2023-01-25T03:19:17Z")

</div>

@Jmm I think @pushker001 wants to contribute as a contributor rather than a mentor.

---

<div class="post-metadata">

**Author:** ![Jmm](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/jmm/32/495_2.png) [@Jmm](https://community.jenkins.io/u/Jmm)\
**Post date:** [January 25, 2023, 11:18am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/5 "2023-01-25T11:18:33Z")

</div>

Mmmh… You might be right. I might mix the handle with somebody else… E-INFO-OVERLOAD…

@pushker001 Could you clarify what kind of guidance you would like?

/- Jmm

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [January 25, 2023, 11:20am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/6 "2023-01-25T11:20:41Z")

</div>

@pushker001 For any contributer-related questions, please head to our Gitter channel at [jenkinsci/gsoc-sig - Gitter](https://gitter.im/jenkinsci/gsoc-sig). There we will be better to answer your queries better.

---

<div class="post-metadata">

**Author:** ![pushker001](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/pushker001/32/2793_2.png) [@pushker001](https://community.jenkins.io/u/pushker001)\
**Post date:** [January 27, 2023, 4:39pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/7 "2023-01-27T16:39:01Z")

</div>

As Jim tells us to explore the Jenkins I watched the improve the plugin tutorial now what next I was trying to solve the random issue but faced difficulty in solving it can you guide me regarding this

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [January 27, 2023, 5:29pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/8 "2023-01-27T17:29:08Z")

</div>

@pushker001 What issue has you been working on? Could you share a link with us?

---

<div class="post-metadata">

**Author:** ![pushker001](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/pushker001/32/2793_2.png) [@pushker001](https://community.jenkins.io/u/pushker001)\
**Post date:** [January 28, 2023, 6:36am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/9 "2023-01-28T06:36:35Z")

</div>

> <https://github.com/jenkinsci/configuration-as-code-plugin/issues/1846>
>
> \### Jenkins and plugins versions report
> 
> \-
> 
> \### What Operating System are yo…u using (both controller, and any agents involved in the problem)?
> 
> \-
> 
> \### Reproduction steps
> 
> \- Put invalid config in a jenkins.yaml and restart it
> \- Jenkins fails to load with a big stacktrace
> 
> https://gitter.im/jenkinsci/configuration-as-code-plugin?at=61fa665aced11857f98d53c6
> 
> \### Expected Results
> 
> \- A clear error message is displayed, possibly with the option to expand it to see the full error
> 
> Jenkins has moved away from showing stacktraces to users, and hides them by default now on error pages, we should follow to match that
> 
> \### Actual Results
> 
> \- A giant stacktrace that scares users and makes it hard for them to see what is wrong
> 
> \### Anything else?
> 
> \_No response\_

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [January 29, 2023, 12:53am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/10 "2023-01-29T00:53:19Z")

</div>

@pushker001 So I would suggest to do some investigation further, such as going back to the source of the original problematic stack trace at [configuration-as-code-plugin/ConfigurationAsCode.java at aa06e58d11e3b5fbe2baea92523d53bdd5b1f0d1 · jenkinsci/configuration-as-code-plugin · GitHub](https://github.com/jenkinsci/configuration-as-code-plugin/blob/aa06e58d11e3b5fbe2baea92523d53bdd5b1f0d1/plugin/src/main/java/io/jenkins/plugins/casc/ConfigurationAsCode.java#L734). There is an example of this stack trace at [https://gitter.ems.host/\_matrix/media/v1/download/systemausfall.org/XdRIDoidqzBALOsKszsHRAce](https://gitter.ems.host/_matrix/media/v1/download/systemausfall.org/XdRIDoidqzBALOsKszsHRAce), which has been given at [jenkinsci/configuration-as-code-plugin - Gitter](https://gitter.im/jenkinsci/configuration-as-code-plugin?at=61fa665aced11857f98d53c6). Then, do some research about how other more modern plugins would handle this type of error and try to imitate it.

---

<div class="post-metadata">

**Author:** ![pushker001](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/pushker001/32/2793_2.png) [@pushker001](https://community.jenkins.io/u/pushker001)\
**Post date:** [January 29, 2023, 4:49pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/11 "2023-01-29T16:49:08Z")

</div>

how do check how other modern plugins are handling this issue

---

<div class="post-metadata">

**Author:** ![pushker001](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/pushker001/32/2793_2.png) [@pushker001](https://community.jenkins.io/u/pushker001)\
**Post date:** [January 29, 2023, 5:17pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/12 "2023-01-29T17:17:23Z")

</div>

I explore the plugin mask password plugin as you told me and explore the source code as you have given me the original problematic stack trace at configuration as a code plugin I search the  
keyword related to it and found this

> <https://github.com/jenkinsci/mask-passwords-plugin/blob/6f755ed51422449b06189989503ea9e877631686/src/main/java/com/michelin/cio/hudson/plugins/passwordparam/PasswordParameterDefinition.java>

line no 56

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [January 29, 2023, 5:51pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/13 "2023-01-29T17:51:57Z")

</div>

Hi @pushker001 Good start! I think a good example of a more modern way to handle the `ConfiguratorException` is the Git plugin: [git-plugin/GitLabConfigurator.java at 5edc26da3bd4962bdb8599ef1cbc40d335cd1129 · jenkinsci/git-plugin · GitHub](https://github.com/jenkinsci/git-plugin/blob/5edc26da3bd4962bdb8599ef1cbc40d335cd1129/src/main/java/hudson/plugins/git/browser/casc/GitLabConfigurator.java#L22). If you compare this to the source code we will need to update you can see that maybe we don’t really need to show all the `unknownKeys`. One way I would suggest you approach the problem is to try and reproduce the error yourself, then you can play with ways to generate a more modern stack trace like the one shown in Git.

---

<div class="post-metadata">

**Author:** ![lakshmishreea122003](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/lakshmishreea122003/32/13569_2.png) [@lakshmishreea122003](https://community.jenkins.io/u/lakshmishreea122003)\
**Post date:** [January 30, 2023, 12:46pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/14 "2023-01-30T12:46:28Z")

</div>

I also tried to work on the same issue and came up with a PR [Fixes #1846 by displaying a user-friendly error message instead of a stack trace on boot error by lakshmishreea122003 · Pull Request #2199 · jenkinsci/configuration-as-code-plugin · GitHub](https://github.com/jenkinsci/configuration-as-code-plugin/pull/2199) but some checks were unsuccessful. Please may I know if there is a way to modify what I have done to pass all checks or else I shall do some research about how other more modern plugins would handle this type of error and try to imitate it as advised by @krisstern .

---

<div class="post-metadata">

**Author:** ![i-am-yuvi](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/i-am-yuvi/32/3454_2.png) [@i-am-yuvi](https://community.jenkins.io/u/i-am-yuvi)\
**Post date:** [February 24, 2023, 10:57am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/15 "2023-02-24T10:57:57Z")

</div>

Hey @Jmm @krisstern I’m interested in this project & also would like to contribute to it

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [February 26, 2023, 1:29am UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/16 "2023-02-26T01:29:17Z")

</div>

Hi @i-am-yuvi Thanks for your interest in the project! You may start by browsing through the issues tracker for the relevant repo at [Issues · jenkinsci/configuration-as-code-plugin · GitHub](https://github.com/jenkinsci/configuration-as-code-plugin/issues) to see if you can submit some pull requests for at least one or two of these issues before official GSoC applicaiton form opens next month on March 20th. If you have any further questions you can pose them on our GSoC Gitter channel at [https://app.gitter.im/#/room/#jenkinsci\_gsoc-sig:gitter.im](https://app.gitter.im/#/room/#jenkinsci_gsoc-sig:gitter.im), where most of our conversations regarding GSoC are hosted.

---

<div class="post-metadata">

**Author:** ![krisstern](https://dub1.discourse-cdn.com/flex013/user_avatar/community.jenkins.io/krisstern/32/824_2.png) [@krisstern](https://community.jenkins.io/u/krisstern)\
**Post date:** [March 22, 2023, 5:13pm UTC](https://community.jenkins.io/t/gsoc-2022-project-proposal-jenkins-configuration-as-code-jcasc-drift-detector/1325/17 "2023-03-22T17:13:26Z")

</div>

Please note that this project idea is being withdrawn. If you have prepared a proposal for this project idea, please consider preparing a new proposal for one of the remaining project ideas still on offer. For details please see [IMPORTANT NOTICE: Project Ideas withdrawal](https://community.jenkins.io/t/important-notice-project-ideas-withdrawal/6424).
