Re: Prevent Archiving In a Pipeline

2019-01-22 Thread Cuong Tran
It seems to me you're leaving out some important details.  If you don't use 
"mvn install" in pipelineA and not sharing maven repo, I don't see how jobB 
would be getting the out generated by pipelineA.

On Monday, January 21, 2019 at 7:47:56 AM UTC-8, Ricardo Torres wrote:
>
> I have an upstream component, libraryA, I build, archive, and deploy via a 
> Maven job, jobA. This works great. I have a downstream Maven job, jobB, 
> that has a dependency on libraryA. This also works great, except…
>
>  
>
> I have a completely separate pipeline job, pipelineA specified by 
> Jenkinsfile. Within that Jenkinsfile, I build a specific branch of libraryA 
> I don’t want archived or deployed. In my Jenkinsfile I have 
> “withMaven(mavenLocalRepo: ‘libraryA/.repository’, publisherStrategy: 
> ‘EXPLICIT’)”, and inside that, “sh “””[…]mvn clean package 
> sonar:sonar[…]””” (Any typos here are probably the fault of my typing here 
> as I did not copy-paste. There are no errors from Jenkins when executing 
> these steps.) I have also tried “options: [artifactsPublisher(disabled: 
> true)]” in place of “publisherStrategy: ‘EXPLICIT’” and had the same 
> results. I have verified when pipelineA builds libraryA, it does NOT get 
> deployed to my remote Maven repository, and I expect it not to get deployed 
> there. Good.
>
>  
>
> So, what happens?
>
>  
>
> Well, if I build pipelineA followed by jobB, jobB gets its copy of 
> libraryA from pipelineA, causing the build to fail. If I then run jobA, 
> jobB succeeds as expected.
>
>  
> I could change the version of libraryA in the branch pipelineA builds, but 
> I’d rather not do that as it’s not correct for my particular use case. What 
> else could I do? What did I miss? (I do not admin this Jenkins instance, so 
> my access is limited in that respect.)
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/9667ce0d-71ea-441d-ab20-af7e63dcdb35%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to SET BUILD_USER variable from REMOTE API CALL to Jenkins Job

2018-11-16 Thread Cuong Tran
I don't think Jenkins has BUILD_USER var.  If you're using a plugin to 
generate it,  you may want to check there.

On Friday, November 16, 2018 at 2:57:24 AM UTC-8, rohit verma wrote:
>
> Hello, 
>
> I am calling a Jenkins Job from remote system by following command. 
>
> curl -k -v -H -XPOST 
> "https://:@JenkinsURL/job/JobName/buildWithParameters?token=TokenName=PRM_VALUE"
>
>
> What i noticed that the environment variable BUILD_USER is not set via 
> remote API call. (In my case BUILD_USER is null however the user is 
> triggering it with his/her authentication token). Is there a way to make 
> sure that BUILD_USER is set to the the user name of the caller of this job 
> via REST Like API (Curl command)?
>
>
> Thanks in advance. 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8c9e36db-0c71-48ba-87e9-bdc76f12dfc2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Where to find progress on the new pipeline engine?

2018-11-08 Thread Cuong Tran
I just watched the presentation from Jenkins World 2018 titled "Solving 
Pipeline Performance Problems with Systems Theory and How to Apply it to 
DevOps" [1] and it refers to the new implementation of the pipeline engine 
that seems to solve many the pain points I experience.   

Does anyone know where I find more details or track its status?

 [1] 
https://www.youtube.com/watch?v=h7yQcXvBdHo=PLvBBnHmZuNQJUESlp-Ey_0zbboThneyxb=0s=59

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e602d97c-6ae9-49f5-b2b0-e50b674929b7%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to use environment variable in Jenkins Pipeline build?

2018-11-08 Thread Cuong Tran
Where do you define your "environment variable"?   

It should work as ${BRANCH_TO_BUILD} if you define BRANCH_TO_BUILD under 
global environment variables, folder, inside your pipeline, etc.


On Thursday, November 8, 2018 at 8:56:38 AM UTC-8, ZillaYT wrote:
>
> Someone suggested using ${env.branchToBuild}, so I tried env.branchToBuild, 
> $env.branchToBuild, ${env.branchToBuild}, and "${env.branchToBuild}" all 
> to NO avail.
>
> On Thursday, November 8, 2018 at 10:26:34 AM UTC-5, ZillaYT wrote:
>>
>> I have a Jenkins Pipeline job which uses "Pipeline script from SCM" as my 
>> pipeline. One of this block's parameters is "Branch to build" of course. 
>> How can I used an environment variable for the text block? I tried, for 
>> example , $branchToBuild, ${branchToBuild} or "${branchToBuild}"  and it 
>> just takes those as literal values and does not extrapolate the string. I 
>> do have that variable defined and use it in other jobs.
>>
>> Is it just not possible to do this?
>>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7276a5ec-2a73-4665-90e7-90b96298911c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best way to set the job description for multi branch pipelines

2018-10-18 Thread Cuong Tran
Try this:

currentBuild.description = "You description"

On Wednesday, October 17, 2018 at 7:39:59 AM UTC-7, Lee, David wrote:
>
> Hi Jenkins users –
>
>  
>
> I am not seeing a really easy and clean way to set the Jenkins job 
> description for multi branch pipelines.  
>
>  
>
> The following code works, however, the downside is 3 in-process script 
> approvals are required (*method 
> org.jvnet.hudson.plugins.groovypostbuild.GroovyPostbuildRecorder$BadgeManager 
> getBuild*,  *field hudson.model.Run project*, and *method 
> hudson.model.AbstractItem setDescription java.lang.String*).
>
>  
>
> def project = manager.build.project
>
> project.setDescription("My job description.")
>
>  
>
> Am I missing something?  Is there a better way to codify the job 
> description into a Jenkinsfile and without requiring any script approvals?  
>  Would I need to create a  Jenkins plugin?
>
>  
>
> Any advice appreciated.  Thanks.  
>
> -D
>
>  
>
>  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e446d132-07cd-4dd0-9db0-0dddce1c1a92%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Problems with ENV variables in jenkins 2.1.41?

2018-09-06 Thread Cuong Tran
I would try to verify this with a FreeStyle job to see if the problem is 
somewhere else.

On Wednesday, September 5, 2018 at 9:55:21 AM UTC-7, Gorgonz ola wrote:
>
> [UPD]Nope, its not that simple, Returning to version 2.1.40 did not help. 
> Its likely a problem, that results from the newer packages, that are 
> installed with tumbleweed
>
> Am Mittwoch, 5. September 2018 12:46:50 UTC+2 schrieb Gorgonz ola:
>>
>> Again, I'm new to jenkins. So maybe someone should validate, that it is 
>> the jenkins version and not a different presumption ;-)
>>
>> Using jenkins 2.1.40 with opensuse leap 15.0:
>> - I'm able to define ENV variables in the global config
>> - a shell build step in order to echo the variables works fine
>>
>> The resultung konsole output from "echo HTDOCS_DIR $HTDOCS_DIR ..." is:
>>
>> + echo HTDOCS_DIR /srv/www/htdocs/
>> HTDOCS_DIR /srv/www/htdocs/
>> + echo JOOMLA4_DIR joomla4-dev
>> JOOMLA4_DIR joomla4-dev
>>
>>
>> Using jenkins 2.1.41 with opensuse leap thumbleweed:
>> - I'm able to define ENV variables in the global config
>> - a shell build step in order to echo the variables shows empty values
>>
>> The resulting konsole output is:
>>
>> + echo HTDOCS_DIR
>> HTDOCS_DIR
>> + echo JOOMLA4_DIR
>> JOOMLA4_DIR
>>
>>
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/948cfa7d-6a5a-4c46-9bb0-f0d0cf4da861%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to list pipeline tools from Global Tool Configuration?

2018-09-06 Thread Cuong Tran
Yes, you must be able to access that area to see a list.

On Thursday, September 6, 2018 at 5:11:51 AM UTC-7, Mr. Laubrino wrote:
>
> While going through this pipeline documentation section 
> https://jenkins.io/doc/book/pipeline/syntax/#tools - how can one know 
> possible pre-configured tools if he is not a Jenkins admin? (I suppose only 
> Jenkins admin can manage *Global Tool Configuration)*
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a82c506a-8d1b-4456-99a8-0c7d3e2c242b%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Is it possible to re-run init.groovy.d scripts whilst Jenkins is running?

2018-08-03 Thread Cuong Tran
Can't you run your script under script console /script?

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d6fd715e-63a0-49d4-8454-0c5485a78fed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I would like to downgrade the version of Python that Jenkins is using.

2018-05-18 Thread Cuong Tran
I don't believe Jenkins uses python.

On Monday, May 14, 2018 at 9:41:13 AM UTC-7, Patricia Sandt wrote:
>
> The Ubuntu 16.04 version of Python is 2.7. My build depends on this. 
> Jenkins is apparently using a newer version (3?), which doesn't work with 
> _html5lib.py in my build. Is there a way to force Jenkins to use a 
> particular version of Python?
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/56f64b31-1f5c-4086-8ab6-f742a0e13c80%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to create a pipeline job from inside a jenkinsfile?

2018-05-18 Thread Cuong Tran
Yes, you can use the job-dsl plugin (https://plugins.jenkins.io/job-dsl) to 
do that.

On Friday, May 18, 2018 at 2:00:45 AM UTC-7, John Lonergan wrote:
>
> Is it possible to create a multiranch pipeline job from a script in 
> another pipeline job.
> All driven by Jenkinsfiles?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2ef3b69f-1b60-45b7-a637-9997313e1e25%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Failure for initial Build

2018-01-16 Thread Cuong Tran
It looks like the project you referenced in the job doesn't exist.

On Sunday, November 26, 2017 at 4:32:51 AM UTC-8, Sridhar Babu wrote:
>
> Hi I am new to Jenkins and started Learning and for my trail getting below 
> Failure message.
> Could you please tell me what could be the issue
>
> Building in workspace C:\Program Files (x86)\Jenkins\workspace\atmosphere
>  > C:\Program Files\Git\bin\git.exe rev-parse --is-inside-work-tree # 
> timeout=10
> Fetching changes from the remote Git repository
>  > C:\Program Files\Git\bin\git.exe config remote.origin.url 
> https://github.com/g0t4/jenkins2-course-spring-boot.git # timeout=10
> Fetching upstream changes from 
> https://github.com/g0t4/jenkins2-course-spring-boot.git
>  > C:\Program Files\Git\bin\git.exe --version # timeout=10
>  > C:\Program Files\Git\bin\git.exe fetch --tags --progress 
> https://github.com/g0t4/jenkins2-course-spring-boot.git 
> +refs/heads/*:refs/remotes/origin/*
>  > C:\Program Files\Git\bin\git.exe rev-parse 
> "refs/remotes/origin/master^{commit}" # timeout=10
>  > C:\Program Files\Git\bin\git.exe rev-parse 
> "refs/remotes/origin/origin/master^{commit}" # timeout=10
> Checking out Revision 4bde91e33e2860b2aab142028c04eff37b7791f2 
> (refs/remotes/origin/master)
>  > C:\Program Files\Git\bin\git.exe config core.sparsecheckout # timeout=10
>  > C:\Program Files\Git\bin\git.exe checkout -f 
> 4bde91e33e2860b2aab142028c04eff37b7791f2
> Commit message: "Adding in jacoco code coverage"
>  > C:\Program Files\Git\bin\git.exe rev-list 
> 4bde91e33e2860b2aab142028c04eff37b7791f2 # timeout=10*[atmosphere] $ cmd.exe 
> /C "mvn -f spring-boot-samples/spring-boot-sample-atmosphere/pom.xml compile 
> && exit %%ERRORLEVEL%%"*
> \Jenkins\workspace\atmosphere\spring-boot-samples\spring-boot-sample-atmosphere
>  was unexpected at this time.
> Build step 'Invoke top-level Maven targets' marked build as failure
> Finished: FAILURE
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d76f8e4a-0bcd-4a7d-9c06-d0aa89b44f95%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Configuration that works for PRs and master

2018-01-16 Thread Cuong Tran
If you use Jenkinsfile, you can use BRANCH_NAME environment to detect 
whether it's from a PR or not. What you describes is pretty straight 
forward to do with Jenkins file. 

Check out:
https://jenkins.io/doc/book/pipeline/syntax/#when


On Tuesday, January 16, 2018 at 7:52:57 AM UTC-8, Hiesgen, Raphael wrote:
>
> Hello fellow Jenkins users, 
>
> I'll start with my goal, shortly describe what we have and than what I've 
> tried to achieve said goal. 
>
>
>
> # Goal 
>
> Create a Jenkins configuration that is triggered when a PR is opened or 
> manually to build the master branch for several OS / compiler 
> configurations. 
>
>
> # What we have 
>
> We currently make a distinction between the 'all' and 'pr' builds. The 
> 'all' job triggers builds for gcc, clang, msvc. These are separate 
> items/jobs that each have their own build matrix and configuration. 
>
> In contrast, the 'pr' configuration has its own build matrix and as a 
> result can only specify one build configuration which limits it to builds 
> with one compiler since we can't use the same cmake generator on Windows 
> and Linux. It also can't call the same builds as the 'all' job because I 
> haven't found a way to pass the branch and commit to pull into triggered 
> jobs (potentially reusing the jobs of the 'all' item). 
>
>
> # What we tried 
>
> 1. Find a way to pass branch / PR information to the compiler / OS 
> specific stages. The build step to 'trigger/call builds on other projects' 
> has an option to 'Pass-through Git Commit that was built' but I have no 
> clue what it passes on and how I could integrate that in the next stage. 
>
> 2. Let the 'all' and 'pr' jobs create an artifact that includes the code 
> to build in the subsequent jobs and pass them on. 
>
> 3. Move to a Pipeline job with a Jenkinsfile. My first problem here is 
> that i don't know how to distinguish between the PR trigger and the build 
> for the master branch to get the right code. Secondly, the parallel keyword 
> has changed recently? Previously you could generate a map with several 
> configuration and then call parallel and pass the map. That does not seem 
> to work anymore, is there a new way to do this? 
> (In general, writing a Jenkisfiles seems to require manual build scripts 
> where other (traditional?) Jenkins jobs offer build steps such as cmake and 
> ctest.) 
>
>
>
> Overall, I imagine that this is not an uncommon workflow. I've searched a 
> lot for similar problems but without success. Any help is appreciated! 
> Maybe I overlooked something obvious? 
>
> Thanks, 
> Raphael

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/e29afa8b-a65a-4f98-bd9a-9037595fd547%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: [Announce] Gerrit CI workflow to become a brand-new Jenkins plugin

2017-09-01 Thread Cuong Tran
Hi Luca,

Have you had a chance to publish this to github?

On Friday, August 18, 2017 at 2:17:00 AM UTC-7, Luca Milanesio wrote:
>
> Posting to the jenkinsci-users mailing list as well: even if I mainly 
> needed feedback from the plugins developers, feedback from a 
> user-perspective of the new plugin would be *really appreciated* as well :-)
>
> -- See below the original post --
>
> Hi Gerrit and Jenkins Community,
> after over two years of iterations and improvements of the Gerrit CI 
> workflow (https://gerrit-ci.gerritforge.com), I have decided that is 
> about time to extract the logic of our workflow and make it available as a 
> brand-new Jenkins plugin!
>
> *Why?*
> I wanted to use the Gerrit CI validation workflow with potentially any 
> project, including Gerrit plugins or anybody else wanting to adopt it.
> I could just "copy & paste" our Groovy workflow, however, that does not 
> seem a sensible and long-term approach.
> I wanted to have "something more" than a pure triggering mechanism: I 
> wanted to extend the power of Jenkisfile with the Gerrit review workflow 
> verbs.
>
> *Why not?*
> Why should I write yet another Gerrit/Jenkins plugin? Isn't Gerrit Trigger 
> Plugin (https://wiki.jenkins.io/display/JENKINS/Gerrit+Trigger) enough?
> We couldn't use it against gerrit-review.googlesource.com because stream 
> events are just not accessible.
>
> There are unresolved issues about:
> - Stability: stream-events are based on SSH, which isn't scalable, 
> reliable against downtime, etc.
> - Usability: at every JenkinsWorld conference people still come to me 
> asking "how do I setup correct the Gerrit Trigger plugin"?
> - Integration: using it inside a JenkinsFile isn't that straightforward 
> and multi-branch projects aren't supported either
>
> *What would it be?*
> I will publish a new plugin named "Gerrit Pipeline Plugin."
> The new name indicates:
> - Deep integration with Jenkins Pipeline
> - Out-of-the-box integration with Gerrit validation workflow in the 
> pipeline
>
> A simple example scripted Jenkinsfile would be:
>
> node {
> checkout scm
>
> gerrit.withServer("http://gerrit:8080/;, "gerrit") {
>
> try {
> docker.image('gerritforge/play-sbt-8-jdk-alpine').inside {
> stage('Build') {
> sh 'sbt compile'
> }
> stage('Test') {
> sh 'sbt 'test'
> }
> }
>
> gerrit.review("Verified", 1, "It works !")
> } catch (e) {
> gerrit.review("Verified", -1, "Breaks the build ;-(")
> throw e
> }
> }
> }
>
> (Where:
> - https://gerrit-review.example.com would be the Gerrit URL
> - mycredentialsid would be the id of the credentials to access Gerrit)
>
> One key-aspect will be: stateless, configuration-less (apart from the 
> credentials stored in Jenkins keychain)
> That means that multiple Jobs, multiple branches of the same Job, can have 
> their own Gerrit integration defined and working out-of-the-box.
>
> No more people asking "how do I configure the Gerrit integration"?
> You'll just define a gerrit.withServer() { } and ... it will just work.
>
> *When?*
> I am planning to showcase the first prototype of the new plugin at the 
> Jenkins World Conference in San Francisco inside my "Data-Driven Pipeline 
> workshop."
> (
> https://jenkinsworld20162017.sched.com/event/APTd/data-driven-pipeline-workshop-free
> )
> Shortly afterward, I will publish the plugin on the GerritForge's GitHub 
> account and will start the integration process into the Jenkins CI 
> organization.
>
> *Next steps?*
> A second iteration of the plugin would have a Declarative pipeline 
> equivalent as well, which would require even less code required.
> A third iteration of the plugin would support BlueOcean as well, to have a 
> fully UX-integrated experience.
> The goal is to have *Gerrit Code Review to be a 1st class citizen in the 
> Jenkins ecosystem* :-)
>
> *So what happens to the Gerrit Trigger Plugin?*
> The new plugin is not going to replace the current Gerrit Trigger Plugin, 
> but would rather represent an alternative to simpler scenarios when you 
> just require a standard Jenkinsfile Gerrit validation workflow. For all the 
> current users of the Gerrit Trigger Plugin things wouldn't change, unless 
> they need a more Jenkisfile-integrated experience.
>
> Feedback? Like it? Hate it? Have your say :-)
>
> Luca.
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2c459ab4-cc59-42b4-a02d-92a1069a56fa%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Pipeline - how to copy a directory of files from outside of workspace into a workspace using groovy?

2017-08-02 Thread Cuong Tran
You can't use normal groovy api since it only works on master.  Since 
you're already using unix slaves, just use a normal shell step will save 
you headaches.

On Wednesday, August 2, 2017 at 7:26:01 AM UTC-7, bbyjenkns wrote:
>
> We have a somewhat different use case where we have a bunch of common 
> config and build related files on NFS mount that need to be copied into 
> each build workspace. What I need to do is copy a directory out of this NFS 
> location and into workspaces as needed, a different directory per build 
> type. 
>
> Ideally I do this in groovy so I can get better exception handling and not 
> be tied to OS specific commands, but everything I've tried is breaking, 
> included the groovy preferred AntBuilder.copy() method.
>
> How would you copy a directory of files from outside of a workspace into a 
> workspace?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/45baa381-3aa6-4c99-9da2-59ffd4488385%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get access to a Maven POM version in a Freestyle build?

2017-07-27 Thread Cuong Tran
Make sure to use "-q" to get just the version:

VERSION=$(mvn -q -N -Dexec.executable="echo" 
-Dexec.args='${project.version}' 
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec)

On Thursday, July 27, 2017 at 12:17:33 PM UTC-7, Cuong Tran wrote:
>
> Eric,
>
> You certainly can run groovy script if you have the EnvInject plugin. 
>  Another way to obtain the pom version is to run shell command:
>
> mvn -N -Dexec.executable="echo" -Dexec.args='${project.version}' 
> org.codehaus.mojo:exec-maven-plugin:1.3.1:exec
>
>
> On Wednesday, July 26, 2017 at 2:24:52 PM UTC-7, Eric B wrote:
>>
>> Due to my project structure, and the desire to use the .mvn/maven.config 
>> configuration file to specify my default maven configuration, I have 
>> created my build definition as a Freestyle project.
>>
>> The build runs successfully, however I would like to include the version 
>> number in a tag in a post-build step.  Unfortunately, the maven POM_VERSION 
>> variable(s) are not accessible in a Freestyle project (only in a Maven 
>> build project).  Is there some other way I can extract the Version value 
>> from the pom.xml file?
>>
>> I found a link in StackOverflow (
>> https://stackoverflow.com/a/15879521/827480) executing a system groovy 
>> script but it was from 2013, and does not seem to export the POM_VERSION 
>> value as an environment variable in Jenkins 2.46+.  Additionally, from my 
>> understanding, this kind of workaround would only execute on a master node, 
>> which may be problematic.
>>
>> import jenkins.util.*;
>> import jenkins.model.*;
>>
>> def thr = Thread.currentThread();
>> def currentBuild = thr?.executable;
>> def workspace = currentBuild.getModuleRoot().absolutize().toString();
>>
>> def project = new XmlSlurper().parse(new File("$workspace/pom.xml"))
>>
>> def param = new hudson.model.StringParameterValue("POM_VERSION", 
>> project.version.toString())
>> currentBuild.addAction(new hudson.model.ParametersAction(param));
>>
>>
>>
>> Is there another (ie: better) way to extract the version number from the 
>> pom file in a freestyle build?
>>
>> Thanks,
>>
>> Eric
>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/1b27ac10-ee27-4345-8d62-68553f76ee55%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to get access to a Maven POM version in a Freestyle build?

2017-07-27 Thread Cuong Tran
Eric,

You certainly can run groovy script if you have the EnvInject plugin. 
 Another way to obtain the pom version is to run shell command:

mvn -N -Dexec.executable="echo" -Dexec.args='${project.version}' 
org.codehaus.mojo:exec-maven-plugin:1.3.1:exec


On Wednesday, July 26, 2017 at 2:24:52 PM UTC-7, Eric B wrote:
>
> Due to my project structure, and the desire to use the .mvn/maven.config 
> configuration file to specify my default maven configuration, I have 
> created my build definition as a Freestyle project.
>
> The build runs successfully, however I would like to include the version 
> number in a tag in a post-build step.  Unfortunately, the maven POM_VERSION 
> variable(s) are not accessible in a Freestyle project (only in a Maven 
> build project).  Is there some other way I can extract the Version value 
> from the pom.xml file?
>
> I found a link in StackOverflow (
> https://stackoverflow.com/a/15879521/827480) executing a system groovy 
> script but it was from 2013, and does not seem to export the POM_VERSION 
> value as an environment variable in Jenkins 2.46+.  Additionally, from my 
> understanding, this kind of workaround would only execute on a master node, 
> which may be problematic.
>
> import jenkins.util.*;
> import jenkins.model.*;
>
> def thr = Thread.currentThread();
> def currentBuild = thr?.executable;
> def workspace = currentBuild.getModuleRoot().absolutize().toString();
>
> def project = new XmlSlurper().parse(new File("$workspace/pom.xml"))
>
> def param = new hudson.model.StringParameterValue("POM_VERSION", 
> project.version.toString())
> currentBuild.addAction(new hudson.model.ParametersAction(param));
>
>
>
> Is there another (ie: better) way to extract the version number from the 
> pom file in a freestyle build?
>
> Thanks,
>
> Eric
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b634e3e4-79d6-450b-b115-05af67bdd291%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to set environment variable in multibranch pipeline?

2017-06-14 Thread Cuong Tran
Why?

On Wednesday, June 14, 2017 at 5:33:26 AM UTC-7, Mark Allison wrote:
>
> Thanks for the reply, but I need to set the variable outside the pipeline 
> script similar to the Environment Injector plugin. Is there a way to do 
> that?
>
> On Tuesday, 13 June 2017 13:36:07 UTC+1, Kevin Burnett wrote:
>>
>> here's an example Jenkinsfile that sets an environment variable 
>> (REPO_URL) that applies to all stages. you can also use the withEnv step to 
>> set an environment variable for a certain block.
>>
>> pipeline {
>>   agent { label 'docker' }
>>   environment {
>> REPO_URL = 'www.my.repo'
>>   }
>>   stages {
>> stage('build') {
>>   steps {
>> sh 'env | grep REPO_URL'
>>   }
>> }
>>   }
>> }
>>
>> Jenkinsfiles apply to all branches in a repo, so that part is handled 
>> implicitly.
>>
>> Hope this helps,
>> KB
>>
>>
>> On Tuesday, June 13, 2017 at 3:53:33 AM UTC-4, Mark Allison wrote:
>>>
>>> I have a Jenkins multibranch pipeline project and I want to set an 
>>> environment variable for all branches. Is this possible? I could only see a 
>>> way to do it with the environment injector plugin at the branch level. I 
>>> want to be able to do this at the project level because I want new feature 
>>> branches to automatically inherit some environment variables.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3f7e72cf-a497-4976-a7f4-03cf80dbc635%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins 2.0 pipeline as code executor question

2017-05-11 Thread Cuong Tran
Hi,

What I meant is to you should update your build script so it doesn't create 
files outside of the build workspace or anything that would prevent it to 
run concurrently. For example, this creates file inside your workspace and 
can run on multi-executor slave without any issue:

stage {
   sh 'rm -f hello.txt; date > hello.txt' # hello is inside workspace
   sh 'npm install foo'
}

where it would cause problems when you run it concurrently:

stage {
   sh 'rm -f /Users/devops/hello.txt; date > /Users/devops/hello.txt'
   sh 'npm install -g foo'
}


On Wednesday, May 10, 2017 at 8:40:31 PM UTC-7, Marslo Jiao wrote:
>
> What "avoid using locations outside of the workspace" means?
>
> On Thursday, May 11, 2017 at 1:10:59 AM UTC+8, Cuong Tran wrote:
>>
>> You should make your build commands work correctly when running inside 
>> the same node (avoid using locations outside of the workspace).
>>
>> On Wednesday, May 10, 2017 at 4:52:06 AM UTC-7, Marslo Jiao wrote:
>>>
>>> Is there anyway that I can manage the executor number for the same 
>>> Jenkins job (using jenkins 2.0 pipeline as code)? All multiple builds in 
>>> the same job will failed due to resource conflict.
>>>
>>>
>>> Here is my situation:
>>>
>>>
>>>- In the slave configuration, the *# of executors *was set as *2:*
>>>
>>>  
>>> <https://lh3.googleusercontent.com/-PiwUQGSuEqU/WRL8pFHrvsI/AFQ/6tL-IygHg-QPlzku2iWE90ElUyRZxDoHwCLcB/s1600/pipeline-executor-1.png>
>>>
>>>- But lots Jenkins job will be triggered on this node at the same 
>>>time:
>>>
>>>  
>>> <https://lh3.googleusercontent.com/-6LpTgQmbDAo/WRL82er_lFI/AFU/KO_P_BEWH74uCbMLngi_hsw-22ML8PThQCLcB/s1600/pipeline.png>
>>>
>>>
>>> The Jenkinsfile is:
>>> node ('ios') {
>>> stage ("Preparation") {
>>> sh '''
>>> ... ...
>>> '''
>>> }
>>> stage ("Preparation") {
>>> sh '''
>>> ... ...
>>> '''
>>> }
>>> ...
>>> }
>>>
>>> Thanks a lot.
>>>
>>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/195ce203-ed4e-4c54-9c26-12f21d937f3f%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins pipeline files present in sh blocks not present in later steps

2017-05-10 Thread Cuong Tran
The docs says you can only archive files in your workspace.  Try to write 
to the workspace instead:

--output-dir=${WORKSPACE}/report



On Wednesday, May 10, 2017 at 4:52:04 AM UTC-7, Berndt Jung wrote:
>
> I'm pretty new at this, but I'm stumped.
>
>
> Here is my stage block
>
> stage('Test') {
> steps {
> echo 'Testing ${env.JOB_NAME}:${env.BUILD_ID} on 
> ${env.JENKINS_URL}..'
> sh """
> docker run -v /tmp/work/report:/report 
> ${env.REPO}:${env.BUILD_ID} ./manage.py jenkins --enable-coverage 
> --output-dir=/report
> ls /work/report
> cat /work/report/*.xml
> """
> archiveArtifacts artifacts: '/work/report/*.xml'
> // junit '/work/report/*.xml'
> }
> }
>
> The files are present in the 'sh' block, as the output of the ls and cat 
> show. However, in the next step 'archiveArtifacts' and (if I enable it) 
> junit, the files are not found. What am I missing?
>
>
> Thanks in advance,
>
>
> Berndt
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ec67c378-f8ed-49aa-8e61-30f67326c3fe%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins 2.0 pipeline as code executor question

2017-05-10 Thread Cuong Tran
You should make your build commands work correctly when running inside the 
same node (avoid using locations outside of the workspace).

On Wednesday, May 10, 2017 at 4:52:06 AM UTC-7, Marslo Jiao wrote:
>
> Is there anyway that I can manage the executor number for the same Jenkins 
> job (using jenkins 2.0 pipeline as code)? All multiple builds in the same 
> job will failed due to resource conflict.
>
>
> Here is my situation:
>
>
>- In the slave configuration, the *# of executors *was set as *2:*
>
>  
> 
>
>- But lots Jenkins job will be triggered on this node at the same time:
>
>  
> 
>
>
> The Jenkinsfile is:
> node ('ios') {
> stage ("Preparation") {
> sh '''
> ... ...
> '''
> }
> stage ("Preparation") {
> sh '''
> ... ...
> '''
> }
> ...
> }
>
> Thanks a lot.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b2a7fd65-bed9-4b1f-946b-9d8269d9939a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How do I set env variable to currentBuild property in declarative pipeline environment.

2017-05-10 Thread Cuong Tran
Does it work with this?

withEnv(["BUILD_REVISION=${env.BUILD_REVISION}"]) {
sh "env | sort"
}

On Wednesday, May 10, 2017 at 8:20:45 AM UTC-7, JG wrote:
>
> I'm trying to set an env variable globally in my *pipeline {} *with a 
> concatenation of build details like this
>
> #!groovy
> pipeline {
> agent {
> label "linux"
> }
>   parameters {
> string(name: "releaseName", defaultValue: "RM_TEST", description: 
> "Ivy release spec")
> }
> tools {
> jdk 'jdk1.8.0_102'
> maven 'maven-3.2.5'
> }
> environment {
> BUILD_REVISION = 
> "${params.releaseName}.${env.BRANCH_NAME}.${currentBuild.startTimeInMillis}.${env.BUILD_ID}"
> RELEASE_NAME = "${params.releaseName}"
> }
> stages {
> stage("dummy") {
> steps {
> sh "echo 
> \"${params.releaseName}.${env.BRANCH_NAME}.${currentBuild.startTimeInMillis}.${env.BUILD_ID}\""
> sh "env | sort"
> }
> }
> }
> }
>
> and it seems to be silently failing. The *echo* command prints the value 
> as expected, but the *env *does not include a *BUILD_REVISION* variable 
> (the *RELEASE_NAME* env variable is shown in the output of *env*. I also 
> tried setting the *BUILD_REVISION* in an *environment{}* block within the 
> stage, and also tried using a string property of *currentBuild*. Nothing 
> seems to work.
>
> It seems to work using *withEnv* 
>
> steps {
> sh "echo 
> \"${params.releaseName}.${env.BRANCH_NAME}.${currentBuild.startTimeInMillis}.${env.BUILD_ID}\""
> 
> withEnv(["BUILD_REVISION=${params.releaseName}.${env.BRANCH_NAME}.${currentBuild.startTimeInMillis}.${env.BUILD_ID}"])
>  
> {
> sh "env | sort"
> }
> }
>
> But I'll need to use the variable in multiple stages so I'd prefer it to 
> be in a global *environment{}* block.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/7b16244a-d9e0-45e8-b184-7c0b5af550a4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Check to see if a Pipeline step exist?

2017-04-14 Thread Cuong Tran
All,

I need to be able to run the same pipeline code under Jenkins 1.x and 
Jenkins 2.x servers so I want to detect if a step exists and provide 
alternative.  

For example, the "archiveArtifacts" step doesn't exist in Jenkins 1.x. 
 Does anyone have a similar problem?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c54ea98a-b6a5-40e9-9119-2df740327b50%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Run pipeline only when new commits for a specific tag

2017-03-23 Thread Cuong Tran
Tags are mostly read-only, so I'm not sure what you're trying to do with 
"detect new commits" in specific tag.  You can probably say "trigger builds 
for any new tag that matches tags/develop/*" and your tags have to be 
"develop/v1", "develop/v2", etc.

On Thursday, March 23, 2017 at 2:45:05 AM UTC-7, Stefano Tranquillini wrote:
>
> Hi all,
>
> i've a pipeline that runs for my code, now, I work with Bitbucket and I 
> found a way to start the pipeline via the webhook, the problem is that it 
> builds every push, which I don't want.
> What I would like is that it build everythime the tag "develop" is pushed 
> to the remote and there are new commits. 
> The BitBucket webhook is raised every push, so I need to modify the pipe 
> in order to avoid building if there are no new commits in that speciic tag.
>
> node{
> properties([disableConcurrentBuilds(), buildDiscarder(logRotator(
> artifactDaysToKeepStr: '', artifactNumToKeepStr: '', daysToKeepStr: '', 
> numToKeepStr: '10')), parameters([string(defaultValue: '...', description: 
> '', name: 'CUSTOMER_ID'), string(defaultValue: 'Develop', description: '', 
> name: 'BUILD_ID'), string(defaultValue: '...', description: '', name: 
> 'CUSTOMER_KEY')])], pipelineTriggers([[$class: 'BitBucketTrigger']])
>
> stage('checkout'){
> checkout([$class: 'GitSCM', branches: [[name: '*/tags/develop'
> ]], doGenerateSubmoduleConfigurations: false, extensions: [[$class: 
> 'SubmoduleOption', disableSubmodules: false, parentCredentials: true, 
> recursiveSubmodules: true, reference: '', trackingSubmodules: false]], 
> submoduleCfg: [], userRemoteConfigs: [[credentialsId: '.', refspec: 
> '+refs/tags/*:refs/remotes/origin/tags/*', url: 'REMOTEURL']]])
> }
>
> stage('setup'){
> 
>
> }
> }
>
> How can I write an If for the checkout to say: exit if there are new 
> commits or keep going if there's a new commit compared to last build??
>
> PS: if i will have tags with version, so develop-1 develop-2, and I'll 
> change the branch to '*/tags/develop*' which branch will be built?
>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/a81f4ec6-8b37-414f-9838-765ca44de431%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Avoid activation of github webhook for pipeline shared library in the application job

