sous-chefs / jenkins

Development repository for the jenkins cookbook
https://supermarket.chef.io/cookbooks/jenkins
Apache License 2.0
424 stars 635 forks source link

Support overriding PATH defined in init.d script #707

Closed astj closed 4 years ago

astj commented 5 years ago

Cookbook version

Met in 6.0, but same problem maybe occurs in. latest (6.2.1)

Chef-client version

13.6.4

Platform Details

Debian (9.7) in AWS. it may happen in other Debian-like distributions in other cloud providers.

Scenario:

I'd like to run Jenkins with AdoptOpenJDK.

AdoptOpenJDK does not provide official package and they recommend to install Somewhere outside /usr/bin and add the JDK path to PATH environment variable.

And I want to specify which PATH to search java executables to run Jenkins.

Since Jenkins' init.d run script defines default path to search java executable and allow override PATH by /etc/default/jenkins, I'd like to add PATH=/somewhere/to/jdk/jre/bin:$PATH to /etc/default/jenkins by this cookbook.

https://github.com/jenkinsci/packaging/blob/09137299df3e84cf4d87c8ca7d991aa94688a84c/deb/build/debian/jenkins.init#L16-L22

Steps to Reproduce:

Expected Result:

Declaring something like following will set PATH in /etc/default/jenkins

node['default']['jenkins']['path'] = '/opt/java-8-adoptopenjdk/jre/bin:$PATH'

Actual Result:

Cannot set PATH=... in /etc/default/jenkins, since template for /etc/default/jenkins in this cookbook does not support it.

welcomebot commented 5 years ago

Hey There It looks like this is the first issue you've filed against the chef-cookbooks project. I'm here to offer you a bit of extra help to make sure we can quickly get back to you. Make sure you've filled out all the fields in our issue template. Make sure you've provided us with the version of chef-client you're running, your operating system and the version of the cookbook. If you're not using the most up to date version of the cookbook then please make sure to update first. Lots of things change between versions even if you're issue isn't listed in the changelog. Finally please give us a detailed description of the issue you're having. The more we know about what you're trying to do, what actually happens, and how you can reproduce the problem, the better.

If you're looking for more immediate troubleshooting help make sure to check out #general on the Chef Community Slack. There's plenty of folks there willing to lend a helping hand. Thanks for the first issue. We hope we can get back to you soon with a solution.

astj commented 5 years ago

PoC of solution for this problem is following, which just writes PATH=... when path parameter is speified.

https://github.com/chef-cookbooks/jenkins/compare/master...astj:support-path?expand=1

github-actions[bot] commented 4 years ago

Marking stale due to inactivity. Remove stale label or comment or this will be closed in 7 days. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.

github-actions[bot] commented 4 years ago

Closing due to inactivity. If this is still an issue please reopen or open another issue. Alternatively drop by the #sous-chefs channel on the Chef Community Slack and we'll be happy to help! Thanks, Sous-Chefs.