Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

$jenkins::port does not properly manage listening port #416

Closed
arioch opened this issue Oct 27, 2015 · 3 comments
Closed

$jenkins::port does not properly manage listening port #416

arioch opened this issue Oct 27, 2015 · 3 comments

Comments

@arioch
Copy link

arioch commented Oct 27, 2015

Unless I'm mistaken $::jenkins::port does not properly manage the listening port on EL 7:

Consider the following snippet:

class { '::jenkins':
  port => '80',
}

When applying this adjustment the config file remains unchanged.

# grep -ri jenkins_port /etc/sysconfig/jenkins
JENKINS_PORT="8080"

Which obviously results in the module not being able to manage a number of settings:

Notice: /Stage[main]/Jenkins::Service/Service[jenkins]/enable: enable changed 'false' to 'true'
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns: java.io.IOException: There's no Jenkins running at http://127.0.0.1:8080/
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     at hudson.cli.CLI.getCliTcpPort(CLI.java:288)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     at hudson.cli.CLI.<init>(CLI.java:128)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     at hudson.cli.CLIConnectionFactory.connect(CLIConnectionFactory.java:72)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     at hudson.cli.CLI._main(CLI.java:479)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     at hudson.cli.CLI.main(CLI.java:390)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:     Suppressed: java.io.FileNotFoundException: http://127.0.0.1:8080/cli
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:         at sun.net.www.protocol.http.HttpURLConnection.getInputStream(HttpURLConnection.java:1626)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:         at hudson.cli.FullDuplexHttpStream.<init>(FullDuplexHttpStream.java:78)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:         at hudson.cli.CLI.connectViaHttp(CLI.java:158)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:         at hudson.cli.CLI.<init>(CLI.java:132)
Notice: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns:         ... 3 more
Error: /usr/bin/java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://127.0.0.1:8080 groovy /usr/lib/jenkins/puppet_helper.groovy set_num_executors 3 returned 255 instead of one of [0]
Error: /Stage[main]/Jenkins/Jenkins::Cli::Exec[set_num_executors]/Exec[set_num_executors]/returns: change from notrun to 0 failed: /usr/bin/java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://127.0.0.1:8080 groovy /usr/lib/jenkins/puppet_helper.groovy set_num_executors 3 returned 255 instead of one of [0]
Notice: /Stage[main]/Jenkins/Anchor[jenkins::end]: Dependency Exec[set_num_executors] has failures: true
Warning: /Stage[main]/Jenkins/Anchor[jenkins::end]: Skipping because of failed dependencies
Notice: /Stage[main]/Jenkins::Cli::Reload/Exec[reload-jenkins]: Dependency Exec[set_num_executors] has failures: true
Warning: /Stage[main]/Jenkins::Cli::Reload/Exec[reload-jenkins]: Skipping because of failed dependencies
Notice: Applied catalog in 103.02 seconds
@jhoblitt
Copy link
Member

@arioch The port parameter appears to not presently do anything. A refactor of both the port handling and the docs is needed but the former is tricky to do without breaking backwards compatibility.

TL;DR -- try this instead:

class{ 'jenkins':
  config_hash => { 'HTTP_PORT' => { 'value' => '9090' }},
}

Ps. - I doubt you'll be able to bind jenkins directly to a privileged port with the current init script. I suggest using iptables or a proxy server -- I use nginx in front jenkins.

@jhoblitt
Copy link
Member

@arioch I'm going to close this ticket since it is a duplicate of #214 but please let us know if the example I provided doesn't solve the problem.

@tnstung
Copy link

tnstung commented Sep 7, 2016

@jhoblitt Your workaround doesn't work. It still persists HTTP_PORT=8080 in /etc/default/jenkins. If I manually change HTTP_PORT=9090 in default config, puppet will let it through like nothing:

Info: /Stage[main]/Jenkins::Config/Jenkins::Plugin[credentials]/Archive[credentials.hpi]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Config/Jenkins::Plugin[credentials]/File[/var/lib/jenkins/plugins/credentials.hpi.pinned]/ensure: created
Info: /Stage[main]/Jenkins::Config/Jenkins::Plugin[credentials]/File[/var/lib/jenkins/plugins/credentials.hpi.pinned]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Config/Jenkins::Plugin[credentials]/File[/var/lib/jenkins/plugins/credentials.hpi]/owner: owner changed 'root' to 'jenkins'
Notice: /Stage[main]/Jenkins::Config/Jenkins::Plugin[credentials]/File[/var/lib/jenkins/plugins/credentials.hpi]/group: group changed 'root' to 'jenkins'
Notice: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[JAVA_ARGS]/File_line[Jenkins sysconfig setting JAVA_ARGS]/ensure: created
Info: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[JAVA_ARGS]/File_line[Jenkins sysconfig setting JAVA_ARGS]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[AJP_PORT]/File_line[Jenkins sysconfig setting AJP_PORT]/ensure: created
Info: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[AJP_PORT]/File_line[Jenkins sysconfig setting AJP_PORT]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[JENKINS_PORT]/File_line[Jenkins sysconfig setting JENKINS_PORT]/ensure: created
Info: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[JENKINS_PORT]/File_line[Jenkins sysconfig setting JENKINS_PORT]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[HTTP_PORT]/File_line[Jenkins sysconfig setting HTTP_PORT]/ensure: created
Info: /Stage[main]/Jenkins::Config/Jenkins::Sysconfig[HTTP_PORT]/File_line[Jenkins sysconfig setting HTTP_PORT]: Scheduling refresh of Service[jenkins]
Notice: /Stage[main]/Jenkins::Service/Service[jenkins]: Triggered 'refresh' from 6 events
Notice: /Stage[main]/Jenkins::Cli/Exec[jenkins-cli]/returns: executed successfully
Notice: /Stage[main]/Jenkins::Cli_helper/File[/usr/share/jenkins/puppet_helper.groovy]/ensure: defined content as '{md5}d7821a6793c3c3a5fcb30901089d304e'

@smortex smortex changed the title $::jenkins::port does not properly manage listening port $jenkins::port does not properly manage listening port Nov 24, 2023
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants