jenkinsci / jenkinsci/configuration-as-code-plugin

Ability to preconfigure an API token via JCasC

Open
#1,830 16 comments 25 reactions 0 assignees View on GitHub
Dominant language
Java
Stars
2.8k
Forks
756
Avg merge
9h 47m
Merged PRs (30d)
10

Description

### What feature do you want to see added?

As @timblaktu notes in https://gitter.im/jenkinsci/configuration-as-code-plugin?at=60d7401b24f0ae2a242bba42 it seems impossible to preconfigure an API token for a user via JCasC. https://github.com/jenkinsci/jenkins/pull/4027 introduced a system property to generate one for `admin` but this only works if the setup wizard is run, which for JCasC users it would generally not be. I can use e.g.

```yaml
jenkins:
securityRealm:
local:
allowsSignup: false
users:
- id: admin
password: ${readFile:/var/password}
authorizationStrategy:
loggedInUsersCanDoAnything:
allowAnonymousRead: false
```

to preconfigure an initial password in a way that is friendly to generation from a Kubernetes `Secret` or the like, and this can be used for CLI operations, but not easily for REST operations using `POST` method since there will not be a crumb.

### Upstream changes

_No response_

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.