Cron jobs on build agents as Jenkins Jobs

2017-12-23 Thread Ian Vernon
Hi!
I want to have jobs that run at a specified cadence (say every 2 hours). I 
know that this is possible via cron syntax, and have this setup for a 
variety of jobs. However, I have somewhat specific requirements. I've 
looked around to try to figure out how to do this, but I've been coming up 
dry. Is there a way for me to be able to have the following requirements 
for a scheduled, reoccurring job? :

* Do not allow any other builds to be scheduled on the Jenkins agent / node 
even though an agent has multiple executors. For example, two builds finish 
up on one agent, and then my Jenkins job runs. No other build / job runs on 
the agent despite there being only one executor used, because my cron job 
dictates that it can be the only job running on the agent at that time.
* Make sure that the job runs on all available Jenkins agents. I.e., if I 
have four agents, I want to make sure it is scheduled to run on each node 
at a two hour cadence. 

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/f8062284-1d09-4974-a787-e1d124e8e1db%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: Trigger separate jobs with two distinct Jenkinsfiles

2017-12-23 Thread Ian Vernon
Setting up two organization folders was the trick. Thanks!

On Wednesday, December 13, 2017 at 2:29:19 PM UTC-8, Stephen Connolly wrote:
>
> Use a shared library to define the steps with a common name.
>
> Each branch will just have a Jenkinsfile of
>
> ourStandardBuild();
>
> Then you define two org folders. One for the new build and the other for 
> the old build. 
>
> Add the respective shared library to each org folder.
>
> See Watch Me Code Episodes 4&5 for how to do this.
>
> https://www.cloudbees.com/blog/watch-me-code-episode-4
>
> On Wed 13 Dec 2017 at 22:18, Ian Vernon  
> wrote:
>
>> Thanks for the quick reply - that's an intriguing proposition! 
>>
>> Do you know if all builds from each PR go to the same job that is created 
>> in the build-a-job step?
>>
>>
>> On Wednesday, December 13, 2017 at 2:10:45 PM UTC-8, Victor Martinez 
>> wrote:
>>>
>>> if the old tests will be deprecated and removed sooner than later, 
>>> cannot you just use the 
>>> https://jenkins.io/doc/pipeline/steps/pipeline-build-step/#build-build-a-job
>>>  
>>> step?
>>>
>>> Then, the Jenkinsfile will trigger two parallel branches, the first one 
>>> about the new tests using whatever is part of the jenkinsfile for running 
>>> the new tests, and the second branch will be to trigger another traditional 
>>> jenkins job which will run the old test (using the above build step)
>>>
>>> I don't know if it makes sense in your case, but I guess it might 
>>> simplify the pipeline tweaking.
>>>
>> -- 
>> 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/efd618d2-3c61-4a4b-a2de-1f1258a3853f%40googlegroups.com
>>  
>> 
>> .
>> For more options, visit https://groups.google.com/d/optout.
>>
> -- 
> Sent from my phone
>

-- 
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/eea15957-6a03-40df-af49-8a636214b689%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


Re: 404 Access denied after installation

2017-12-23 Thread Mark Waite
I think that message is suggesting that you have some other program already
listening on port 8080 of that computer.  I don't recall ever seeing a
"Document not found" message from Jenkins.

Mark Waite

On Sat, Dec 23, 2017 at 4:35 PM  wrote:

> Hi,
>
> I'm just trying to set jenkins up on Windows.
>
> After installing the 2.89.2 version (successful installation).
> I'm routing to localhost:8080 and get the following error:
> Access Error: 404 -- Not Found
>
> Cannot locate document: /
>
>
> see attached print screen.
>
> I think i've installed Jenkins on this PC in the past if matters.
>
> It must be something very stupid, but I've already tried to 
> re-install/remove/change version and nothing seems to work
>
> Thanks,
> Boaz
>
> --
> 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/9a538e40-9be7-4dd5-9e1c-2e92cfd07784%40googlegroups.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/CAO49JtFVwao6Yuv3n3X-HEnaqrsLS5uN-104DL5RPwxTCCLPZA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [multibranch] [bitbucket] Code push tells Jenkins, Jenkins doesn't build anything

