voxpupuli / puppet-jenkins

Puppet module for Jenkins
http://forge.puppetlabs.com/puppet/jenkins
Apache License 2.0
276 stars 566 forks source link

Sent to log in screen. No account yet created #641

Open wigglyampsltd opened 7 years ago

wigglyampsltd commented 7 years ago

Hi there,

Thanks for making this module. I'm hoping it will make my life considerably easier.

I have run into some teething problems getting this installed and configured on linux debian jessie. Installing the latest version at time of writing. If I include just include jenkins

I get a base install and upon going to the address i get the jenkins dashboard. Brilliant.

If I then add a line to include a plugin, let's say ant jenkins::plugin { 'ant': }

When I go to the jenkins url I get a login prompt. But I haven't provided any credentials yet. Who do I log in as?

I then tried to create a user as per the documentation. I get the chicken and egg circumstance where it get's a 403 trying to create a user.

I then tried the experimental jenkins_user type.

Could not find a suitable provider for jenkins_user

I then tried getting 'retries' installed, which I found as a solution in a different issue class { '::jenkins::cli::config':}

I get the following;

Could not prefetch jenkins_user provider 'cli': Execution of '/usr/bin/java -jar /usr/lib/jenkins/jenkins-cli.jar -s http://localhost:8080 groovy /usr/lib/jenkins/puppet_helper.groovy user_info_all' returned 1: Error: Unable to access jarfile /usr/lib/jenkins/jenkins-cli.jar

Then I gave up the will to live :) However, I would love to fully use the module for other than simply installing it. Any advice?

Regards Stephen Pengilley

dean36963 commented 7 years ago

Sometimes I notice I end up with a login prompt on a clean Puppet run and sometimes I don't, with no differences in my Puppet configuration. This sounds like your issue, as adding that ant plugin should have no effect on security settings either. I'm using version 1.7.0 of this module.

On the occasions I do end up with a login prompt, the /var/lib/jenkins/config.xml does exist, with <useSecurity>true</useSecurity> present. On the occasions I don't have a login prompt, the /var/lib/jenkins/config.xml does not exist.

My Puppet configuration doesn't mention any security (authorization or authentication) settings, and according to README.md:

Jenkins security is not managed by puppet unless jenkins::security is defined.

But somehow, security settings are being altered.

This is very hard to reproduce, as it doesn't happen every time.

Did you find any workarounds for this?

FransUrbo commented 7 years ago

This is how I do it:

# NOTE: Can't be called 'jenkins' because that would clash with 'puppet-jenkins'.
class role_jenkins {
    $adm_pw = hiera('jenkins_admin_user', undef)

    package { 'openjdk-9-jdk-headless':
        ensure => installed,
    } ->

    class { '::jenkins':
        version      => latest,
        repo         => true,
        install_java => true,
        executors    => 1,

        config_hash  => {
            'JENKINS_JAVA_OPTIONS' => {value => '-Djenkins.install.runSetupWizard=false'},
        },

        user_hash => {
            'admin' => {
                'password' => "$adm_pw",
                'email'    => 'it-ops@rpharms.com'
            }
        },

        plugin_hash => {
            'ace-editor'                 => { version => '1.1'     },
            # etc
        },

        job_hash => {
            'build' => {
                jobname => "Do_The_Build",
                config  => template("role_jenkins/jobs/build.xml")
            }
        }
    }
}