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

Modified credentialsId to never return null #135

Merged
merged 1 commit into from May 18, 2017
Merged

Modified credentialsId to never return null #135

merged 1 commit into from May 18, 2017

Conversation

oatmealraisin
Copy link

@oatmealraisin oatmealraisin commented May 18, 2017

Fixes #132

For getCredentialsId, we need to do a null check there. Somehow, the String is getting set to null, although not through its setter. This only happens when it is already emptystring.

@gabemontero @openshift/devex ptal?

Copy link

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

A couple of minor items, otherwise igtm pending test passing or failing because of unrelated flake

}

return "";
} catch(NullPointerException npe) {

Choose a reason for hiding this comment

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

catch Throwable instead of NullPointerException

Copy link
Author

Choose a reason for hiding this comment

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

Are we sure we want to catch everything, no matter what?

if (token != null) {
return token.getToken();
}

Choose a reason for hiding this comment

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

Add a small sleep ... maybe 500 milliseconds

@gabemontero
Copy link

gabemontero commented May 18, 2017 via email

@oatmealraisin
Copy link
Author

@gabemontero per scrum, looks like the only big change is returning nonnull in the getter for credentialsId. ptal?

Copy link

@gabemontero gabemontero left a comment

Choose a reason for hiding this comment

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

IGTM

Will hit merge button following test results.

@gabemontero
Copy link

Ah note the travis failure @oatmealraisin - mvn verify is not happy; please address

String credentialsId = GlobalPluginConfiguration.get().getCredentialsId();
if(credentialsId == "") {
return "";
}
Copy link

Choose a reason for hiding this comment

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

have you done any testing to confirm what value you get back when there is a credential configured?

@bparees
Copy link

bparees commented May 18, 2017

before we merge this i want to know that if the user has configured a credential for the plugin, we're not losing it during the reload.

@oatmealraisin
Copy link
Author

@bparees Non-empty credentialId's are definitely preserved. Putting a print in the getter, we can see:

May 18, 2017 6:48:30 PM io.fabric8.jenkins.openshiftsync.GlobalPluginConfiguration getCredentialsId
INFO: GREPME credentialsId: asdf
May 18, 2017 6:48:30 PM io.fabric8.jenkins.openshiftsync.GlobalPluginConfiguration getCredentialsId
INFO: GREPME credentialsId: asdf
May 18, 2017 6:48:37 PM io.fabric8.jenkins.openshiftsync.GlobalPluginConfiguration$1 doRun
INFO: Waiting for Jenkins to be started
May 18, 2017 6:48:37 PM io.fabric8.jenkins.openshiftsync.BuildConfigWatcher start
INFO: Now handling startup build configs!!
May 18, 2017 6:48:37 PM io.fabric8.jenkins.openshiftsync.GlobalPluginConfiguration getCredentialsId
INFO: GREPME credentialsId: asdf
May 18, 2017 6:48:37 PM io.fabric8.jenkins.openshiftsync.GlobalPluginConfiguration getCredentialsId
INFO: GREPME credentialsId: asdf

The restart happens at INFO: Waiting for Jenkins to be started. The credentialsId is the same before and after

@bparees
Copy link

bparees commented May 18, 2017

cool, thanks @oatmealraisin
lgtm

@bparees
Copy link

bparees commented May 18, 2017

@gabemontero gave lgtm and tests passed, so merging.

@bparees bparees merged commit e88d5b3 into openshift:master May 18, 2017
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.

None yet

3 participants