2017-12-23 Thread Mark Waite
Thanks for detecting that.  Have you considered proposing a pull request to
the plugin help so that it will assist other users?

Mark Waite

On Fri, Dec 22, 2017 at 2:38 AM James Green 
wrote:

> Solved!
>
> We had been using the "BitBucket Plugin" to receive the web hook
> notifications from BitBucket.org and expected this to continue to work.
>
>
> https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/index.html#bitbucket
> mentions Web Hook Registration yet we saw no such option (else this may
> have provided a hint).
>
> Then we found a Q describing the issue and declaring the URL in here:
> https://support.cloudbees.com/hc/en-us/articles/11553051-How-to-Trigger-Multibranch-Jobs-from-BitBucket-Server-
>
> If only the first article had that URL... If only the job creation screen
> mentioned the need for a new web hook... Oh well!
>
> James
>
>
> On 22 December 2017 at 09:27, James Green 
> wrote:
>
>> I've just converted a Pipeline job that built every time a change was
>> pushed into BitBucket to the equivalent as a multibranch project.
>>
>> Trouble is, pushes no longer trigger builds. BitBucket is still getting a
>> 200 OK from the webhook when it hits Jenkins, but nothing else happens.
>>
>> On inspection, the multibranch project created a `master` child job which
>> has an option "Build when a change is pushed to BitBucket" but this is NOT
>> checked, and the child job lacks any save button with which to change
>> things. When I created the project the master branch built just fine first
>> time.
>>
>> This appears to be a bug but I might expect more complaints when I search
>> for it. I wonder if it is some requirement of the user that connects to
>> BitBucket - like it doesn't have sufficient rights for something not
>> involving cloning?
>>
>> Thoughts?
>>
>> James
>>
>>
> --
> 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/CAMH6%2BawnVM4EJUwB57Mf__VdaJimQX9Mnn5_oF5ZbK_71Gf%3D1g%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/CAO49JtFic%2B26v4CwD%2B8hxdM_2LXPKuuyT8V0dP06Ek0Wemt%2BHQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: ssh authentication in jenkins/jenkins:lts docker image hangs during clone

2017-12-23 Thread Mark Waite
If the passphrase contains characters which are expanded by the shell, then
the shell expansion may damage the passphrase and cause the ssh command to
hang prompting for a passphrase.

Shell expansion shouldn't be invoked on the characters of the passphrase.
I consider that a bug, but a bug that is not yet fixed.

Mark Waite

On Sat, Dec 23, 2017 at 2:37 AM Ozgur Cagdas  wrote:

