jenkinsci / jenkinsci/nodelabelparameter-plugin
[JENKINS-68991] Controller path altered in mixed OS environment
- Dominant language
- Java
- Stars
- 28
- Forks
- 59
- Avg merge
- 1h 24m
- Merged PRs (30d)
- 3
Description
We have an issue when running pipelines in a mixed environment with a Linux controller and Windows agents.
When using a pipeline job that uses either the node or label parameters, if the node defined by the param value is a windows node then the pipeline checkout stage fails.
Checking out git https://xxxxxxxxx.git into /xxx/xxxx/workspace@script to read resources/pipelines/playground/git-clone.groovy
The recommended git tool is: /usr/bin/git
using credential xxxxxxxxx
> /usr/bin/git rev-parse --resolve-git-dir /xxx/xxxx/workspace@script/.git # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://xxxxxxxx.git # timeout=10
Fetching upstream changes from https://xxxxxxxxxx.git
> /usr/bin/git --version # timeout=10
> git --version # 'git version 2.24.4'
using GIT_ASKPASS to set credentials Bitbucket Server (xxxxxxx)
> /usr/bin/git fetch --tags --force --progress -- https://xxxxxxxx.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://xxxxxxxxxx.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1001)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1242)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1302)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:154)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:68)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --force --progress -- https://xxxxxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: /xxx/xxxx/workspace@script@tmp/jenkins-gitclient-pass14582565555892846354.sh: line 3: cat: command not found
error: unable to read askpass response from '/xxx/xxxx/workspace@script@tmp/jenkins-gitclient-pass14582565555892846354.sh'
fatal: could not read Username for 'https://xxxxxxx.com': terminal prompts disabled
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
... 8 more
The path of the controller is perfectly fine and any pipeline that doesn't use the node or label parameter types is correctly checked out from the same scm system with the same credentials.
It appears that the path on the controller is being overwritten by the path of the node resolved by the param.
When we change the label param to a simple string param and resolve the nodes explicitly in the pipeline everything works correctly.
Its not clear is this is an issue in the node and label parameter plugin or the gitscm plugin or a combination of both.
---
Originally reported by ffsetit, imported from: Controller path altered in mixed OS environment
Raw content of original issue
We have an issue when running pipelines in a mixed environment with a Linux controller and Windows agents.
When using a pipeline job that uses either the node or label parameters, if the node defined by the param value is a windows node then the pipeline checkout stage fails.Checking out git https://xxxxxxxxx.git into /xxx/xxxx/workspace@script to read resources/pipelines/playground/git-clone.groovy
The recommended git tool is: /usr/bin/git
using credential xxxxxxxxx
> /usr/bin/git rev-parse --resolve-git-dir /xxx/xxxx/workspace@script/.git # timeout=10
Fetching changes from the remote Git repository
> /usr/bin/git config remote.origin.url https://xxxxxxxx.git # timeout=10
Fetching upstream changes from https://xxxxxxxxxx.git
> /usr/bin/git --version # timeout=10
> git --version # 'git version 2.24.4'
using GIT_ASKPASS to set credentials Bitbucket Server (xxxxxxx)
> /usr/bin/git fetch --tags --force --progress -- https://xxxxxxxx.git +refs/heads/*:refs/remotes/origin/* # timeout=10
ERROR: Error fetching remote repo 'origin'
hudson.plugins.git.GitException: Failed to fetch from https://xxxxxxxxxx.git
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:1001)
at hudson.plugins.git.GitSCM.retrieveChanges(GitSCM.java:1242)
at hudson.plugins.git.GitSCM.checkout(GitSCM.java:1302)
at org.jenkinsci.plugins.workflow.steps.scm.SCMStep.checkout(SCMStep.java:129)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:154)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:68)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:311)
at hudson.model.ResourceController.execute(ResourceController.java:101)
at hudson.model.Executor.run(Executor.java:442)
Caused by: hudson.plugins.git.GitException: Command "/usr/bin/git fetch --tags --force --progress -- https://xxxxxxxxxxx.git +refs/heads/*:refs/remotes/origin/*" returned status code 128:
stdout:
stderr: /xxx/xxxx/workspace@script@tmp/jenkins-gitclient-pass14582565555892846354.sh: line 3: cat: command not found
error: unable to read askpass response from '/xxx/xxxx/workspace@script@tmp/jenkins-gitclient-pass14582565555892846354.sh'
fatal: could not read Username for 'https://xxxxxxx.com': terminal prompts disabled
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2671)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2096)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:84)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:618)
at hudson.plugins.git.GitSCM.fetchFrom(GitSCM.java:999)
... 8 moreThe path of the controller is perfectly fine and any pipeline that doesn't use the node or label parameter types is correctly checked out from the same scm system with the same credentials.
It appears that the path on the controller is being overwritten by the path of the node resolved by the param.
When we change the label param to a simple string param and resolve the nodes explicitly in the pipeline everything works correctly.Its not clear is this is an issue in the node and label parameter plugin or the gitscm plugin or a combination of both.
environment
```
Jenkins: 2.350
OS: Linux - 3.10.0-1160.59.1.el7.x86_64
---
Office-365-Connector:4.17.0
ace-editor:1.1
ansible:1.1
ansicolor:1.0.1
ant:475.vf34069fef73c
antisamy-markup-formatter:2.7
apache-httpcomponents-client-4-api:4.5.13-1.0
artifactory:3.16.2
authentication-tokens:1.4
authorize-project:1.4.0
badge:1.9.1
bitbucket:223.vd12f2bca5430
block-queued-job:0.2.0
blueocean:1.25.5
blueocean-autofavorite:1.2.5
blueocean-bitbucket-pipeline:1.25.5
blueocean-commons:1.25.5
blueocean-config:1.25.5
blueocean-core-js:1.25.5
blueocean-dashboard:1.25.5
blueocean-display-url:2.4.1
blueocean-events:1.25.5
blueocean-git-pipeline:1.25.5
blueocean-github-pipeline:1.25.5
blueocean-i18n:1.25.5
blueocean-jira:1.25.5
blueocean-jwt:1.25.5
blueocean-personalization:1.25.5
blueocean-pipeline-api-impl:1.25.5
blueocean-pipeline-editor:1.25.5
blueocean-pipeline-scm-api:1.25.5
blueocean-rest:1.25.5
blueocean-rest-impl:1.25.5
blueocean-web:1.25.5
bootstrap4-api:4.6.0-5
bootstrap5-api:5.1.3-7
bouncycastle-api:2.26
branch-api:2.1046.v0ca_37783ecc5
build-blocker-plugin:1.7.8
build-failure-analyzer:2.3.0
build-monitor-plugin:1.13+build.202205140447
build-timeout:1.21
build-token-root:1.9
build-user-vars-plugin:1.8
caffeine-api:2.9.3-65.v6a_47d0f4d1fe
checkmarx:2022.2.3
checks-api:1.7.4
claim:2.18.2
cloudbees-bitbucket-branch-source:773.v4b_9b_005b_562b_
cloudbees-folder:6.722.v8165b_a_cf25e9
command-launcher:84.v4a_97f2027398
conditional-buildstep:1.4.2
config-file-provider:3.10.0
configurationslicing:430.v966357576543
copyartifact:1.46.4
credentials:1129.vef26f5df883c
credentials-binding:523.vd859a_4b_122e6
custom-tools-plugin:0.8
dashboard-view:2.432.va_712ce35862d
database:148.v4a_ff2ca_608b_7
database-mysql:1.4
dependency-check-jenkins-plugin:5.1.2
dependency-track:4.1.1
discard-old-build:1.05
display-url-api:2.3.6
docker-commons:1.19
docker-java-api:3.1.5.2
docker-swarm:1.11
docker-workflow:1.28
durable-task:496.va67c6f9eefa7
echarts-api:5.3.2-2
email-ext:2.88
embeddable-build-status:2.0.3
envinject:2.866.v5c0403e3d4df
envinject-api:1.199.v3ce31253ed13
extended-choice-parameter:0.82
external-monitor-job:191.v363d0d1efdf8
favorite:2.4.1
file-operations:1.11
font-awesome-api:6.1.1-1
git:4.11.3
git-changelog:3.23
git-client:3.11.0
git-server:1.11
github:1.34.3
github-api:1.303-400.v35c2d8258028
github-branch-source:1637.vd833b_7ca_7654
google-metadata-plugin:0.3.1
google-oauth-plugin:1.0.6
google-storage-plugin:1.5.6
gradle:1.38
greenballs:1.15.1
groovy:2.4
groovy-postbuild:2.5
h2-api:1.4.199
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-22.v77d5b_75e6953
htmlpublisher:1.30
http_request:1.15
ivy:2.2
jackson2-api:2.13.3-285.vc03c0256d517
javadoc:217.v905b_86277a_2a_
javax-activation-api:1.2.0-3
javax-mail-api:1.6.2-6
jaxb:2.3.6-1
jdk-tool:1.5
jenkins-design-language:1.25.5
jira:3.7.1
jjwt-api:0.11.2-71.v2722b_b_06a_2a_f
job-dsl:1.79
jobConfigHistory:1146.v94c2521f9213
jquery:1.12.4-1
jquery-detached:1.2.1
jquery3-api:3.6.0-4
jsch:0.1.55.2
junit:1119.va_a_5e9068da_d7
kpp-management-plugin:1.0.0
label-linked-jobs:6.0.1
labelled-steps:1.0
ldap:2.10
leastload:3.0.0
lockable-resources:2.15
mailer:414.vcc4c33714601
mapdb-api:1.0.9.0
matrix-auth:3.1.2
matrix-project:771.v574584b_39e60
maven-plugin:3.19
mercurial:2.16.2
metrics:4.1.6.2
mina-sshd-api-common:2.8.0-21.v493b_6b_db_22c6
mina-sshd-api-core:2.8.0-21.v493b_6b_db_22c6
momentjs:1.1.1
monitoring:1.91.0
msbuild:1.30
mysql-api:8.0.16
nested-view:1.25
newrelic-deployment-notifier:1.8
nodejs:1.5.1
nodelabelparameter:1.10.3.1
oauth-credentials:0.5
okhttp-api:4.9.3-105.vb96869f8ac3a
pam-auth:1.8
parameterized-trigger:2.44
pipeline-build-step:2.18
pipeline-graph-analysis:195.v5812d95a_a_2f9
pipeline-groovy-lib:591.v3a_7f422b_d058
pipeline-input-step:448.v37cea_9a_10a_70
pipeline-maven:3.10.0
pipeline-milestone-step:101.vd572fef9d926
pipeline-model-api:2.2086.v12b_420f036e5
pipeline-model-definition:2.2086.v12b_420f036e5
pipeline-model-extensions:2.2086.v12b_420f036e5
pipeline-rest-api:2.24
pipeline-stage-step:293.v200037eefcd5
pipeline-stage-tags-metadata:2.2086.v12b_420f036e5
pipeline-stage-view:2.24
pipeline-utility-steps:2.12.1
plain-credentials:1.8
plugin-util-api:2.17.0
popper-api:1.16.1-3
popper2-api:2.11.5-2
powershell:1.7
preSCMbuildstep:0.3
promoted-builds:3.11
publish-over:0.22
publish-over-ftp:1.17
pubsub-light:1.16
pyenv-pipeline:2.1.2
resource-disposer:0.19
role-strategy:488.v0634ce149b_8c
run-condition:1.5
saml:2.298.vc7a_2b_3958628
scm-api:608.vfa_f971c5a_a_e9
scmskip:1.0.3
script-security:1175.v4b_d517d6db_f0
simple-theme-plugin:103.va_161d09c38c7
snakeyaml-api:1.30.1
sonar:2.14
sse-gateway:1.25
ssh-agent:295.v9ca_a_1c7cc3a_a_
ssh-credentials:277.v95c2fec1c047
ssh-slaves:1.814.vc82988f54b_10
sshd:3.237.v883d165a_c1d3
stashNotifier:1.28
strict-crumb-issuer:2.1.0
structs:318.va_f3ccb_729b_71
test-results-aggregator:1.2.9
thinBackup:1.10
timestamper:1.17
token-macro:293.v283932a_0a_b_49
trilead-api:1.57.v6e90e07157e1
uno-choice:2.6.2
variant:1.4
view-job-filters:2.3
windows-slaves:1.8.1
workflow-aggregator:581.v0c46fa_697ffd
workflow-api:1153.vb_912c0e47fb_a_
workflow-basic-steps:948.v2c72a_091b_b_68
workflow-cps:2706.v71dd22b_c5a_a_2
workflow-cps-global-lib:588.v576c103a_ff86
workflow-durable-task-step:1139.v252a_e12e8463
workflow-job:1182.v60a_e6279b_579
workflow-multibranch:716.vc692a_e52371b_
workflow-scm-step:400.v6b_89a_1317c9a_
workflow-step-api:625.vd896b_f445a_f8
workflow-support:820.vd1a_6cc65ef33
ws-cleanup:0.42
openjdk version "11.0.14.1" 2022-02-08 LTS
OpenJDK Runtime Environment 18.9 (build 11.0.14.1+1-LTS)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.14.1+1-LTS, mixed mode, sharing)
```
1 attachment
- [Config-history-label_string.png](https://issues.jenkins.io/secure/attachment/58567/Config-history-label_string.png)
> 
Contributor guide
Research direction
Start by reproducing the pipeline checkout stage with a node or label parameter on a Linux controller and Windows agent. Trace how the resolved node affects the controller path and the GitSCM checkout, considering the nodelabelparameter and git-client components. Done means the checkout preserves the controller path and succeeds with credentials in the mixed-OS setup, with a regression test if the relevant test entry point is identified.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- git, java, linux
- Domain
- ci-cd, devops, infrastructure
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 28/100