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

pullRequest.setCredentials("username","password") is not working as intended #102

Open
ponsuyambu opened this issue Aug 31, 2021 · 4 comments
Labels

Comments

@ponsuyambu
Copy link

ponsuyambu commented Aug 31, 2021

Version report

Jenkins and plugins versions report:

Jenkins: 2.301
OS: Mac OS X - 10.16
---
jsch:0.1.55.2
ws-cleanup:0.39
blueocean-commons:1.24.7
mercurial:2.15
echarts-api:5.1.2-2
structs:1.23
google-play-android-publisher:4.1
jira:3.5
sicci_for_xcode:0.0.8
sse-gateway:1.24
apache-httpcomponents-client-4-api:4.5.13-1.0
subversion:2.14.4
file-operations:1.11
bootstrap5-api:5.0.1-2
sshd:3.0.3
pipeline-model-extensions:1.8.5
github-pullrequest:0.3.0
solarized-theme:0.1
external-monitor-job:1.7
workflow-aggregator:2.6
mailer:1.34
git:4.7.2
handy-uri-templates-2-api:2.1.8-1.0
blueocean-jira:1.24.7
parameterized-scheduler:1.0
theme-manager:0.6
pipeline-utility-steps:2.8.0
bootstrap4-api:4.6.0-3
analysis-core:1.96
android-lint:2.6
jquery3-api:3.6.0-1
command-launcher:1.6
dark-theme:0.0.12
workflow-api:2.46
workflow-job:2.41
ssh-credentials:1.19
authentication-tokens:1.4
blueocean-rest-impl:1.24.7
github-branch-source:2.11.1
htmlpublisher:1.25
simple-theme-plugin:0.6
javadoc:1.6
workflow-cps-global-lib:2.21
blueocean-web:1.24.7
jackson2-api:2.12.3
ssh-slaves:1.32.0
generic-webhook-trigger:1.74
docker-workflow:1.26
pipeline-stage-tags-metadata:1.8.5
pipeline-github:2.7
blueocean-pipeline-scm-api:1.24.7
pipeline-milestone-step:1.3.2
credentials:2.5
ruby-runtime:0.12
cloudbees-bitbucket-branch-source:2.9.9
jquery:1.12.4-1
github:1.33.1
lockable-resources:2.11
oauth-credentials:0.4
jquery-detached:1.2.1
throttle-concurrents:2.3
blueocean-personalization:1.24.7
workflow-scm-step:2.13
ansicolor:1.0.0
matrix-auth:2.6.7
matrix-project:1.19
pipeline-stage-step:2.5
pipeline-build-step:2.13
antisamy-markup-formatter:2.1
rvm:0.6
pipeline-graph-view:45.v8d8f990ab4bf
pipeline-input-step:2.12
ant:1.11
bouncycastle-api:2.20
allure-jenkins-plugin:2.29.0
checks-api:1.7.0
handlebars:3.0.8
google-oauth-plugin:1.0.6
permissive-script-security:0.6
blueocean:1.24.7
pipeline-github-lib:1.0
variant:1.4
momentjs:1.1.1
blueocean-jwt:1.24.7
ghprb:1.42.2
plain-credentials:1.7
docker-commons:1.17
cvs:2.19
hashicorp-vault-pipeline:1.3
git-client:3.7.2
timestamper:1.13
gradle:1.36
build-alias-setter:0.4
pipeline-rest-api:2.19
sauce-ondemand:1.194
android-apk-size-watcher:1.0.1
workflow-basic-steps:2.23
github-api:1.123
blueocean-i18n:1.24.7
appcenter:0.11.1
ldap:2.7
hashicorp-vault-plugin:3.8.0
blueocean-events:1.24.7
calendar-view:0.3.1
blueocean-core-js:1.24.7
next-executions:1.0.15
maven-plugin:3.12
DotCi:2.40.00
blueocean-config:1.24.7
blueocean-github-pipeline:1.24.7
fabric-beta-publisher:2.1
font-awesome-api:5.15.3-3
credentials-binding:1.26
pipeline-model-definition:1.8.5
config-file-provider:3.8.0
pipeline-stage-view:2.19
token-macro:2.15
slack:2.48
blueocean-display-url:2.4.1
workflow-multibranch:2.26
script-security:1.77
git-server:1.9
snakeyaml-api:1.29.1
pipeline-model-declarative-agent:1.1.1
workflow-step-api:2.23
run-condition:1.5
rebuild:1.32
okhttp-api:3.14.9
icon-shim:3.0.0
pipeline-graph-analysis:1.11
build-name-setter:2.2.0
blueocean-git-pipeline:1.24.7
popper2-api:2.5.4-2
pipeline-model-api:1.8.5
plugin-util-api:2.3.0
jenkins-design-language:1.24.7
windows-slaves:1.8
workflow-cps:2.92
popper-api:1.16.1-2
xcode-plugin:2.0.15
blueocean-autofavorite:1.2.4
material-theme:0.3.3
pipeline-gitstatuswrapper:1.2.0
workflow-durable-task-step:2.39
email-ext:2.83
trilead-api:1.0.13
branch-api:2.6.4
jdk-tool:1.5
cloudbees-folder:6.15
jacoco:3.3.0
blueocean-pipeline-editor:1.24.7
blueocean-dashboard:1.24.7
jjwt-api:0.11.2-9.c8b45b8bb173
durable-task:1.37
github-oauth:0.33
junit:1.51
pam-auth:1.6
disable-github-multibranch-status:1.2
pubsub-light:1.16
caffeine-api:2.9.1-23.v51c4e2c879c8
scm-api:2.6.4
blueocean-pipeline-api-impl:1.24.7
ace-editor:1.1
display-url-api:2.3.5
workflow-support:3.8
github-organization-folder:1.6
resource-disposer:0.16
blueocean-rest:1.24.7
build-timeout:1.20
favorite:2.3.3
blueocean-bitbucket-pipeline:1.24.7
mapdb-api:1.0.9.0

Reproduction steps

Calling pullRequest.setCredentials("username","password") does not have any effect. It still uses the credentials configured from the organisation.

I have properly invoked the above method before using any of the pullRequest object's methods and variables

Results

Expected result:

Should change the git credentials to the newly provided credentials

Actual result:

Still uses the old credentials even after invoking the above method.

@ponsuyambu ponsuyambu added the bug label Aug 31, 2021
@aaronwalker
Copy link
Member

@ponsuyambu have you tried calling pullRequest.refresh() after the setCredentials?

@ponsuyambu
Copy link
Author

@aaronwalker Yes, I called refresh as well. It didn't work. When I saw the source code, I noticed that refresh is not re-initiating the GitHub client instance.

@TueDissingWork
Copy link

Any update on this?

@TueDissingWork
Copy link

TueDissingWork commented May 23, 2023

I have tried various approaches to override the credentialId, but to no avail. But it seems to stay null. It is likely just be that are doing it wrong.

Maybe it would make more sense to store any custom credentialId in an env var?

The GitHubHelper.java class seems to just ignore any attempt to update the credential id, as it will always use the one from the scan credentails.

Any input to a different approach?

technicallyharwell added a commit to technicallyharwell/Over-Engineered-Todo that referenced this issue Sep 22, 2023
technicallyharwell added a commit to technicallyharwell/Over-Engineered-Todo that referenced this issue Dec 12, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants