Re: Follow the console (plug-in?)

2012-06-29 Thread shanz
I'd like to be able to automatically display the current job's page whilst 
the build is traversing a sequence of jobs.
I have added some user instructions to the Description fields of some later 
jobs.

On Thursday, June 28, 2012 3:23:13 PM UTC+1, SeboPL wrote:

 Hi,
 I've got an idea and would like to ask you if you've heard of any plug-in 
 which could provide such functionality... 
 Do you feel it might be useful and if it might be hard to get implemented.

 What I need is to look at a few build jobs which triggers another sub-jobs 
 and some of those are matrix builds.
 I have composed even a FireFox session such that I've got about 18 Jenkins 
 screens splatted at 6 FF windows so I can see the console output of the 
 jobs as they are executed. However it is not very handy.

 I thought it might be a good idea to let the build console view to jump to 
 the console of the underlying job when it is triggered and the actual job 
 script needs to wait for its results anyway.

 If the underling job is the matrix build... the window could be splatted 
 to show a few consoles at once or it could just bring up one of those 
 (which is still running) and show just the bullets for the others at the 
 bottom of the console view.

 What do you think?



Re: User Prompts

2012-06-18 Thread shanz
Chris,
Yes I also do exactly that too.
First job asks questions with parameters and populates a property file 
which envinject interrogates for each subsequent job.
I found this simpler and less error prone than just relying on passing on 
the parameters to each job.
I'll make do for now until I can automate absolutely everything.
Thanks.

On Friday, June 15, 2012 9:52:26 PM UTC+1, cjo wrote:

 I've set up some thing like that,

 Basically the first job in the chain asks all the questions about tasks to 
 builds, are artifacts required, etc via parameters.

 Does some basic checking (tasks correct, do they exist) and creates a 
 summary of this information.

 If this checking passes, it creates a property file that is passed to all 
 downstream jobs, via the parametrized trigger plugin

 All further jobs then reference this file (can be accessed from scripts or 
 added to the build env using envinject plugin)

 If you want to prevent jobs 2-N being started manually, use the role 
 strategy plugin to block who can start these.
 https://wiki.jenkins-ci.org/display/JENKINS/Role+Strategy+Plugin 

 I don't personally use this as we are a small team of 8 people who use the 
 service and don't mess around things they don't need to.

 Chris

 On Friday, June 15, 2012 4:39:20 PM UTC+1, shanz wrote:

 At the moment I am resigned to defeat so I've got a slightly 
 underwhelming plan B.
 I can put a hyperlink in the description of job1 as follows
 Once complete manually continue by clicking here :-
 a href=http://localhost:8086/jenkins/job1/build;
 http://localhost:8086/jenkins/job1/build/a 

 On Friday, June 15, 2012 4:08:51 PM UTC+1, shanz wrote:

 I split the whole project into jobs for convenience only, there is 
 nothing special about having separate jobs.
 Job 1 is triggered by a user but then all the subsequent jobs just 
 follow the previous job automatically.
 I guess the original user would be the one to prompt in their browser.


 On Friday, June 15, 2012 3:47:27 PM UTC+1, (unknown) wrote:

  Can you explain what you want to happen? If you are talking about a 
 job that is triggered by a previous job, rather than by a user, who do you 
 want to ask for input? There is no user to ask.

  

 I guess the question is, how are the consecutive jobs being run at the 
 moment?

  
   
 *From:* jenkinsci-users@googlegroups.com [mailto:
 jenkinsci-users@googlegroups.com] *On Behalf Of *shanz
 *Sent:* 15 June 2012 15:30
 *To:* jenkinsci-users@googlegroups.com
 *Subject:* User Prompts
  
  

 I know I can use the Parameterized Builds plugin to prompt for user 
 input however this only works for the initial job.
 I want to ask for user input (eg: Boolean tick box - have you done 
 xyz?), in a job which is in the middle of a list of consecutive jobs.
 Is this possible?
   


Re: User Prompts

2012-06-15 Thread shanz
I split the whole project into jobs for convenience only, there is nothing 
special about having separate jobs.
Job 1 is triggered by a user but then all the subsequent jobs just follow 
the previous job automatically.
I guess the original user would be the one to prompt in their browser.


On Friday, June 15, 2012 3:47:27 PM UTC+1, (unknown) wrote:

  Can you explain what you want to happen? If you are talking about a job 
 that is triggered by a previous job, rather than by a user, who do you want 
 to ask for input? There is no user to ask.

  

 I guess the question is, how are the consecutive jobs being run at the 
 moment?

  
   
 *From:* jenkinsci-users@googlegroups.com [mailto:
 jenkinsci-users@googlegroups.com] *On Behalf Of *shanz
 *Sent:* 15 June 2012 15:30
 *To:* jenkinsci-users@googlegroups.com
 *Subject:* User Prompts
  
  

 I know I can use the Parameterized Builds plugin to prompt for user input 
 however this only works for the initial job.
 I want to ask for user input (eg: Boolean tick box - have you done xyz?), 
 in a job which is in the middle of a list of consecutive jobs.
 Is this possible?
   


svn checkout strategy error

2012-05-24 Thread shanz
If I choose, emulate clean checkout by first deleting unversioned/ignored 
files, then 'svn update', then I expect the unversioned files/ignored 
files to be deleted but nothing is touched.
I have Jenkins 1.464 and svn plugin v1.40.
Anyone got this working?
I choose a custom workspace C:\jenkins
Then enter ..\\Projects\\IO Firmware into local module directory 
(optional) field.
This hopefully corresponds to the absolute path C:\Projects\IO Firmware.

Does the other option - Always check out a fresh copy do any deleting 
beforehand?  What is the significance of the word fresh?  Would I need to 
delete using DOS commands first before checking out?
This is important since my command line builds cannot do a REbuild only a 
build so the code in the build folder has to be deleted first.  The code is 
all unversioned or ignored since I generate the code from a UML model.


Re: EnvInject global vs. per job behavior

2012-04-26 Thread shanz
I've recently used the EnvInject plugin on several concurrent jobs.
I created a file with the variables in it :-
eg: 
MY_FIRST_VAR=whatever
MY_NEXT_VAR=somethingElse

Then I tick the box on any job which needs access to either variable and 
point to the file.



svn confusion

2012-04-17 Thread shanz
I am using the svn check-out strategy - Emulate clean checkout by first 
deleting unversioned/ignored files, then 'svn update'.

Before this Emulated Checkout Job is called it is unsafe to assume the 
location of the working copy folder is known.
So the working copy could be be pointing to (possibly out of date) trunk, a 
branch or a tag.

This leads me to want to use an 'svn switch' command to ensure that the 
working copy points the trunk before calling the Emulated Checkout Job.
'svn switch' automatically calls svn update so it would seem to result in 
calling 'svn update' once, then deleting unversioned/ignored files then 
calling svn update a second time.

What happens if I setup branch-based urls in the Check-out Strategy's 
Subversion Modules Repository URL but the Local module directory is 
pointing to a working copy that already points to the trunk?
Does the svn update cope even though it should really be an svn switch?

How does everyone else use svn switch and the svn check-out strategy?




Re: svn confusion

2012-04-17 Thread shanz
I think I've come to a decision.
I will try and continue to use the Check-out Strategy, Emulate clean 
checkout... since it is a nice way to delete unversioned files which could 
be tricky otherwise.
I will encapsulate the Emulate clean checkout in a separate 'function' job.
The initial job will call svn switch and svn revert before triggering the 
Emulate clean checkout.


On Tuesday, April 17, 2012 11:07:05 AM UTC+1, shanz wrote:

 I am using the svn check-out strategy - Emulate clean checkout by first 
 deleting unversioned/ignored files, then 'svn update'.

 Before this Emulated Checkout Job is called it is unsafe to assume the 
 location of the working copy folder is known.
 So the working copy could be be pointing to (possibly out of date) trunk, 
 a branch or a tag.

 This leads me to want to use an 'svn switch' command to ensure that the 
 working copy points the trunk before calling the Emulated Checkout Job.
 'svn switch' automatically calls svn update so it would seem to result in 
 calling 'svn update' once, then deleting unversioned/ignored files then 
 calling svn update a second time.

 What happens if I setup branch-based urls in the Check-out Strategy's 
 Subversion Modules Repository URL but the Local module directory is 
 pointing to a working copy that already points to the trunk?
 Does the svn update cope even though it should really be an svn switch?

 How does everyone else use svn switch and the svn check-out strategy?




Is there a bug in the EnvInject plugin?

2012-04-11 Thread shanz
I am seeing very odd behaviour after using the EnvInject plugin.
I have created a job and all it does is print it's workspace path.
Somehow the workspace is not as expected and it actually uses another
job's workspace instead!
What is going on?
I notice that the jobName\builds\build_id\injectedEnvVars.txt file
contains the incorrect workspace path.


EnvInject Usage

2012-04-05 Thread shanz
Environment variables in jenkins are driving me up the wall!

I want to create a formatted version number, called say BUILD_DATE.
Then I want to store this date in an environment variable that
subsequent jobs can retrieve.

I know I can write it into a file manually but surely the EnvInject
plugin should be able to do this?

If I tick Inject environment variables to the build process, then I
can enter the path to a file, eg:
C:\jenkins\jobs\EnvInjStuff\envInjDate.properties

I seem to have to create this empty file manually for jenkins to be
happy.

I can also fill in the Properties Content but this never appears in
the file.
Subsequently, later jobs can't retrieve data from the file.

Please help me before I go completely mad!


Re: EnvInject Usage

2012-04-05 Thread shanz
Fair enough but I think it is all very confusing particularly the
Properties File Path and Properties Content fields.
Are these mutually exclusive?
I think it is very unintuitive.

In the wiki page it says, Variables Traceability - Each build
captures environment variables and stores them in an environment file
called 'injectedEnvVars.txt' located in
$JENKINS_HOME/jobsyour_job/builds/your_build



On Apr 5, 12:14 pm, Grégory Boissinot gregory.boissi...@gmail.com
wrote:
 EnvInject plugin enables you to inject only variables for a build.
 It is not aimed at propagating environment variables to downstream jobs.
 Therefore, EnvInject plugin can read files (properties files) and it
 doesn't create files.
 If you want to share elements, you have to do yourself.







 On Thu, Apr 5, 2012 at 12:04 PM, shanz duncan.perr...@gmail.com wrote:
  Environment variables in jenkins are driving me up the wall!

  I want to create a formatted version number, called say BUILD_DATE.
  Then I want to store this date in an environment variable that
  subsequent jobs can retrieve.

  I know I can write it into a file manually but surely the EnvInject
  plugin should be able to do this?

  If I tick Inject environment variables to the build process, then I
  can enter the path to a file, eg:
  C:\jenkins\jobs\EnvInjStuff\envInjDate.properties

  I seem to have to create this empty file manually for jenkins to be
  happy.

  I can also fill in the Properties Content but this never appears in
  the file.
  Subsequently, later jobs can't retrieve data from the file.

  Please help me before I go completely mad!


Re: Is there a way to read a string (version numbers) from a file into jenkins variable?

2012-04-05 Thread shanz
You could create another file with the version number in the java
property (key=value) format.
Then you can use the EnvInject plugin to inject the environment
variable (MY_NEW_VAR) into your job/build.
The advantage of this approach is that the variable can be visible
throughout the whole job/build.
You just enter the path/myVersion.txt in the Properties File field of
the plugin.

Alternatively just use DOS, eg: To place the first line of a file into
a variable, do this
Set /P MyVar=aFilename
The downside to this later approach is that you may have to repeat it
if you open several shells.


Re: How to make variables available to all build steps/action in a job

2012-03-20 Thread shanz
Oh yes, you need to define subject up near the top of the script and
change the final call to send_mail().
Eg:
import smtplib
import os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders

myRelease = os.environ.get(BUILD_STRING)
files=[myData.xml,myDataNightly_Previous.xml,myDataRelease_Previous.xml,
myReport.html]
to=[an.ema...@address.com,an.ema...@address.com,an.ema...@address.com]
text1 = To everyone\n\nmyData.xml has changed following the latest
build :- 
text2 = myRelease
text3 = \r\n\nSee attached files\r\n\r\nReleases are in\netdrive
\Product source code\Tagged\, \r\n\nNightly files are in 
\netdrive\Product source code\Nightly\\r\n\nRegards,\r\n\nJenkins\r
\n
text = text1+text2+text3
subject=myNewEmailSubject

# Send the email via our own SMTP server.
def send_mail(to, subject, text, fromWho=, files=[], cc=[], bcc=[],

etc etc

send_mail(to, subject, text, jenkins, files)



Re: How to make variables available to all build steps/action in a job

2012-03-16 Thread shanz
I found that a python script gave me more flexibility in what I could
attach to an email...


import smtplib
import os
from email.MIMEMultipart import MIMEMultipart
from email.MIMEBase import MIMEBase
from email.MIMEText import MIMEText
from email.Utils import COMMASPACE, formatdate
from email import Encoders

myRelease = os.environ.get(BUILD_STRING)
files=[myData.xml,myDataNightly_Previous.xml,myDataRelease_Previous.xml,
myReport.html]
to=[an.ema...@address.com,an.ema...@address.com,an.ema...@address.com]
text1 = To everyone\n\nmyData.xml has changed following the latest
build :- 
text2 = myRelease
text3 = \r\n\nSee attached files\r\n\r\nReleases are in\netdrive
\Product source code\Tagged\, \r\n\nNightly files are in 
\netdrive\Product source code\Nightly\\r\n\nRegards,\r\n\nJenkins\r
\n
text = text1+text2+text3

# Send the email via our own SMTP server.
def send_mail(to, subject, text, fromWho=, files=[], cc=[], bcc=[],
server=10.192.00.000):
assert type(to)==list
assert type(files)==list
assert type(cc)==list
assert type(bcc)==list

message = MIMEMultipart()
message['From'] = fromWho
message['To'] = COMMASPACE.join(to)
message['Date'] = formatdate(localtime=True)
message['Subject'] = subject
message['Cc'] = COMMASPACE.join(cc)

message.attach(MIMEText(text))

for f in files:
part = MIMEBase('application', 'octet-stream')
part.set_payload(open(f, 'rb').read())
Encoders.encode_base64(part)
part.add_header('Content-Disposition', 'attachment;
filename=%s' % os.path.basename(f))
message.attach(part)

addresses = []
for x in to:
addresses.append(x)
for x in cc:
addresses.append(x)
for x in bcc:
addresses.append(x)

smtp = smtplib.SMTP(server)
smtp.sendmail(fromWho, addresses, message.as_string())
smtp.close()

send_mail(to, myData.xml, text, jenkins, files)