jenkinsci / plasticscm-plugin

A plugin for Jenkins to be able to use Plastic SCM
MIT License
16 stars 31 forks source link

Status Check Applies to Incorrect Directory #66

Closed sca-andrew closed 1 year ago

sca-andrew commented 1 year ago

Jenkins and plugins versions report

Environment ```text Jenkins: 2.401.3 OS: Linux - 5.10.130-118.517.amzn2.x86_64 Java: 11.0.19 - Red Hat, Inc. (OpenJDK 64-Bit Server VM) --- ant:497.v94e7d9fffa_b_9 antisamy-markup-formatter:159.v25b_c67cd35fb_ apache-httpcomponents-client-4-api:4.5.14-150.v7a_b_9d17134a_5 bootstrap5-api:5.3.0-1 bouncycastle-api:2.29 branch-api:2.1122.v09cb_8ea_8a_724 build-timeout:1.31 caffeine-api:3.1.6-115.vb_8b_b_328e59d8 checks-api:2.0.0 cloudbees-folder:6.815.v0dd5a_cb_40e0e command-launcher:100.v2f6722292ee8 commons-lang3-api:3.12.0-36.vd97de6465d5b_ commons-text-api:1.10.0-36.vc008c8fcda_7b_ credentials:1271.v54b_1c2c6388a_ credentials-binding:631.v861c06d062b_4 display-url-api:2.3.7 durable-task:513.vc48a_a_075a_d93 echarts-api:5.4.0-5 email-ext:2.100 file-operations:131.v32b_e7824fe95 font-awesome-api:6.4.0-2 git:5.2.0 git-client:4.4.0 github:1.37.1 github-api:1.314-431.v78d72a_3fe4c3 github-branch-source:1728.v859147241f49 google-login:1.7 google-oauth-plugin:1.0.9 gradle:2.8.2 instance-identity:173.va_37c494ec4e5 ionicons-api:56.v1b_1c8c49374e jackson2-api:2.15.2-350.v0c2f3f8fc595 jakarta-activation-api:2.0.1-3 jakarta-mail-api:2.0.1-3 javax-activation-api:1.2.0-6 javax-mail-api:1.6.2-9 jaxb:2.3.8-1 jdk-tool:66.vd8fa_64ee91b_d jjwt-api:0.11.5-77.v646c772fddb_0 jquery3-api:3.7.0-1 jsch:0.2.8-65.v052c39de79b_2 junit:1217.v4297208a_a_b_ce ldap:682.v7b_544c9d1512 mailer:457.v3f72cb_e015e5 mapdb-api:1.0.9-28.vf251ce40855d matrix-auth:3.1.10 matrix-project:789.v57a_725b_63c79 mina-sshd-api-common:2.10.0-69.v28e3e36d18eb_ mina-sshd-api-core:2.10.0-69.v28e3e36d18eb_ msbuild:1.30 oauth-credentials:0.645.ve666a_c332668 okhttp-api:4.11.0-145.vcb_8de402ef81 pam-auth:1.10 pipeline-build-step:505.v5f0844d8d126 pipeline-github-lib:42.v0739460cda_c4 pipeline-graph-analysis:202.va_d268e64deb_3 pipeline-groovy-lib:656.va_a_ceeb_6ffb_f7 pipeline-input-step:468.va_5db_051498a_4 pipeline-milestone-step:111.v449306f708b_7 pipeline-model-api:2.2144.v077a_d1928a_40 pipeline-model-definition:2.2144.v077a_d1928a_40 pipeline-model-extensions:2.2144.v077a_d1928a_40 pipeline-rest-api:2.33 pipeline-stage-step:305.ve96d0205c1c6 pipeline-stage-tags-metadata:2.2144.v077a_d1928a_40 pipeline-stage-view:2.33 plain-credentials:143.v1b_df8b_d3b_e48 plasticscm-plugin:4.3 plugin-util-api:3.3.0 resource-disposer:0.22 scm-api:676.v886669a_199a_a_ script-security:1251.vfe552ed55f8d slack:664.vc9a_90f8b_c24a_ snakeyaml-api:1.33-95.va_b_a_e3e47b_fa_4 ssh-credentials:305.v8f4381501156 ssh-slaves:2.877.v365f5eb_a_b_eec sshd:3.303.vefc7119b_ec23 structs:324.va_f5d6774f3a_d subversion:2.17.2 timestamper:1.25 token-macro:359.vb_cde11682e0c trilead-api:2.84.v72119de229b_7 variant:59.vf075fe829ccb workflow-aggregator:596.v8c21c963d92d workflow-api:1251.vd4889a_b_0a_065 workflow-basic-steps:1017.vb_45b_302f0cea_ workflow-cps:3731.ve4b_5b_857b_a_d3 workflow-durable-task-step:1278.v94b_dc2b_50c6f workflow-job:1316.vd2290d3341a_f workflow-multibranch:756.v891d88f2cd46 workflow-scm-step:415.v434365564324 workflow-step-api:639.v6eca_cd8c04a_a_ workflow-support:848.v5a_383b_d14921 ws-cleanup:0.45 ```

What Operating System are you using (both controller, and any agents involved in the problem)?

Controller: Linux (Amazon 2) Agent: Windows 11

Reproduction steps

  1. Create a Pipeline script project
  2. Add a step to Checkout a repo from PlasticSCM Cloud into a directory. Note: This exactly our repro test script but the repository address has been removed; we've confirmed with multiple repos though.

    
    pipeline {
    agent any
    
    stages {
        stage('PlasticSCM Checkout') {
            steps {
                checkout(
                    poll: false,
                    scm:[
                        $class: 'PlasticSCM',
                        cleanup: 'MINIMAL',
                        credentialsId: '',
                        directory: 'Subdir',
                        pollOnController: false,
                        selector: 
                            '''
                                repository "<Repo>@<Org>@cloud"
                                    path "/"
                                        smartbranch "/main"
                            ''',
                        useMultipleWorkspaces: false,
                        workingMode: 'NONE'
                    ])
            }
        }
    }
    }
  3. Run the stage.

Expected Results

Previously this would result in a successful checkout of the repo into the desired sub directory and the stage progresses.

Actual Results

The checkout succeeds but the stage fails as it attempts to invoke a "Status" command, using the job root folder instead of the repo folder.

[Subdir] $ cm undocheckout --all --silent e:\workspace\Testing\SubFolderStatus\Subdir --server=@cloud [Subdir] $ cm setselector --file=e:\workspace\Testing\SubFolderStatus\Subdir\selector4512891004550128808.txt e:\workspace\Testing\SubFolderStatus\Subdir --server=@cloud Searching for changed items in the workspace... Setting the new selector... Unity VCS is updating your workspace. Wait a moment, please... [Subdir] $ cm status --cset E:\workspace\Testing\SubFolderStatus --server=@cloud e:\workspace\Testing\SubFolderStatus is not in a workspace. [Subdir] $ cm status --cset E:\workspace\Testing\SubFolderStatus --server=@cloud e:\workspace\Testing\SubFolderStatus is not in a workspace. [Subdir] $ cm status --cset E:\workspace\Testing\SubFolderStatus --server=@cloud e:\workspace\Testing\SubFolderStatus is not in a workspace. FATAL: The cm command 'cm status --cset E:\workspace\Testing\SubFolderStatus --server=@cloud' failed after 3 retries

Anything else?

No response