jenkinsci / remote-file-plugin

Remote File Plugin Repository
https://plugins.jenkins.io/remote-file/
MIT License
56 stars 16 forks source link

Upon changing agents, plugin tries do checkout the scanned repository #96

Open paulogodinhoaq opened 2 years ago

paulogodinhoaq commented 2 years ago

Describe the bug Plugin going into default behavior when changing agents. It begins without issue, checks out the Remote Pipeline and executes, but when a new agents is called in, before any pipeline action is taken, the plugin attempts to checkout the entire repo that is set in the Multibranch Pipeline, instead of the Remote one.

To Reproduce Steps to reproduce the behavior: Make a multi agent pipeline

Expected behavior The defined remote pipeline to be downloaded and used on all agents.

Screenshots If applicable, add screenshots to help explain your problem.

Desktop (please complete the following information):

13:56:56  Started by user Paulo Godinho
13:56:56  Checking out git git@github.com:company/consoles-engine-client-dll-builder.git into /var/jenkins_home/workspace/l-builder_feature_dll-auto-build@script/0c715dbd54feefe571a700899ea82cf5b6aa729750a2fa95ff7d94927bbadab9 to read test.jenkinsfile
13:56:56  The recommended git tool is: NONE
13:56:56  using credential tooling/jenkins/companybot_github_ssh/privatekey
13:56:56   > git rev-parse --resolve-git-dir /var/jenkins_home/workspace/l-builder_feature_dll-auto-build@script/0c715dbd54feefe571a700899ea82cf5b6aa729750a2fa95ff7d94927bbadab9/.git # timeout=10
13:56:56  Fetching changes from the remote Git repository
13:56:56   > git config remote.origin.url git@github.com:company/consoles-engine-client-dll-builder.git # timeout=10
13:56:56  Fetching upstream changes from git@github.com:company/consoles-engine-client-dll-builder.git
13:56:56   > git --version # timeout=10
13:56:56   > git --version # 'git version 2.30.2'
13:56:56  using GIT_SSH to set credentials SSH Private Key to access Github as company Bot
13:56:56   > git fetch --tags --force --progress -- git@github.com:company/consoles-engine-client-dll-builder.git +refs/heads/*:refs/remotes/origin/* # timeout=10
13:56:57   > git rev-parse refs/remotes/origin/main^{commit} # timeout=10
13:56:57  Checking out Revision 7339ad9459ee27371c00d4576f777c01fae2937e (refs/remotes/origin/main)
13:56:57   > git config core.sparsecheckout # timeout=10
13:56:57   > git checkout -f 7339ad9459ee27371c00d4576f777c01fae2937e # timeout=10
13:56:57  Commit message: "Fixing cleanup step"
13:56:57   > git rev-list --no-walk d075d6413d5521a0cc6bff7452a8d249676b6d3d # timeout=10
13:56:58  [Pipeline] Start of Pipeline
13:56:58  [Pipeline] withEnv
13:56:58  [Pipeline] {
13:56:59  [Pipeline] stage
13:56:59  [Pipeline] { (Verify if Build DLL is Required)
13:56:59  [Pipeline] node
13:56:59  Running on EC2 (PortUnit-EC2) - (Ubuntu) General purpose Ubuntu machine (i-0a154708cfa8e92da) in /home/ubuntu/Jenkins/workspace/l-builder_feature_dll-auto-build

[...] Running a bunch of stages and steps
[...] Time to do something in another machine

13:57:08  [Pipeline] { (Build DLLs)
13:57:09  [Pipeline] node
13:57:09  Running on EC2 (PortUnit-EC2) - (Windows) Persistent - 4.27 company-develop-plus-consoles (i-05ef20281730f8501) in C:\Jenkins\workspace\l-builder_feature_dll-auto-build
13:57:09  [Pipeline] {
13:57:09  [Pipeline] checkout
13:57:09  The recommended git tool is: git
13:57:11  using credential tooling/jenkins/companybot_github_ssh/privatekey
13:57:11   > git rev-parse --resolve-git-dir C:\Jenkins\workspace\l-builder_feature_dll-auto-build\.git # timeout=10
13:57:12  Fetching changes from the remote Git repository
13:57:12  Fetching without tags
13:57:12   > git config remote.origin.url git@github.com:company/my-project.git # timeout=10
13:57:12  Fetching upstream changes from git@github.com:company/my-project.git
13:57:12   > git --version # timeout=10
13:57:14  Checking out Revision cfa90907af9e63736a616eaeb976f80bf413d773 (feature/dll-auto-build)
13:57:13   > git --version # 'git version 2.36.0.windows.1'
13:57:13  using GIT_SSH to set credentials SSH Private Key to access Github as company Bot
13:57:13   > git fetch --no-tags --force --progress -- git@github.com:company/my-project.git +refs/heads/*:refs/remotes/origin/* # timeout=10
13:57:14   > git config core.sparsecheckout # timeout=10
13:57:14   > git checkout -f cfa90907af9e63736a616eaeb976f80bf413d773 # timeout=10

Is there something I may be missing? I will try to solve this by forwarding the actions to a secondary job.

aytuncbeken commented 1 year ago

HI @paulogodinhoaq That is the expected behavior. Jenkinsfile is checked out in the beginning of the pipeline. After that point only the repository which is defined under multibranch pipeline config is checked out.