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

[JENKINS-61200] in case of authentication issue downloading avatar, refresh credentials and make cache time configurable #637

Merged

Conversation

olamy
Copy link
Member

@olamy olamy commented Aug 26, 2022

Signed-off-by: Olivier Lamy olamy@apache.org

Your checklist for this pull request

  • Make sure you are requesting to pull a topic/feature/bugfix branch (right side) and not your master branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or in Jenkins JIRA
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Did you provide a test-case? That demonstrates feature works or fixes the issue.

…efresh credentials and make cache time configurable

Signed-off-by: Olivier Lamy <olamy@apache.org>
@olamy olamy force-pushed the JENKINS-61200-refresh-credentials branch from 7af98de to 89655e6 Compare August 26, 2022 08:38
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Aug 26, 2022

This pull request fixes 1 alert when merging 89655e6 into f8a21d6 - view on LGTM.com

fixed alerts:

  • 1 for Potential input resource leak

@lgtm-com
Copy link
Contributor

lgtm-com bot commented Aug 29, 2022

This pull request fixes 1 alert when merging cd51fc2 into 863acff - view on LGTM.com

fixed alerts:

  • 1 for Potential input resource leak

Signed-off-by: Olivier Lamy <olamy@apache.org>
@lgtm-com
Copy link
Contributor

lgtm-com bot commented Aug 31, 2022

This pull request fixes 1 alert when merging 7d11b30 into 863acff - view on LGTM.com

fixed alerts:

  • 1 for Potential input resource leak

@olamy olamy marked this pull request as ready for review August 31, 2022 03:03
@olamy olamy mentioned this pull request Aug 31, 2022
6 tasks
@lifeofguenter lifeofguenter added enhancement java Pull requests that update Java code labels Aug 31, 2022
return CredentialsMatchers.firstOrNull(
CredentialsProvider.lookupCredentials(
credentials.getClass(),
(Item) null, // context
Copy link
Contributor

Choose a reason for hiding this comment

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

That would only found root global credentials and not folder credentials. If the credentials are defined in a folder or in the Multibranch item, this is unlikely to work ?
Don't we have access to the SCMOwner from here ?

Copy link
Member Author

Choose a reason for hiding this comment

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

Copy link
Member Author

@olamy olamy Aug 31, 2022

Choose a reason for hiding this comment

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

yup agree it's a possible problem..
but not sure how to fix it without changing the branch-api-plugin as well and a lot of refactoring here as well.
could be noted as a limitation.

Copy link
Member Author

Choose a reason for hiding this comment

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

I have a better solution but this need changes in scm-api and branch-api as well.
not sure we want this in the same PR

Copy link
Contributor

Choose a reason for hiding this comment

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

would this be a regression or edge casewith the new implementation?

Copy link
Member Author

@olamy olamy Sep 1, 2022

Choose a reason for hiding this comment

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

this PR fix issue with the current implementation at least for system credentials.
fixing it for folder as well will need more work, I will start the work for that.
But at least we could merge and release this PR as it's already better than the current code ;)
with this the problem will keep happening but only for credentials defined at folder level.
wdyt?

Copy link
Contributor

Choose a reason for hiding this comment

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

yeah and if I understand correctly, if folder credentials are used, the lookup will not find it and no fetch will be done. So worst case scenario, we don't have the avatar anymore, but no fetch, so no account locked down in bitbucket.
Good enough IMO.

@lifeofguenter
Copy link
Contributor

awesome stuff. Thanks @olamy for the great enhancement and thanks @Dohbedoh for having a look!

@lifeofguenter lifeofguenter merged commit beeaa47 into jenkinsci:master Sep 2, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement java Pull requests that update Java code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants