Jump to content

Andres Mendez

Members
  • Posts

    1
  • Joined

  • Last visited

Posts posted by Andres Mendez

  1. I have a plastic client installed on the jenkins agent and wanted to use the mergebot shelve but came across this issue, what I ended up doing was doing the "merge to a shelve" in the agent itselfe

    this is the groovy sintax to do that

    def shelveId = powershell(script: '''
        $branchName = ''' + "'${env.PLASTICSCM_MERGEBOT_BRANCH_NAME}'" + '''
        $mergeOutput = cm merge br:/$branchName --to=br:/main --merge --shelve
        $Pattern = 'sh:(.*?) '
        Write-Host $mergeOutput
        $shelveId = (([regex]::Matches($mergeOutput, $Pattern)).Groups | Where-Object {$_.Name -eq '1'}).Value
        return $shelveId
    ''', returnStdout: true).trim()
    
    echo "Shelve ID: ${shelveId}" 
    // Apply the shelve to the workspace
    bat "cm shelveset apply sh:${shelveId}"

    hope this helps anyone that come cross this 

×
×
  • Create New...