-
Notifications
You must be signed in to change notification settings - Fork 726
Add a note on reloading from declarative pipelines #1227 #1675
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
If JCasC is reloaded from a declarative pipeline, Jenkins throws an error due to permission issues. Subsequent reloads of JCasC fail regardless of the mechanisms used to do so, and regardless of user permissions. This issue probably needs to be addressed correctly so that Jenkins isn't put in an invalid state, as it could potentially have other side effects that hasn't been noticed yet.
docs/features/configurationReload.md
Outdated
@@ -29,3 +29,4 @@ reload-jcasc-configuration | |||
import io.jenkins.plugins.casc.ConfigurationAsCode; | |||
ConfigurationAsCode.get().configure() | |||
``` | |||
Note that running the above code in a declarative pipeline (either directly or via shared libraries) will put this plugin in a bad state where the configuration cannot be reload at all until Jenkins is restarted. See #1227 for more info. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
is it better to just remove the above from the docs?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ultimately that is something for CloudBees/CJCasC maintainers to decide, but I don't believe so. So far we've been using this successfully as per the workaround posted in #1227, and this works as long as a) the script approvals allow it, b) it's a freestyle job, and c) it is run using systemGroovyCommand
. The issue of course is when this is run through pipelineJob. Mind you, even if the above three predicates aren't met and the code is run in a freestyle job, Jenkins is still in a good state and the code above can be run e.g. within the script console fine.
@timja will this get approved/merged? If not, I'll close this PR. Thanks |
Codecov Report
@@ Coverage Diff @@
## master #1675 +/- ##
============================================
+ Coverage 80.64% 80.80% +0.16%
- Complexity 820 835 +15
============================================
Files 66 71 +5
Lines 2402 2464 +62
Branches 340 345 +5
============================================
+ Hits 1937 1991 +54
- Misses 356 363 +7
- Partials 109 110 +1
|
If JCasC is reloaded from a declarative pipeline, Jenkins throws an error due to permission issues. Subsequent reloads of JCasC fail regardless of the mechanisms used to do so, and regardless of user permissions.
This issue probably needs to be addressed correctly so that Jenkins isn't put in an invalid state, as it could potentially have other side effects that hasn't been noticed yet.
Your checklist for this pull request
🚨 Please review the guidelines for contributing to this repository.
Relates to #1227