Define a "Storage Id" for the folder that uses the CLI to load and display credentials

I use the CloudBees Folders subfolder plugin and Credentials Plugin to manage secrets in different pipeline jobs. Let's say I have a Jenkins folder structure like this.

folder1/
    folder2/
        job1

The folder plugin allows me to have credentials and credentials for folders, so only those jobs in these folders can access these credentials.

I can do this through the user interface, but we rotate these credentials so often and want to automate some of this.

One of the ways we thought to do this is to use the Jenkins CLI .

There are various commands provided by the credential plugin. For instance:

credential list . List of credentials in a specific store

java -jar jenkins-cli.jar -s http: // localhost: 8080 / list-credentials STORE

List of credentials in a specific store

SHOP : store identifier


list-credentials-context-resolvers - Credential List Context Recover

java -jar jenkins-cli.jar -s http: // localhost: 8080 / account-list-contextual resolvers

Credential List Contextual Recovers


list-credential providers . Credential Provider List

java -jar jenkins-cli.jar -s http: // localhost: 8080 / List-credentials-providers


STORE Jenkins , , system::system::jenkins.

, :

✗ java -jar credential-management/build/jenkinsAutomation/Localhost/cli/jenkins-cli.jar -s http://localhost:8080 list-credentials-context-resolvers --username admin --password password

: command line results-credentials-context-resolvers

:

✗ java -jar credential-management/build/jenkinsAutomation/Localhost/cli/jenkins-cli.jar -s http://localhost:8080 list-credentials system::system::jenkins --username admin --password password

: command line results

, STORE ( , ).

✗ java -jar credential-management/build/jenkinsAutomation/Localhost/cli/jenkins-cli.jar -s http://localhost:8080 list-credentials folder::items::folder1 --username admin --password password

ERROR: :: items:: folder1 :

error starting attempt to start credential list for folder

STORE , create-credentials-by-xml ? , Groovy ?

+4
1

, .

Provider::Resolver::ContextPath

Provider list-credentials-providers. folder .

Resolver list-credentials-context-resolvers. , . item items.

ContextPath Resolver. system jenkins. folder , . /folder1/subfolder1.

STORE folder::item::/folder1

+3

Source: https://habr.com/ru/post/1672949/


All Articles