2017-03-21 Thread Cuong Tran
I haven't tried this yet but can you add the "Don't trigger a build on 
commit notifications" in the scm configuration of the library definition?

On Saturday, March 18, 2017 at 6:42:31 PM UTC-7, Evgenii Pomnikov wrote:
>
> Hi!
>
> We call pipeline shared libraries in our Jenkinsfile via standard clause: 
> "@Library('pipeline-library') _" and noticed that github plugin 
> automatically activates webhooks for shared library repository as well as 
> for application one. We don't need to have webhook for shared library in 
> the application job, so is there any way to activate webhooks 
> automatically for application repository only in pipeline job?
>
> Looking forward for your answer.
> Have a nice day!
> ---
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/4f2d2394-97b4-4e0d-ac4b-7f52d038e2ef%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Declarative pipelines vs scripted

2017-03-21 Thread Cuong Tran
The declarative option is nice but you will lose the ability to extract out 
reusable code via the shared library.  For example, you can't do this yet:

MyCompanyStandardPipeline {
... // which will plugin standard sections...
}

On Thursday, March 16, 2017 at 8:55:48 PM UTC-7, Nick Le Mouton wrote:
>
> Hi,
>
> I'm just getting my head around pipeline as code and have converted my 
> previous Jenkins job/ant build targets to a Jenkinsfile. As I was looking 
> for documentation on the Jenkins site, I'm seeing mentions of declarative 
> pipelines and it differs from what I've written.
>
> Which method should I be looking to use (especially with blue ocean)? 
> Declarative or scripted? Why should I be using one over the other?
>
> Can I also get some feedback on my Jenkinsfile (
> https://gist.github.com/NoodlesNZ/bf9b50cab82093097796d354e37083f0)? It's 
> hard to find examples beyond "hello world"/simple pipelines.
>
> Thanks
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/fdd17e1a-35fa-41b2-bd16-e5c136a456f8%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trouble using MarkupBuilder DSL within Pipeline DSL

2017-03-21 Thread Cuong Tran
You need to approve it in the "In-process Script Approval" page under 
/manage.

On Tuesday, November 15, 2016 at 9:24:48 AM UTC-8, David Karr wrote:
>
> In my Jenkinsfile, I'm trying to use MarkupBuilder to construct a simple 
> XML message. I first discovered that there are default security 
> restrictions preventing the use of this class, which I was able to override.
>
> Next, I'm seeing errors that make it seem like the "methodMissing" calls 
> for XML elements within the MarkupBuilder DSL are going to the Pipeline DSL 
> instead.  I'm able to verify my method works in groovyConsole, but when I 
> run the job in Jenkins, I get an error like this:
>
> java.lang.NoSuchMethodError: No such DSL method 'statement' found among steps 
> [VersionNumber, archive, ...
>
>
> Where my method looks like this:
> def constructMessageXML(String qid, String qpassword, String contactID, 
> String text, boolean isMeeting) {
> def writer = new StringWriter()
> MarkupBuilder mb= new MarkupBuilder(writer)
> mb.message (type:"contact.send.message", id:qid, password:qpassword, 
> contactId:contactID) {
> statement (isMeeting ? [from:qid, to:contactID, text:text, type:
> "meeting"] : [from:qid, to:contactID, text:text]) {}
> }
> return writer.toString()
> }
>
>
> The list of steps from the error message are clearly from the Pipeline 
> DSL, not the MarkupBuilder DSL.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c03f6de6-3f6e-41db-a219-28b1b6e4cc84%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to make Jenkins build something on pushing to GitHub?

2017-03-21 Thread Cuong Tran
Your job need to have a scm configuration for it to be triggered on 
commits.  Either configure it as Multibranch Pipeline job or add a "git" or 
checkout step in your normal pipeline.

On Tuesday, March 21, 2017 at 12:52:30 PM UTC-7, Yuri Kanivetsky wrote:
>
> Hi,
>
> I have a pipeline job. It has "GitHub project" checked in settings. 
> Project url is specified. And "GitHub hook trigger for GITScm polling" is 
> checked in Build Triggers. I can see notifications coming from GitHub in 
> System Log:
>
> Mar 21, 2017 7:23:28 PM INFO 
> org.jenkinsci.plugins.github.webhook.subscriber.DefaultPushGHEventSubscriber 
> onEvent
> Received PushEvent for https://github.com/user/prj from 10.0.3.1 ⇒ 
> http://jenkins.rademade.com:8080/github-webhook/
> Mar 21, 2017 7:23:28 PM INFO 
> org.jenkinsci.plugins.github_branch_source.PushGHEventSubscriber onEvent
> Received PUSH for https://github.com/user/prj from 10.0.3.1 ⇒ 
> http://jenkins.rademade.com:8080/github-webhook/
>
> The job has hello world pipeline. Jenkins master node is running in lxc 
> container, if anything. And doesn't have slave nodes. But when I click 
> "Build Now" it sort of builds. I'm running Jenkins 2.32.3. Also, I fixed 
> Jenkins complaining about being run behind proxy, or something along those 
> lines.
>
> How do I make it build when pushing to GitHub repository? What do I check?
>
> Project url matches what's in the log, except for trailing slash. But when 
> I try to remove it, it reappears.
>
> Regards,
> Yuri
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3582be1a-1e0f-47f6-acb7-94e741e9e0c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to call a function defined within my Jenkinsfile

2017-03-21 Thread Cuong Tran
You can call any function the normal way:

*stage (build) {*
*  buildProject(meta)*
*}*

*def buildProject(meta) {*
*  node {*
*  //whatever i need to do*
*  }*
*}*

On Tuesday, March 21, 2017 at 10:02:34 AM UTC-7, ishan jain wrote:
>
> Probably i am being silly, but seriously i am not able to call a function 
> which i have defined in my Jenkinsfile from within a step. Here is a sample:
>
> *def meta = "something"*
>
> *stage (build) {*
>
> *  buildProject(meta)*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *  node {*
> *  //whatever i need to do*
> *  }*
> *  }*
> *}*
>
> This simply does not do anything. I tried various combos to try n call it, 
> but nothing. *How exactly should i call a function ?*
>
> *def meta = "something"*
>
> *stage (build) {*
> *  node {*
> *  buildProject(meta)*
> *  }*
> *}*
>
> *def buildProject(meta) {*
> *return {*
>   
> *  //whatever i need to do*
>   
> *  }*
> *}*
>
>
>
> *def meta = "something"*
>
> *stage (build) {*
> *  step {*
> *  buildProject(meta)*
> * }*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *  node {*
> *  //whatever i need to do*
> *  }*
> *  }*
> *}*
>
>
>
> *def meta = "something"*
>
> *stage (build) {*
>
> *  def output =  buildProject(meta)*
> *}*
>
> *def buildProject(meta) {*
> *return {*
> *  node {*
> *  //whatever i need to do*
> *  }*
> *  }*
> *}*
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d01ff147-2576-4841-a632-1a72d60178ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Declarative pipeline: access JenkinsLocationConfiguration.getAdminAddress()?

2017-03-21 Thread Cuong Tran
You can access it via:

hudson.model.JenkinsLocationConfiguration.get().getAdminAddress()


You could also define a global variable on Jenkins and access it as 
"env.JENKINS_EMAIL".

To take it a step further, you can encapsulate the whole thing in a library 
using Global Shared Library plugin:

  https://jenkins.io/doc/book/pipeline/shared-libraries

On Monday, March 20, 2017 at 2:28:12 PM UTC-7, Jon Dufresne wrote:
>
> Hi,
>
> I have several multibranch pipeline jobs that all use a declarative 
> pipeline. The Jenkinsfiles contain the following snippet:
>
> post {
> failure {
>   step([$class: 'Mailer', recipients: 'c...@example.com ', 
> sendToIndividuals: true])
> }
>   }
>
> I would like to avoid hard coding the address "c...@example.com 
> " in all Jenkinsfiles. It is repetitive and is also 
> incorrect when testing on a staging server or in a VM.
>
> It occurred to me that one option could be to send to the address 
> "JenkinsLocationConfiguration.getAdminAddress()" [0], as this is configured 
> correctly in all scenarios listed above.
>
> Is there an easy way to access this value from a Jenkinsfile? Is it 
> available as some local or environment variable? A normal groovy import and 
> method call didn't work and instead raised an exception.
>
> If there is a better way to configure this globally, I'd consider that as 
> well.
>
> Cheers,
> Jon
>
> [0] 
> http://javadoc.jenkins.io/jenkins/model/JenkinsLocationConfiguration.html#getAdminAddress()
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2014b1d4-e910-4f06-b26f-8bbb5a56b92e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkinsfile for monorepo?

2017-03-10 Thread Cuong Tran
You can specify the path to the Jenkinsfile, "projectA/Jenkinsfile". 
 Doesn't work for multi-branch pipeline though.

On Friday, March 10, 2017 at 6:30:54 AM UTC-8, robert...@dealertrack.com 
wrote:
>
> Anyone using pipeline/Jenkinsfile for a repository having several child 
> projects/"monorepo"?  
>
> We are using one top-level Jenkinsfile with conditional building based on 
> what is in the diff, wondering if there is a way to have each project use 
> it's own Jenkinsfile instead.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f4335ef5-bab7-4cb4-9906-c91ec7f46d01%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: I need to know Bundled Plugins version numbers for Jenkins 2.5

2016-10-28 Thread Cuong Tran
The version number are embedded inside the files.  Unzip them to find out.

On Friday, October 28, 2016 at 12:26:18 PM UTC-7, Robert Kruck wrote:
>
> For Jenkins 2.5 I know which are its bundled plugins by examining the 
> *.hpi files associated with Jenkins 2.5, but I don't know the versions of 
> these plugins.
>
> I know there are scripts to find out bundled plugins' versions but I am 
> not allowed to download them to my workplace computer.
>
> Does anyone know the version numbers, of the Jenkins 2.5 bundled plugins 
> listed below:
>
> ModeLastWriteTime Length Name
> - -- 
> -a--- 6/15/2016  11:09 AM  90421 
> ant.hpi  
> -a--- 6/15/2016  11:09 AM 112483 
> antisamy-markup-formatter.hpi   
> -a--- 6/15/2016  11:09 AM 406478 
> credentials.hpi  
> -a--- 6/15/2016  11:09 AM 929025 
> cvs.hpi 
> -a--- 6/15/2016  11:09 AM  55546 
> external-monitor-job.hpi
> -a--- 6/15/2016  11:09 AM  38073 
> javadoc.hpi  
> -a--- 6/15/2016  11:09 AM 331127 
> junit.hpi   
> -a--- 6/15/2016  11:09 AM 101895 
> ldap.hpi
> -a--- 6/15/2016  11:09 AM 128645 
> mailer.hpi  
> -a--- 6/15/2016  11:09 AM  79681 
> matrix-auth.hpi  
> -a--- 6/15/2016  11:09 AM 238601 
> matrix-project.hpi  
> -a--- 6/15/2016  11:09 AM   10805330 
> maven-plugin.hpi
> -a--- 6/15/2016  11:09 AM1030550 
> pam-auth.hpi
> -a--- 6/15/2016  11:09 AM 164546 
> script-security.hpi  
> -a--- 6/15/2016  11:09 AM  74973 
> ssh-credentials.hpi 
> -a--- 6/15/2016  11:09 AM  64366 
> ssh-slaves.hpi   
> -a--- 6/15/2016  11:09 AM4683101 
> subversion.hpi  
> -a--- 6/15/2016  11:09 AM  50065 
> translation.hpi 
> -a--- 6/15/2016  11:09 AM 949638 
> windows-slaves.hpi  
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/b8b2baf5-67e2-45da-9236-732806d36289%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Maintaining a unique Build Number across multiple build servers

2016-09-20 Thread Cuong Tran
It doesn't exist.

On Monday, September 19, 2016 at 12:54:15 PM UTC-7, Robert Kruck wrote:
>
>  Is it possible to preserve the integrity of build numbers (NO DUPLICATES 
> and build numbers in order) while building in multiple Jenkins build 
> servers?
>
> If this capability exists in Jenkins, what Jenkins plugins are required, 
> and what versions of Jenkins itself, and of the required Jenkins plugins, 
> are needed?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/3724115c-6472-418f-9622-3e76e8bc1d4a%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: terminate pipeline parallal on first failure

2016-09-20 Thread Cuong Tran
The reference link is right on any pipeline job.  You should see a 
"Pipeline Syntax" link, click on that will give a list of known steps, the 
click on the question icon will give you an example.


On Tuesday, September 20, 2016 at 1:57:43 PM UTC-7, asmundo wrote:
>
> Thank you Baptiste!
>
> Tested and it worked. You owe you a beer! 
>
> I am new to pipeline programming. I worked several hours today on this and 
> other pipeline related work. Could you please point me to the documentation 
> of this syntax? I must have been looking in the wrong location. 
>
> Cheers
>
>
>
> On Tue, Sep 20, 2016 at 10:47 PM, Baptiste Mathus  > wrote:
>
>> Hi,
>>
>>  stage('tests') {
>> parallel 'longTests': {
>> build job: 'testjob1', quietPeriod: 0
>> }, 'shortTests':{
>> // this will fail 1 sec
>> build job: 'testjob2', quietPeriod: 0
>> }, failFast: true   
>>
>> }
>>
>> Cheers
>>
>> 2016-09-20 22:43 GMT+02:00 Åsmund Østvold > >:
>>
>>> hi All,
>>>
>>> Do anybody have an example or a pointer to how one could terminate a 
>>> parallel pipeline section on first failure?
>>>
>>> The use case is that I have 14 tests in a checkin regression pipeline. 
>>> Some tests take 2 min some take 40 min. To speed up feedback to the users 
>>> we want to give feed back ASAP if a test did fail. 
>>>
>>> My test pipeline is:
>>>
>>> stage('tests') {
>>> parallel 'longTests': {
>>> build job: 'testjob1', quietPeriod: 0
>>> }, 'shortTests':{
>>> // this will fail 1 sec
>>> build job: 'testjob2', quietPeriod: 0
>>> }
>>> }
>>>
>>> My current "pipeline" (Build-flow) is able to do this with a ugly hack:
>>>
>>> import static hudson.model.Result.FAILURE
>>> import groovy.time.*
>>>
>>> parallel (
>>>   { b = build("testjob1")
>>> if (b.getResult().toString() != "SUCCESS") {
>>> upstream.getExecutor().interrupt(FAILURE)
>>>}
>>>   },
>>>   { b = build("testjob2"])
>>> if (b.getResult().toString() != "SUCCESS") {
>>> upstream.getExecutor().interrupt(FAILURE)
>>>}
>>>   }
>>> )
>>>
>>> Regard,
>>> Asmund
>>>
>>> -- 
>>> You received this message because you are subscribed to the Google 
>>> Groups "Jenkins Users" group.
>>> To unsubscribe from this group and stop receiving emails from it, send 
>>> an email to jenkinsci-use...@googlegroups.com .
>>> To view this discussion on the web visit 
>>> https://groups.google.com/d/msgid/jenkinsci-users/CA%2BzfM3Bq0x7djYpWaXfvSbHrFf2DuGJeZ8fEsVskT%3DDfTeKq2w%40mail.gmail.com
>>>  
>>> 
>>> .
>>> For more options, visit https://groups.google.com/d/optout.
>>>
>>
>> -- 
>> You received this message because you are subscribed to the Google Groups 
>> "Jenkins Users" group.
>> To unsubscribe from this group and stop receiving emails from it, send an 
>> email to jenkinsci-use...@googlegroups.com .
>> To view this discussion on the web visit 
>> https://groups.google.com/d/msgid/jenkinsci-users/CANWgJS76kD0W0dTTPeF3P0xXtC1UomAHJ6Swtbog68%3DPDSWyPQ%40mail.gmail.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/5ddb34ee-78c4-4604-8527-9294c753c873%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: create jobs automatically after the code commits to the repository

2016-09-19 Thread Cuong Tran
Have you looked at job-dsl plugin?

https://github.com/jenkinsci/job-dsl-plugin

On Monday, September 19, 2016 at 8:10:32 AM UTC-7, Luciano Matte wrote:
>
> Hi all,
>
> Does anyone have any hint or suggestion plugin for creating jobs 
> automatically 
> after the code commits to the repository?
>
> That is, the Jenkins would have to carry out the svn monitoring, when 
> conducted a new commit, jenkins the case if the job already exists, but 
> there it creates the j and then run the build.
>
> Thank you all for the attention
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/27ea5736-ab9d-47e0-839a-9acaf6547053%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Is there any variable for total build time in pipeline plugin?

2016-09-19 Thread Cuong Tran
How about:

currentBuild.getDuration()

https://github.com/jenkinsci/workflow-support-plugin/blob/master/src/main/java/org/jenkinsci/plugins/workflow/support/steps/build/RunWrapper.java

On Monday, September 19, 2016 at 1:34:38 AM UTC-7, Denis Kot wrote:
>
> I would like to send message from pipeline to hipchat contains total build 
> time, i.e.: 
> job-pipeline #3007 SUCCESSFUL after 1 min 42 sec
> How can I implement it?
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/8fd67569-d26b-4764-b342-9f4e5f8a7236%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Best Practices for Pipeline Global Function Args (Maps vs Closures)

2016-09-19 Thread Cuong Tran
I'd stick with map arguments for simple cases.  Even the example from the 
wiki is simpler if you use map.  

Move to the closure option once you have more experience or complex usage. 
 For example, the new (simplified) syntax for pipleline can be implemented 
as closure:

pipeline {
  stages {
...
  }

  postBuild {
  }
}

On Monday, September 19, 2016 at 5:30:46 AM UTC-7, Kenneth Baltrinic wrote:
>
> Trying to get my head around what is the best way to implement some custom 
> pipeline DLS commands using global functions 
> .
>  
> I am looking at the examples given under Defining a more structured DSL 
> ,
>  
> which shows an example of accepting arguments via variable assignments 
> inside of a closure.  Is this the preferred method?  It seems most build in 
> commands (git, sh, etc) accept a Map of arguments.  I am not a groovy 
> expert but am trying to understand why/when one approach is better than the 
> other?  Any thoughts or illumination on this would be appreciated.
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ec7e04ba-f8c0-460b-9419-d1b0adc2390c%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Groovy code to access full path to a job, ie "Org/Project/branch" name

2016-08-11 Thread Cuong Tran
Try getFullName()

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/c824d19f-f3db-4b04-b99e-b333be3f28f0%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins crashes when I try to add scriptler as a post-build action

2016-05-10 Thread Cuong Tran
I don't think you can add a scriptler script as a post-build action.  You 
must have done it via "Use Publisher from another project".

On Tuesday, May 10, 2016 at 8:33:33 AM UTC-7, Guy Matz wrote:
>
> Hi!  I'm getting a Stack trace 
>  when trying to a a 
> scriptler script as a post-build action.  
>
> The section of stacktrace below - from the link above - looks important, 
> but my untrained eye may be missing something:
>
> Caused by: java.lang.IllegalArgumentException: Failed to instantiate 
> interface hudson.tasks.BuildStep from 
> {"backupJobName":"","builderId":"","scriptlerScriptId":"triggerYumReindex.groovy","propagateParams":true,"defineParams":{"parameters":{"name":"SIDECAR_ENV","value":"ci"}},"stapler-class":"org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder","$class":"org.jenkinsci.plugins.scriptler.builder.ScriptlerBuilder"}
>
> Any help would be greatly appreciated.
>
>
> Regards,
>
> Guy
>
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/d2c81a30-865a-40c8-87fb-99c071f21133%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: How to group jobs into project in Jenkins

2016-05-04 Thread Cuong Tran
You can use the folder plugin to group jobs.

On Saturday, April 30, 2016 at 7:34:03 PM UTC-7, Tony wrote:
>
> Hi,
>
> Does anyone know how to group jobs into project in Jenkins? Also, is there 
> any plugin to display such projects (which consist of jobs) in Jenkin 
> Dashboard?
>
> Thanks!
> Tony
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/f8807900-58f6-44b9-ba7e-3fd6b018ace2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Execute multi modules project in parallel with Pipeline job and view test result per module

2016-05-03 Thread Cuong Tran
All,

I'm experimenting with the new pipeline job to execute tests in a 
multi-module project.  I'm able to execute individual modules in parallel 
and collecting test results.  One thing I'm looking for is the ability to 
view the test results of each module separately.  Is this possible with the 
existing steps and plugins?

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/30326da5-a5f9-46f7-a0e6-5d7a8d820c19%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Templates Plugin (Jenkins Enterprise)

2015-10-02 Thread Cuong Tran
Martin,

We use the Templates plugin to simplify the job creation interface and 
standardize common job types. Combined with the folder plugin, we can 
restrict what can be created within a folder, making it even simpler for 
end users. The xml transformation isn't bad since you can just create a job 
with substitution tokens (${FOO}) and load it in from the interface. 
Changes to a template are automatically propagated to its jobs as well. 
 You can also easily convert an existing job to use templates job.

I think it's better than the other options you listed.

Having said that, we have thousands of jobs and multiple Jenkins masters so 
this plugin doesn't work that well for our scenario.  I think the general 
direction of keeping the job configuration in SCM (using combination of the 
workflow and Job DSL plugin) is more scalable and it's something we are 
investigating.

On Thursday, October 1, 2015 at 12:53:36 PM UTC-7, Martin B. wrote:
>
> Hello users. 
>
> I'm looking for independent opinions on the Jenkins Enterprise Templates 
> Plugin. 
>
> It would be one of the main reasons for us to adopt Jenkins Enterprise, 
> but I was quite shocked to learn (see 
>
> http://documentation.cloudbees.com/docs/cje-user-guide/temolate-sect-job-template-tutorial.html)
>  
>
> that you actually have to do raw XML transformation to get a simple job 
> template running. Looks rather bare bones to me. ('course I *can* see 
> where this might be useful with very complicated job templates, but I 
> like to keep the simple stuff simple, and telling people to write jelly 
> transformations isn't my idea of simple) 
>
> Anyway - are you using JE Templates Plugin? Great Stuff? Much better 
> than (https://github.com/JoelJ/ez-templates) or 
> (https://wiki.jenkins-ci.org/display/JENKINS/Template+Project+Plugin) ... 
> ? 
>
> cheers, 
> Martin 
>

-- 
You received this message because you are subscribed to the Google Groups 
"Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to jenkinsci-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6a363e9f-ed64-4be8-a4a9-7dc68591c6d6%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.