>
> Hi,
>
>
> I am running a container created off jenkins/jenkins:lts docker image on
> 64-bit Ubuntu 16.04.1 LTS and git poll and clone operations hang when I use
> ssh authentication with an ssh key with passphrase
>
> Started on Dec 22, 2017 1:47:55 PM
>
> Polling SCM changes on master
> Using strategy: Default
> > git rev-parse --is-inside-work-tree # timeout=10
> Fetching changes from the remote Git repositories
> > git config remote.origin.url g...@github.com:username/repo_path.git #
> timeout=10
> Fetching upstream changes from g...@github.com:username/repo_path.git
> > git --version # timeout=10
> using GIT_SSH to set credentials test-key
> > git fetch --tags --progress g...@github.com:username/repo_path.git
> +refs/heads/*:refs/remotes/origin/* # timeout=3
>
>
> This is the ps output when the poll hangs
>
> jenkins   2405  0.0  0.0  15604  1080 13:49 git ls-remote -h
> g...@github.com:username/repo_path.git HEAD
> jenkins   2409  0.0  0.0   4288   800 13:49 /bin/sh
> /tmp/ssh852924073958836602.sh g...@github.com git-upload-pack
> 'username/repo_path.git'
> jenkins   2410  0.0  0.0  47248  5616 13:49 ssh -i
> /tmp/ssh253076704069644928.key -l jenkins -o StrictHostKeyChecking=no
> g...@github.com git-upload-pack 'username/repo_path.git'
>
>
> The jenkins plugins that are used are the latest available git, git
> client, ssh agent and ssh credentials.
>
> When I run the ssh -i line on the console manually, it does prompt for
> password and then interacts with the remote git server as expected.
>
> Another input is, if I clone the repo with username/password
> authentication over https and assign the passphrase ssh credentials to the
> jenkins item in the configuration, I can still interact with the remote
> repo in jenkins execute shell.
>
> If I resort to using a key without a passphrase, it all works fine. I saw
> quite a few people complaining about similar issues on different forums but
> there doesn't seem to be an answer about if there is a solution for it and
> what the issue is. I am not sure if this is a jenkins, jenkins plugin,
> docker or just a configuration issue. So, pointers to identify the issue is
> appreciated.
>
> Regards,
>
> Oz
>
> --
> 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/9c7908f7-df01-4a25-a927-d02a50641832%40googlegroups.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/CAO49JtEt_2bd4RRH02wUVjcbLPFyQFn2u8VZq00o6jzjJ85j6w%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: Jenkins Pipeline - build job step, ability to return build job number

2017-12-23 Thread Victor Martinez
The build job step returns a RunWrapper object, and in your case you can 
use the getId method 


def buildObj = build job: 'my-test-job', parameters: [string(name: 
'environment', value: 'QA')], quietPeriod: 10
echo buildObj.getId()

Cheers

-- 
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/5d95bfeb-e461-4d33-b04f-93b4e7bc13bd%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.


ssh authentication in jenkins/jenkins:lts docker image hangs during clone

2017-12-23 Thread Ozgur Cagdas


Hi,


I am running a container created off jenkins/jenkins:lts docker image on 
64-bit Ubuntu 16.04.1 LTS and git poll and clone operations hang when I use 
ssh authentication with an ssh key with passphrase

Started on Dec 22, 2017 1:47:55 PM

Polling SCM changes on master
Using strategy: Default
> git rev-parse --is-inside-work-tree # timeout=10
Fetching changes from the remote Git repositories
> git config remote.origin.url g...@github.com:username/repo_path.git # 
timeout=10
Fetching upstream changes from g...@github.com:username/repo_path.git
> git --version # timeout=10
using GIT_SSH to set credentials test-key
> git fetch --tags --progress g...@github.com:username/repo_path.git 
+refs/heads/*:refs/remotes/origin/* # timeout=3


This is the ps output when the poll hangs

jenkins   2405  0.0  0.0  15604  1080 13:49 git ls-remote -h 
g...@github.com:username/repo_path.git HEAD
jenkins   2409  0.0  0.0   4288   800 13:49 /bin/sh 
/tmp/ssh852924073958836602.sh g...@github.com git-upload-pack 
'username/repo_path.git'
jenkins   2410  0.0  0.0  47248  5616 13:49 ssh -i 
/tmp/ssh253076704069644928.key -l jenkins -o StrictHostKeyChecking=no 
g...@github.com git-upload-pack 'username/repo_path.git'


The jenkins plugins that are used are the latest available git, git client, 
ssh agent and ssh credentials.

When I run the ssh -i line on the console manually, it does prompt for 
password and then interacts with the remote git server as expected.

Another input is, if I clone the repo with username/password authentication 
over https and assign the passphrase ssh credentials to the jenkins item in 
the configuration, I can still interact with the remote repo in jenkins 
execute shell.

If I resort to using a key without a passphrase, it all works fine. I saw 
quite a few people complaining about similar issues on different forums but 
there doesn't seem to be an answer about if there is a solution for it and 
what the issue is. I am not sure if this is a jenkins, jenkins plugin, 
docker or just a configuration issue. So, pointers to identify the issue is 
appreciated.

Regards,

Oz

-- 
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/9c7908f7-df01-4a25-a927-d02a50641832%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.