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
Automatically reload configuration if change in jenkins.yaml detected #76
Comments
I would also appreciate an api endpoint or cli sub-command to trigger a reload. At present, I'm using CM (puppet) to restart the master when the config yaml changes but that is probably more heavy handed than needed. |
Actually, it looks like this already exists from look at the helm chart which is running a command via ssh. |
This should be optionally disabled so that you can hold off until pipelines finish or any other important things are done. |
The helm chart's "casc reload" sidecar outputs a boolean value that indicates whether reload was successful. If you deploy jenkins itself using a pipeline (we use a "seed" jenkins for this) that first deploys a "staging" jenkins, if reload fails, the pipeline can be halted prior to deploying changed config to a "production" jenkins. This removes the risk of attempting to load bad config on your main jenkins instance. I know this isn't directly relevant to your point, but reduces risk during reload. |
Not everyone is running Jenkins on Kubernetes. This needs to be available for Jenkins being ran from other types of environments. There are also always going to be some differences between staging and production configurations as well. Given that Jenkins is designed as a monolith without great high available options, you are forced to time your releases accordingly. While I could just wait on changing the configuration until I'm ready, having more options is more useful than having less. |
I suspect it wouldn't be very difficult to hack together a systemd service unit to run the same docker image as is used by the chart. Granted, that only works for people running the master on linux, but it is a simple solution that avoids duplicated effort. |
I'm sure it's possible to hack anything together, but it doesn't mean that it's good design. I personally think automatic reload is useful, and I definitely will want it for some situations. However, the automatic reload should have the option to be disabled for situations where it would undesirable. This is pretty simple and achievable in a way that folks that want either can be satisfied. I'm not sure why this idea is met with resistance in favor of more complicated or fancy ideas. |
I think the simplest generic way of doing this would be: A webhook endpoint is added for reloading, which has a query parameter for authenticating the request (to prevent DoS attacks) |
I've implemented this via a Jenkinsfile that does 2 curls: one to check the config, and one to reload. An improvement we added is, instead of reload, to replace the config with ${env.WORKSPACE}. Add a git hook to this job, and you get a self-updating Jenkins whenever you push to master. Neat! Next step would be to write some groovy to do this. I would get rid of the curls, the auth token they need, and restrict the job/repo to just people that are Jenkins admins. |
@vladfr you can post to reload-configuration-as-code from git and it'll reload on push to master, you could do the validation on PR and then rely on git hook on master? |
@timja @ewelinawilkosz @ndeloof |
There's a webhook or CLI call you can make: |
@timja |
I think this will reload through groovy? |
@timja |
Have a look at the code if you're going to do stuff like this... |
@timja @ewelinawilkosz Our goal is reload yaml file on the fly which will reflect on OpenStack cloud configuration but I couldn't find any solution so far!!! I used groovy and yaml combined, and creating yaml file which will retrieve all images from OpenStack 4J Clouds what I got dynamically but when I try to reload that file on the fly to configure OpenStack cloud configuration it doesn't do anything!! It creates updated yaml file(whatever parameter i changed) but doesn't reload automatically!!! |
@MohammadRahaman Instead of being so demanding and excessive usage of exclamation marks. |
@Casz is there anyway can I apply this approach in Jenkins pipeline? When I used |
curl is a linux command-line tool and has nothing to do with groovy. |
@Casz
|
@ewelinawilkosz @timja Any suggestions please |
but what is your question now @MohammadRahaman ? |
@ewelinawilkosz But i want something like without manual interaction - it's like when jenkins job run on the fly it will set up the path automatic using environment variable and configured as well(changing existing to new configuration) which I declared in scripts but it won't. So my understanding it won't support 100% automatically. |
I'm afraid we can't help much more - as far as I understand automatic reload of configuration is possible to achieve, you seem to be asking about changing the location of configuration file ("set up the path") and that is not the scope of that issue and I am not sure it is a crucial feature - anyone can disagree of course |
The link for Corrected link is: |
manual reload of configuration is npw supported in UI
we need also a functionality to reload automatically when change in the file is detected - on disk or in git repository
The text was updated successfully, but these errors were encountered: