-
Bug
-
Resolution: Fixed
-
Major
-
Jenkins 1.599
github-oauth plugin 0.20
I'm using the github-oauth plugin for authentication and the Github Commiter Authorization Strategy and I'm unable to use the jenkins-cli with it. Running this command:
java -jar jenkins-cli.jar -s http://localhost:8080 who-am-i --username <username> --password <jenkins-api-token>
results in an error:
"--username" is not a valid option
java -jar jenkins-cli.jar who-am-i
Reports your credential and permissions.
I've also tried ssh key auth with the -i flag but get a similar error about -i being an invalid option.
Is there another way to use jenkins-cli with github auth?
- is related to
-
JENKINS-43822 Jenkins-cli seems to not support anything different from Github token
-
- Resolved
-
Code changed in jenkins
User: Sam Gleske
Path:
src/main/java/org/jenkinsci/plugins/GithubSecurityRealm.java
http://jenkins-ci.org/commit/github-oauth-plugin/d9f6ee0771dab210b9c88865e6c74cc5de58679e
Log:
JENKINS-27045Jenkins CLI -username/-passwordoptions.
Here's an example:
java -jar jenkins-cli.jar -s http://localhost:8080 -noKeyAuth who-am-i \
--username samrocketman --password-file ./personal-access-token
Unfortunately, Jenkins core prevents Jenkins CLI LoginCommand from
working correctly because it only stores the Username and mishandles
creating the authentication token. This is a [bug in core][1].
[1]: https://github.com/jenkinsci/jenkins/blob/jenkins-2.47/core/src/main/java/hudson/cli/ClientAuthenticationCache.java#L65-L75