Jump to content
Misieq

Jenkins PlasticSCM compatibility with Pipelines (workflows)

Recommended Posts

Hi Codice team

 

Do you plan to support in PlasticSCM Jenkins plugin Pipelines workflow?

It looks that with current version of plugin (2.5) checkout procces hangs if I add PlasticSCM as checkout step in workflow.

 

Jenkins 2.x looks to promote workflow approach, so it would be really great to have it supported also by Plastic.

I have feeling that it's not very high effort.

 

I have found following information about "adjusting" SCM plugins to work with workflow:

https://github.com/jenkinsci/pipeline-plugin/blob/master/COMPATIBILITY.md

https://github.com/jenkinsci/pipeline-plugin/blob/master/DEVGUIDE.md (SCM chapter)

https://github.com/jenkinsci/workflow-scm-step-plugin/blob/master/README.md (Generic SCM chapter)

Regards

PS. I know that possible workaround would be to use GitServer feature. But for that moment it is not available for me :)

Share this post


Link to post
Share on other sites

Hi

Just to know where we stand - do you plan in near future to update PlasticSCM Jenkins plugin in this area?

Thanks in advance for any info.

Regards

Share this post


Link to post
Share on other sites

Hi!

 

sorry for the delay answering, yes we want to keep evolving the Jenkins plugin. Let me add your suggestion to our list, we'll update this thread as soon as we start working on it.

Share this post


Link to post
Share on other sites

Just checked PlasticSCM Jenkins plugin v2.8

Looks that 'cm' steps now works fine :) (however no deep testing - just plugin installetion and single checkout).

Thanks for your effort.

Share this post


Link to post
Share on other sites

Hello

Recently we have started to use Jenkins Pipelines in more excesive way.

I have currently two observations regarding PlasticSCM:
1) If Pipeline script is taken from repository (e.g. Jenkinsfile) than workspace always gots delated and re-created (probably because at first Jenkins is recreating workspace to "script" folder - to checkout Jenkinsfile and later on back to regular one)

2) It is possible to configure Pipeline to checkout Jenkins file from PlasticSCM repository (PlasticSCM appears on dropdown list). However when job is already configured and you want to reconfigure it only Git and Subversion are seen at job configuration page (current configuration with PlasticSCM is not displayed but is preserved if you do not press Save/Apply).

 

Share this post


Link to post
Share on other sites

Is it in the pipeline (pun intended) to implement support for Jenkins Multibranch Pipeline jobs or is the recommendation still to enable the GitServer functionality?

Share this post


Link to post
Share on other sites

Hi,

we are successfully using Jenkins directly against Plastic Cloud (no GitServer intermediary involved). We are running into the same problem that @Misieq has reported:

Quote

2) It is possible to configure Pipeline to checkout Jenkins file from PlasticSCM repository (PlasticSCM appears on dropdown list). However when job is already configured and you want to reconfigure it only Git and Subversion are seen at job configuration page (current configuration with PlasticSCM is not displayed but is preserved if you do not press Save/Apply).

This bug is logged in Jenkins' issue database since some time back.

Now it sounds as though this is something which Codice software is aware of, and has fixed, according to release notes for 7.0.16.1902:

Quote

 

Jenkins plugin: There was an issue configuring existing pipeline projects. The PlasticSCM entry didn't appear in the SCM dropdown list if the pipeline was set to get the script from SCM. Fixed.

However, I have upgraded to Plastic SCM 7.0.16.1912 on my Jenkins master, and the problem remains. Same symptoms as in the Jenkins JIRA ticket.

(I think it is odd that the latest Ubuntu package is version 7.0.16.1912, when the latest readme on the Plastic site is for 7.0.16.1902. Not sure if that has any implication.)

If someone from Codice software is interested in doing more troubleshooting, feel free to reach out to me.

 

Share this post


Link to post
Share on other sites

Yes, sorry. This bug is already fixed but the fix hasn't been yet published in the Jenkins repository. Most probably it will be ready before the end of this week.

Sorry for the inconveniences,

Carlos.

Share this post


Link to post
Share on other sites

@calbzam do you plan also to implement "light check-out" of only Jenkinsfile instead of creation whole workspace?

I think that it should be enough to just use "cm cat" command to retrieve Jenkinsfile into temporary workspace, shouldn't it?

Share this post


Link to post
Share on other sites

Another question related to pipeline usage.

I'm trying to add a log of changes (currentBuild.changeSets) to an email.

Unfortunately, when using the pipeline, I can get only the "auther" and the "msg" properties from changeSets object.

 

When using the Ext-email plugin with freestyle project I define the email Content as follows: 

$PROJECT_DEFAULT_CONTENT${CHANGES_SINCE_LAST_SUCCESS, format="Changes from build %n:\n%c"}

and the log of changes is included in the mail. 

 

Any idea how to get more details (cs, date, repo-name, ...)  as appear in the /jenkins/job/<job name>/builds/<xx>/changeLog0.xml file generated by the plugin 

Edited by ok.dev
found the reason why I got "one long string" - was my mistake

Share this post


Link to post
Share on other sites

Hi,

I'm testing the Lightweight checkout feature. I have created a new Pipeline project (it is more or less a duplicate of an existing project) with "Pipeline from SCM". When I try to build with Lightweight checkout off, it works, but with Lightweight checkout on, I get the following error messages in the Jenkins log:

/var/lib/jenkins$ tail -n 12 /var/log/jenkins/jenkins.log

Apr 20, 2018 8:24:29 PM com.codicesoftware.plugins.hudson.PlasticTool execute
WARNING: The cm command 'checkselectorsyntax' failed. Retrying after 500 ms... (1)
Apr 20, 2018 8:24:30 PM com.codicesoftware.plugins.hudson.PlasticTool execute
WARNING: The cm command 'checkselectorsyntax' failed. Retrying after 500 ms... (2)
Apr 20, 2018 8:24:31 PM com.codicesoftware.plugins.hudson.PlasticTool execute
WARNING: The cm command 'checkselectorsyntax' failed. Retrying after 500 ms... (3)
Apr 20, 2018 8:24:31 PM com.codicesoftware.plugins.jenkins.PlasticSCMFile getRepObjectSpecFromSelector
SEVERE: null
Apr 20, 2018 8:24:31 PM org.jenkinsci.plugins.workflow.job.WorkflowRun finish
INFO: Tests/TestLightWeightCheckout #4 completed: FAILURE
Apr 20, 2018 8:24:31 PM org.jenkinsci.plugins.workflow.flow.FlowExecutionList unregister
WARNING: Owner[Tests/TestLightWeightCheckout/4:Tests/TestLightWeightCheckout #4] was not in the list to begin with: []

The Plastic SCM plugin then throws this error: https://github.com/jenkinsci/plasticscm-plugin/blob/931952b1b7903dc3fce22bc7cb392317d90e8e2d/src/main/java/com/codicesoftware/plugins/jenkins/PlasticSCMFile.java#L111

And the 'cm' version:

/var/lib/jenkins$ cm version
7.0.16.2143

Now, I don't know how to intercept and capture the exact CM command and its result. Enabling debugging at level 'debug' for cm.exe according to the article only gives me these corresponding messages for one of those 'cm checkselectorsyntax' invocations:

2018-04-20 20:35:00,772 INFO  1 cm - STARTING CLIENT
2018-04-20 20:35:00,971 DEBUG 1 ClientConfig - Time l2018-04-20 20:35:01,046 DEBUG 1 ClientConfig - Time loading client.conf (/var/lib/jenkins/.plastic4/client.conf) 238 ms
2018-04-20 20:35:01,086 DEBUG 1 cm - IsOutputRedirected: [Redirected]

 

Here is what the configuration looks like in the Jenkins project configuration page:

Selector:
repository "PongSP@<organization>@Cloud"
  path "/"
    smartbranch "/main"

Use update:
yes
  
Workspace name:
PongSP

Script Path:
PongSP/Jenkinsfile.Windows

 

OS version:

/var/lib/jenkins$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description:    Ubuntu 16.04.4 LTS
Release:        16.04
Codename:       xenial

 

Share this post


Link to post
Share on other sites

This may or may not be relevant:

Some source code comparison yields that in the Plastic SCM plugin, the older code in Workspaces.java uses the Hudson API function FilePath.createTextTempFile(). It places files in locations like "/var/lib/jenkins/workspace/Tests/TestLightWeightCheckout@script/PongSP/selector7941601814195684624.txt". However the newer code in PlasticSCMFile.java uses the native Java API function File.createTempFile() which will place files in the system's default temp folder.

There might be permissions problems with accessing the system-default temp folder when Jenkins runs things. In any case, it would be cleaner if the PlasticSCMFile code also kept its temp files in the Jenkins-designated temp file area.

Share this post


Link to post
Share on other sites

Hi @Mikael Kalms,

we need to release a new Plastic SCM version as well. The new Jenkins plugin is needing a new command that is not present in your installation.

We'll try to do it today, keep tuned.

Share this post


Link to post
Share on other sites

Hi again @Mikael Kalms,

we have just released the new Plastic SCM release that completes the new Jenkins plugin, please get it installed, at least, at the Jenkins environment and feel free to give us feedback about how it performs.

Best,
Manu.

Share this post


Link to post
Share on other sites

One positive note:

When using Light-weight Checkout, Jenkins will no longer pick up changes twice in its classic Pipeline view:

image.thumb.png.44c9d74f41048b0325e320e38018799f.png

(Blue Ocean's Pipeline only counts changes once, both with with full and light-weight checkout.)

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

×