What is the best way to find out which revisions are in the current build at the start of the build

2012-04-12 Thread Patrick
Hi

I'm trying to create a readme file based on the commit messages for all the 
new revisions in the current build. Currently I do this by using the 
Jenkins API to request the changesets for the last build (e.g. we're 
currently building build  #6 so the last build is #5). These changesets 
give me the last revision number for my VCS and then I can find out what 
has changed since. However this doesn't work quite that nicely because:
* The first build doesn't have a change set, which seems a bit silly 
because obviously all the changes from all the commits until then are 
included
* Sometimes a build fails at a point where there are no changes (e.g. 
failure to clear the workspace). Then this build has no change set
* A build is run multiple times on a given VCS revision.

So the question is what is the best / easiest way to determine which 
revisions are new in the current build in relation to the last successful 
build.

Thanks

Patrick


Re: What is the best way to find out which revisions are in the current build at the start of the build

2012-04-12 Thread Ferenc Kovacs
On Thu, Apr 12, 2012 at 11:35 AM, Patrick petrikvanderve...@gmail.comwrote:

 Hi

 I'm trying to create a readme file based on the commit messages for all
 the new revisions in the current build. Currently I do this by using the
 Jenkins API to request the changesets for the last build (e.g. we're
 currently building build  #6 so the last build is #5). These changesets
 give me the last revision number for my VCS and then I can find out what
 has changed since. However this doesn't work quite that nicely because:
 * The first build doesn't have a change set, which seems a bit silly
 because obviously all the changes from all the commits until then are
 included
 * Sometimes a build fails at a point where there are no changes (e.g.
 failure to clear the workspace). Then this build has no change set
 * A build is run multiple times on a given VCS revision.

 So the question is what is the best / easiest way to determine which
 revisions are new in the current build in relation to the last successful
 build.

 Thanks

 Patrick


what about using the Jenkins api?
parsing xml output of
http://yourjenkins/job/yourjob/yourrevision/api/xml?xpath=//changeSet

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Re: What is the best way to find out which revisions are in the current build at the start of the build

2012-04-12 Thread Ferenc Kovacs
On Thu, Apr 12, 2012 at 12:44 PM, Ferenc Kovacs tyr...@gmail.com wrote:



 On Thu, Apr 12, 2012 at 11:35 AM, Patrick petrikvanderve...@gmail.comwrote:

 Hi

 I'm trying to create a readme file based on the commit messages for all
 the new revisions in the current build. Currently I do this by using the
 Jenkins API to request the changesets for the last build (e.g. we're
 currently building build  #6 so the last build is #5). These changesets
 give me the last revision number for my VCS and then I can find out what
 has changed since. However this doesn't work quite that nicely because:
 * The first build doesn't have a change set, which seems a bit silly
 because obviously all the changes from all the commits until then are
 included
 * Sometimes a build fails at a point where there are no changes (e.g.
 failure to clear the workspace). Then this build has no change set
 * A build is run multiple times on a given VCS revision.

 So the question is what is the best / easiest way to determine which
 revisions are new in the current build in relation to the last successful
 build.

 Thanks

 Patrick


 what about using the Jenkins api?
 parsing xml output of
 http://yourjenkins/job/yourjob/yourrevision/api/xml?xpath=//changeSet


but most importantly, why don't you fetch the changes of the current build?
I mean the changes in the current build that interests you.
The build will be created as soon as it starts, and when you buildstep
kicks in, you can already have the changeset for your current build (and
you have an environment variable which holds the current job number, so you
have everything to fetch the changes for the current build imo.

-- 
Ferenc Kovács
@Tyr43l - http://tyrael.hu


Re: What is the best way to find out which revisions are in the current build at the start of the build

2012-04-12 Thread Patrick van der Velde
Hi

That's what I'm doing at the moment. I'm currently calling
http://yourjenkins/job/yourjob/yourrevision/api/xml?tree=changeSet[items[revision,msg]]
which gives me an xml block with the revision and the message. However
that only works if that build actually thinks it has changes (which it
may not as per the reasons I provided). I guess the next step then is
to find the previous build and try again?

Also I was under the impression that the change set for the current
build is only available after it is finished?

On Thu, Apr 12, 2012 at 22:47, Ferenc Kovacs tyr...@gmail.com wrote:


 On Thu, Apr 12, 2012 at 12:44 PM, Ferenc Kovacs tyr...@gmail.com wrote:



 On Thu, Apr 12, 2012 at 11:35 AM, Patrick petrikvanderve...@gmail.com
 wrote:

 Hi

 I'm trying to create a readme file based on the commit messages for all
 the new revisions in the current build. Currently I do this by using the
 Jenkins API to request the changesets for the last build (e.g. we're
 currently building build  #6 so the last build is #5). These changesets give
 me the last revision number for my VCS and then I can find out what has
 changed since. However this doesn't work quite that nicely because:
 * The first build doesn't have a change set, which seems a bit silly
 because obviously all the changes from all the commits until then are
 included
 * Sometimes a build fails at a point where there are no changes (e.g.
 failure to clear the workspace). Then this build has no change set
 * A build is run multiple times on a given VCS revision.

 So the question is what is the best / easiest way to determine which
 revisions are new in the current build in relation to the last successful
 build.

 Thanks

 Patrick


 what about using the Jenkins api?
 parsing xml output of
  http://yourjenkins/job/yourjob/yourrevision/api/xml?xpath=//changeSet


 but most importantly, why don't you fetch the changes of the current build?
 I mean the changes in the current build that interests you.
 The build will be created as soon as it starts, and when you buildstep kicks
 in, you can already have the changeset for your current build (and you have
 an environment variable which holds the current job number, so you have
 everything to fetch the changes for the current build imo.

 --
 Ferenc Kovács
 @Tyr43l - http://tyrael.hu


Simple Dynamic ClearCase 1.2.2 generating nonsense commands

2012-04-12 Thread Helmut
Hello,

i use jenkins 1.459 with Simple Dynamic ClearCase plugin and i want to
see the versions used for a build and also use jenkins to present
differences in versions between builds. I configured the Simple
Dynamic ClearCase plugin V1.2.2 in an example project to record the
version information for a certain vob (lets say /vobs/example) and for
the main branch. The command produced at start of the build by this
plugin then is nonsense and fails to execute:

cleartool setview -exec 'cleartool lshistory -branch main -last 10 -
fmt %Nd| |%u| |%En| |%Vn| |%e| |%o| |%Nc\n -nco /vobs/example'
example_view

In my clearcase installation (7.1.1.1) cleartool does not know the
command setview. Reading this line i think it is nonsense anyway,
and that the program in fact just wanted to execute the inner part
starting with cleartool lshistory

Is there anybody out there that successfully used this plugin? Is it
only the current version that is broken? How can i use jekins
succesfully with clearcase to create version reports for each build
that enable me to generate version difference reports between builds?

Best regards
Helmut


Maven builds with generic build project hang when test outputs text to stderr

2012-04-12 Thread Helmut
Hello,

as posted in a previous message i switched from using maven builds to
generic builds with maven build steps. These projects always hang at
the end when the tests executed produce output to stderr. As i dont
know a way to suppress this output (and in fact i do want to see it
after the build), how can i enable jenkins not to stumble over this
output? One other strange thing with this output is, that it appears
not in the context of the test case, but at the very end of the build
(after the line Tests run:), as if the output to stderr during
the test was held back by someone.

Best regards
Helmut


Re: Warnings Plugin and Mail-ext Integration

2012-04-12 Thread Slide
I'm having a few difficulties on this. The GroovyShell is initialized
with a ClassLoader like this:

private static final class Script implements
DelegatingCallableString,RuntimeException {
private final String script;
private transient ClassLoader cl;

private Script(String script) {
this.script = script;
cl = getClassLoader();
}

public ClassLoader getClassLoader() {
return Jenkins.getInstance().getPluginManager().uberClassLoader;
}

public String call() throws RuntimeException {
// if we run locally, cl!=null. Otherwise the delegating
classloader will be available as context classloader.
if (cl==null)   cl =
Thread.currentThread().getContextClassLoader();
GroovyShell shell = new GroovyShell(cl);

StringWriter out = new StringWriter();
PrintWriter pw = new PrintWriter(out);
shell.setVariable(out, pw);
try {
Object output = shell.evaluate(script);
if(output!=null)
pw.println(Result: +output);
} catch (Throwable t) {
t.printStackTrace(pw);
}
return out.toString();
}
}

The part I am interested in is when it uses the uberClassLoader vs
using the getContextClassLoader. How is cl set to null for executing
remotely? I am trying to replicate this setup for the groovy
templating in the email-ext plugin so it can load other plugins and
such.

Thanks,

slide

On Wed, Apr 11, 2012 at 3:05 PM, Darren Syzling dsyzl...@gmail.com wrote:
 Thanks for looking into this - replying late but yes I tried explicit
 imports to no avail. Makes sense that a different class loader was
 being used.

 Look forward to testing an updated version when available.


 Darren

 On 11 April 2012 21:06, Slide slide.o@gmail.com wrote:
 Ok, it looks like the groovy script console sets the classloader for
 the context to Jenkins.getInstance().getPluginManager().uberClassLoader,
 which the email-ext plugin does NOT do. I will look at updating this
 and trying it out and if it works, I'll release a new version of
 email-ext.

 slide

 On Wed, Apr 11, 2012 at 8:51 AM, Slide slide.o@gmail.com wrote:
 I also can't seem to get the groovy template to load the
 WarningsResultAction class. I tried similar things to what you did
 below. I will see if I can figure out what this is the case.

 Thanks,

 slide

 On Wed, Apr 11, 2012 at 5:57 AM, Darren Syzling dsyzl...@gmail.com wrote:
 Ulli,

 I'd be happy to work on something together. I did however try a few
 variants but the hudson.plugins.warnings.WarningsResultAction class
 could not be found, I tried variants of this:

 warningsResultAction =
 build.getAction(Class.forName(hudson.plugins.warnings.WarningsResultAction))
 warningsResultAction =
 build.getAction(hudson.plugins.warnings.WarningsResultAction.class)

 and using the class loader:
 ClassLoader cl = it.class.getClassLoader()
 def warningsClass =
 cl.loadClass(hudson.plugins.warnings.WarningsResultAction, true)

 Is there something different about the groovy parser engine loaded by
 email-ext which would mean other plugin classes were not available.

 Unfortunately I then decided to upgrade to Jenkins 1.459 along with:
 Static analysis utilities 1.38
 Warnings 3.28
 Static analysis collector  1.24
 Email-ext  2.18

 This has broken my ability to build and configure the project, when I 
 build:
 11-Apr-2012 13:55:43 hudson.model.Executor run
 SEVERE: Executor threw an exception
 java.lang.AssertionError: class
 hudson.plugins.warnings.WarningsPublisher is missing its descriptor
        at jenkins.model.Jenkins.getDescriptorOrDie(Jenkins.java:1076)
        at hudson.tasks.Publisher.getDescriptor(Publisher.java:123)
        at hudson.tasks.Recorder.getDescriptor(Recorder.java:51)
        at 
 hudson.plugins.warnings.WarningsPublisher.getDescriptor(WarningsPublisher.java:323)
        at 
 hudson.plugins.warnings.WarningsPublisher.getDescriptor(WarningsPublisher.java:41)
        at hudson.model.Descriptor.toMap(Descriptor.java:873)
        at hudson.util.DescribableList.toMap(DescribableList.java:128)
        at hudson.model.Project.getPublishers(Project.java:109)
        at hudson.model.Build$RunnerImpl.cleanUp(Build.java:171)
        at hudson.model.Run.run(Run.java:1457)
        at hudson.model.FreeStyleBuild.run(FreeStyleBuild.java:46)
        at 
 hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:238)


 and when I try and configure the project I can't access email-ext or
 warnings configuration information:
 11-Apr-2012 13:46:50 hudson.ExpressionFactory2$JexlExpression evaluate
 WARNING: Caught exception evaluating: i.descriptor. Reason:
 java.lang.reflect.InvocationTargetExcept
 ion
 java.lang.reflect.InvocationTargetException
        at 

Authentification failed when deploying a project

2012-04-12 Thread Blanca Hernández
Hello,

I am new using Jenkins, and am having some problems when I try to
deploy a project in a remote machine:



[INFO]

[ERROR] BUILD ERROR
[INFO]

[INFO] Error retrieving previous build number for artifact
'host:project:jar': repository metadata for: 'snapshot host:project:
1.0-SNAPSHOT' could not be retrieved from repository: snapshot due to
an error: Authentication failed: The host was not known and was not
accepted by the configuration: host


How could I set up this information??
Thanks in advance


Re: how to get access to the data for the job being promoted?

2012-04-12 Thread Brian J. Murrell
On 12-04-10 04:54 PM, Sami Tikka wrote:
 You do not exactly come clean on what kind of data it is you are looking 
 for.

Well, specifically, I was looking to know in the executed job which job
was being promoted.

 If you want access to promoted build artifacts, Copy Artifacts plugin
 gives that in the triggered build in Specific build - Last promoted

This sounds racy, but moot in any case since there is no mention of
anything to do with promoted builds in the list of artifacts available
for copying.  But that's ok, see below...

 If it is something else you want, you could maybe send it over as a
 parameter.

Yes, this is what I was looking for!

 Use the parameterized trigger in the promotion action to
 send what ever data you want to pass to the triggered job.

Yeah.  I hadn't realized that any action plugin that I add would be
available as a promotion action.  Simply installing the parameterized
trigger plugin I was able to send the PROMOTED_* variables to the
downstream job.

Thanks much!

b.



signature.asc
Description: OpenPGP digital signature


serializing actions in a promotion process

2012-04-12 Thread Brian J. Murrell
I have a promotion configuration using the Promoted Builds Plugin.  This
configuration includes the building of two other jobs in it's Actions
list, specifically two Trigger parameterized build on other projects
items.  These seem to happen in parallel though and I would like to
force them to happen serially.

Additionally, I would like to copy the build artifacts of the first one
run in the second one.  I think I would be able to do that if the new
build number of the first executed project was added to the environment
of process running the actions, so then I could pass it to the second
job as a parameter.

One way of achieving this is of course to combine the two jobs into a
single one but the reality is that one of the jobs is called elsewhere
so combining it's steps into this first job would be a duplication and
future synchronization nightmare.

Any ideas?

Cheers,
b.



signature.asc
Description: OpenPGP digital signature


Re: Promoted Builds Plugin: Does not automatically promote despite qualifications being met

2012-04-12 Thread Nicky Ramone
It looks like a weird bug. It happens on one set of jobs but not on another
one I have.
Another problem I'm having is that when you manually promote a build that
triggers a downstream build,  the triggered downstream build does not
include information from the upstream project, which is a big problem.

On Thu, Apr 12, 2012 at 4:05 AM, Taubert, Helge t...@zuehlke.com wrote:

  Hi!

 ** **

 We have a similar issue for some versions back now. We get the following
 warning:

 ** **

 ** **

 WARNING: Job_A appears to use this job as a promotion criteria, but no
 fingerprint is recorded. Fingerprint needs to be enabled on both this job
 and Job_A

 ** **

 If you check the fingerprints manually, everything is fine, but the
 promotion does not work.

 It worked one and a half year ago. Then there were some race condition
 which made it fail sometimes. These were fixed and it worked for a while.
 Then it stopped working at all.

 ** **

 It would be nice to have this feature working again.

 ** **

 Greetings,

 ** **

 Helge

 ** **

 *From:* jenkinsci-users@googlegroups.com [mailto:
 jenkinsci-users@googlegroups.com] *On Behalf Of *Nicky Ramone
 *Sent:* Mittwoch, 11. April 2012 18:31
 *To:* jenkinsci-users@googlegroups.com
 *Subject:* Promoted Builds Plugin: Does not automatically promote despite
 qualifications being met

 ** **

 Hello.

 ** **

 I have the following build sequence with Maven jobs: A -- B -- C and I
 want to promote A when C has finished successfully.

 I am tracking fingerprints of the same artifact in all 3 jobs, and I
 verify that they are correct.

 ** **

 When C finishes, the Promotion Status looks fine with met qualifications:
 

 ** **
  Promotions  my_promotion

 [Force promotion]

 This promotion has not happened.
  Met Qualification 

 *Downstream builds succeeded*

 C #8 http://localhost:8080/job/C/8/
 Unmet
 Qualification 

 ** **

 Despite that, the promotion never occurs (you can see the label This
 promotion has not happened).

 I found a couple of threads/issues that seem to be pointing to the same
 problem, but no solution available:

 http://jenkins.361315.n4.nabble.com/Promotion-is-not-working-td3643188.html
 

 https://issues.jenkins-ci.org/browse/JENKINS-10199

 ** **

 I'm using Jenkins 1.455 and Promoted Builds Plugin 2.4

 Has anyone else come across this issue?

 ** **

 Thanks

 Cheers.

 ** **



Re: pre-build/tested commits

2012-04-12 Thread Thomas Sondergaard

On 2012-04-11 21:47, Sami Tikka wrote:

Probably not. AFAIK there is no way to tell git this branch is now
ready and merged and it will never again receive new commits and it
can be deleted

It is always possible to checkout an old branch and add new commits to it.

If you are concerned about the large number of branches in the central
repository, you could tell each developer they are allowed to have
only 1 branch in there. A developer would always need to merge the
feature branch he is working on to his own branch on the central repo.

OTOH I'm not sure why the large number of branches would be a problem?
Can you explain it?


I really can't. We are just now starting up with git. Going from CVS to 
git is sort of like going from Visual Basic to C++ and I worry that we 
are going to get our feet shot off. Well, I worried. This quote calmed 
me down :-)


It is easy to shoot your foot off with git,
but also easy to revert to a previous foot and merge it with your 
current leg.


—Jack William Bell


Thanks for your help,

Thomas