question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Folder credentials and its chicken-and-egg problem

See original GitHub issue

Hi CasC team, thanks for making this wonderful plugin! I am evaluating it to use it for my team.

I meet one blocking point: We want to use folder to group credentials (so we can separate CI and CD for security purpose), but:

  1. I don’t know how to configure credentials for folder
  2. I suspect that there is an chicken-and-egg problem that is not resolvable

Detail for point 1:

  • I have tried to export CasC, but it contains no folder credentials.
  • I have tried to look up the JSON schema, found no relating property

Detail for point 2:

  • I use job-dsl to configure all jobs and folders. AFAIK, DSL’s depends on credentials (for git checkout) and folder credentials depends on DSL (to spin up the folder).

So this looks like a chicken-and-egg problem.

So my questions are:

  • Has anyone in this community done this kind of setup before? If yes, would you please share a bit of examples?
  • Is this doable in current version?

Context:

  • Jenkins version: 2.164.1
  • Plugin version: 1.7
  • OS: Linux (official Jenkins image)

Issue Analytics

  • State:closed
  • Created 4 years ago
  • Comments:12 (7 by maintainers)

github_iconTop GitHub Comments

14reactions
linkealcommented, May 21, 2019

@twz123: Here is my example of a Job DSL that creates such a folder. CasC only creates a seed job in my case which checksout the Job DSL here.

folder("test") {
    description 'The folder contains all jobs for regular tests'
    properties {
        folderCredentialsProperty {
            domainCredentials {
                domainCredentials {
                    domain {
                        name("test")
                        description("Credentials necessary for our tests")
                    }
                    credentials {
                        usernamePasswordCredentialsImpl {
                            scope("GLOBAL")
                            id("test_user_id")
                            description("User for deployments on test environment")
                            username("test_user_dev")
                            password("password")
                        }
                    }
                }
            }
        }
    }
}

A bit strange why you need the “domainCredentials” encapsulated twice but this is the only way it is working for me. I figured it out this way by installing the plugins on my jenkins instance and then opening the documentation of the dynamic DSL. See https://github.com/jenkinsci/job-dsl-plugin/wiki/Dynamic-DSL how you can view it in your jenkins.

0reactions
holmesbcommented, Mar 8, 2020

Sorry if my comment wasn’t clear @linkeal , we’re trying to create a folder credential using job-dsl (by querying credentials provided by CasC - as suggested by @zhming0), not attach a credential to a job.

Our credentials are currently created by CasC and exist globally (not at folder level). The reason we are using both CasC and JobDSL is CasC mounts our kubernetes secret. This means in our code we can create a credential referring to a secret using ${OUR_SECRET} notation. But CasC offers no way to create folder credentials (@casz says this is a bad idea), so we must use job-dsl for this.

Read more comments on GitHub >

github_iconTop Results From Across the Web

How to avoid a chicken and egg scenario with encrypting ...
The problem is dealing with password rests, since the users private key is encrypted with the users password if the user forgets their...
Read more >
Terraform: chicken/egg problem - Maciej Matecki - Medium
The problem here is that for terraform block you cannot use resources or even variables. ... (don't forget to export AWS credentials).
Read more >
Hyper-V: Revisiting the Chicken and the Egg Paradox
This, of course, raises two questions. First, why do we no longer have to worry about the chicken and the egg paradox? Second,...
Read more >
On Demand Startups: 5 Ways to Solve the Chicken and Egg ...
Strategies To Solve The Chicken and Egg Problem for On Demand Startups · 1. Start Small · 2. Bring High Value Users on...
Read more >
C header file The chicken or The egg problem - Stack Overflow
The way to resolve the conflict is by adding a forward declaration of an incomplete structure type. The struct type used in the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found