jenkinsci / configuration-as-code-plugin

Jenkins Configuration as Code Plugin
https://plugins.jenkins.io/configuration-as-code
MIT License
2.68k stars 717 forks source link

Creation of Multiple Jenkins Users Doesn't Work (JCasC - SecurityRealm) #2190

Closed hilafish closed 1 year ago

hilafish commented 1 year ago

Jenkins and plugins versions report

Helm Chart 4.2.18 Jenkins Jenkins 2.375.1 Plugins - All latest:


Hi,

I tried setting up another user to get created once Jenkins goes up, via the SecurityRealm: directive, like that:

  JCasC:
    jenkins:          
      securityRealm: |-
        local:
          allowsSignup: false
          enableCaptcha: false
          users:
          - id: "admin"
            name: "Jenkins Admin"
            password: "${chart-admin-password}"
          - id: "ml-admin"
            name: "ML Admin"
            password: "Passw0rd"  

The first user gets created, but the second user doesn't. I'm actually not sure if it got created because of this configuration, or because of another one-

  admin:
    existingSecret: "jenkins-admin"
    userKey: jenkins-admin-user
    passwordKey: jenkins-admin-password  

So I have 2 questions since I couldn't find the answer myself in documentation:

  1. Is the first config I posted responsible for the users creation? if not, how can I create a second user?
  2. Is the second config I posted responsible for the admin user creation? additional note about that is when I add also -
    adminSecret: false

    and spin up Jenkins, it goes up without an admin user and the first screen I get when I browse Jenkins is asking me to create an admin user. (I added this since I'm using an existing secret, so I don't really need the chart to create the secret for the admin user)

Thanks, Hila

What Operating System are you using (both controller, and any agents involved in the problem)?

AWS EKS 1.24

Reproduction steps

  1. Use configuration as I posted above and see only admin user got created.

Expected Results

Two users should get created.

Actual Results

only admin user got created.

Anything else?

No response

hilafish commented 1 year ago

It works when I remove the ‘jenkins:’ directive from the configuration. Which I initially added because it didn’t work the other way.

Closing the issue.