Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle dorment login configuration in RundeckClientManager #53

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

norrs
Copy link

@norrs norrs commented Mar 2, 2023

Validate both username and password has value before trying to use passwordAuth.

An empty string leaves a valid Secret type, and login information seems
to stay from earlier plugin versions and has not been removed by the
plugin-upgrade-process. (That's my assumption)

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

norrs added 2 commits March 2, 2023 13:28
After upgrading rundeck plugin, I belive the login (read: username for
associated password) was removed from the plugin's configuration page.

At least I'm unable to see it, and I belive for long time users of this
plugin, where it maybe had username stored there once-in-its-lifetime
but have migrated over to api token usage instead .. gets bitten by this
test case.
before trying to use passwordAuth, ensure both are present.

An empty string leaves a valid Secret type, and login information seems
to stay from earlier plugin versions and has not been removed by the
plugin-upgrade-process.

This makes RundeckClientManager work-around the removed login
configuration which is no longer available in the plugin (as far as I
can see).
@norrs norrs force-pushed the use_token_or_username_password branch from 867c4b0 to bd56943 Compare March 2, 2023 12:28
@norrs
Copy link
Author

norrs commented Mar 2, 2023

I believe maybe the correct fix is to fix the upgrade process to remove dormant login information .. but I dont know the internals of jenkins.. so this kinda works for me..

/jenkins/manage/configure:

image

/job/foo/configure:

image

I don't see why it complains about User cannot be blank or null.

And when I fill in and try to remove everything on "Login" and "Password", and ensure I only have "Auth Token" and click save.. I even manage to get stacktrace such as:

java.lang.IllegalArgumentException: Password cannot be blank or null
	at org.rundeck.client.RundeckClient$Builder.validateNotempty(RundeckClient.java:321)
	at org.rundeck.client.RundeckClient$Builder.buildFormAuth(RundeckClient.java:240)
	at org.rundeck.client.RundeckClient$Builder.passwordAuth(RundeckClient.java:187)
	at org.jenkinsci.plugins.rundeck.client.RundeckClientManager.buildClient(RundeckClientManager.java:58)
	at org.jenkinsci.plugins.rundeck.client.RundeckClientManager.<init>(RundeckClientManager.java:31)
	at org.jenkinsci.plugins.rundeck.RundeckInstanceBuilder.createClient(RundeckInstanceBuilder.java:103)
	at org.jenkinsci.plugins.rundeck.RundeckNotifier$RundeckDescriptor.getRundeckJobInstance(RundeckNotifier.java:873)
	at org.jenkinsci.plugins.rundeck.RundeckNotifier$RundeckDescriptor.newInstance(RundeckNotifier.java:644)
	at org.jenkinsci.plugins.rundeck.RundeckNotifier$RundeckDescriptor.newInstance(RundeckNotifier.java:541)

Anyhow, this PR seems to fix things for me.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant