Skip to content

[JENKINS-27045] Jenkins CLI --username/--password options#77

Merged
samrocketman merged 3 commits into
masterfrom
jenkins-cli-token
Mar 9, 2017
Merged

[JENKINS-27045] Jenkins CLI --username/--password options#77
samrocketman merged 3 commits into
masterfrom
jenkins-cli-token

Conversation

@samrocketman
Copy link
Copy Markdown
Member

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.

@samrocketman
Copy link
Copy Markdown
Member Author

@i386 any idea why my Jenkins builds are getting out of memory errors like https://jenkins.ci.cloudbees.com/job/plugins/job/github-oauth-plugin/332/console ?

Tests run: 0, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 95.752 sec - in InjectedTest
Tests run: 7, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 107.265 sec - in org.jenkinsci.plugins.GithubSecurityRealmTest
Exception: java.lang.OutOfMemoryError thrown from the UncaughtExceptionHandler in thread "main"

@samrocketman
Copy link
Copy Markdown
Member Author

samrocketman commented Feb 26, 2017

More out of memory woes. -> https://jenkins.ci.cloudbees.com/job/plugins/job/github-oauth-plugin/335/console

Builds just fine locally for me.

@samrocketman samrocketman force-pushed the jenkins-cli-token branch 2 times, most recently from d9f6ee0 to 3f64c19 Compare February 27, 2017 06:03
@samrocketman
Copy link
Copy Markdown
Member Author

Controlled the memory issue by adding .mvn/jvm.config and modifying src/test/java/org/jenkinsci/plugins/GithubSecurityRealmTest.java.

options.

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
Copy link
Copy Markdown
Member

@docwhat docwhat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@samrocketman samrocketman merged commit 3eeba9c into master Mar 9, 2017
@samrocketman samrocketman deleted the jenkins-cli-token branch March 9, 2017 04:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants