Hudson deploys snapshots when maven unit tests fail

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Hudson deploys snapshots when maven unit tests fail

Dang H. Nguyen

This might be an old issue that's been resolved, but I want to know if my understanding of http://issues.hudson-ci.org/browse/HUDSON-959 is correct. We're having Hudson projects fail unit tests, but Hudson still deploys the snapshot artifacts into Nexus. The desired outcome would be to have Hudson fail the build if the unit tests fail.

 

If I'm reading HUDSON-959 correctly, I need to add " -Dmaven.test.failure.ignore=false" to the MAVEN_OPTS parameter (probably the global one). However, since HUDSON-959 is relatively old, I want to know if this is still the correct way to fix this problem.

 

Thanks,

Dang Nguyen

Reply | Threaded
Open this post in threaded view
|

Re: Hudson deploys snapshots when maven unit tests fail

Kedar Mhaswade-3
On 07/22/2010 06:02 PM, Dang H. Nguyen wrote:

>
> This might be an old issue that's been resolved, but I want to know if
> my understanding of http://issues.hudson-ci.org/browse/HUDSON-959 is
> correct. We're having Hudson projects fail unit tests, but Hudson
> still deploys the snapshot artifacts into Nexus. The desired outcome
> would be to have Hudson fail the build if the unit tests fail.
>
> If I'm reading HUDSON-959 correctly, I need to add "
> -Dmaven.test.failure.ignore=false" to the MAVEN_OPTS parameter
> (probably the global one). However, since HUDSON-959 is relatively
> old, I want to know if this is still the correct way to fix this problem.
>
> Thanks,
>
> Dang Nguyen
>
I think the bug report says that setting the Maven property is a
workaround and it also describes the side effect of doing the work-around.
The build is marked yellow when the tests fail (as against red when
compilation/build-step fails). So, I guess you are saying that Hudson should
fail the deployment of artifacts to Nexus (not the build) if the tests
fail.
I thought that that is what the resolution comment from Kohsuke means
(deployment is done outside Maven).

Let me do some checks. In the meanwhile, can you apply the workaround
and confirm that the deployment to Nexus does not occur when tests fail?

-Kedar

---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

Re: Hudson deploys snapshots when maven unit tests fail

Kedar Mhaswade-3
On 07/22/2010 06:44 PM, kedar wrote:

> On 07/22/2010 06:02 PM, Dang H. Nguyen wrote:
>>
>> This might be an old issue that's been resolved, but I want to know
>> if my understanding of http://issues.hudson-ci.org/browse/HUDSON-959 
>> is correct. We're having Hudson projects fail unit tests, but Hudson
>> still deploys the snapshot artifacts into Nexus. The desired outcome
>> would be to have Hudson fail the build if the unit tests fail.
>>
>> If I'm reading HUDSON-959 correctly, I need to add "
>> -Dmaven.test.failure.ignore=false" to the MAVEN_OPTS parameter
>> (probably the global one). However, since HUDSON-959 is relatively
>> old, I want to know if this is still the correct way to fix this
>> problem.
>>
>> Thanks,
>>
>> Dang Nguyen
>>
> I think the bug report says that setting the Maven property is a
> workaround and it also describes the side effect of doing the
> work-around.
> The build is marked yellow when the tests fail (as against red when
> compilation/build-step fails). So, I guess you are saying that Hudson
> should
> fail the deployment of artifacts to Nexus (not the build) if the tests
> fail.
> I thought that that is what the resolution comment from Kohsuke means
> (deployment is done outside Maven).
>
> Let me do some checks. In the meanwhile, can you apply the workaround
> and confirm that the deployment to Nexus does not occur when tests fail?
>
I just checked and now think that Hudson is behaving correctly, i.e. it
does not (by default) deploy the artifacts to Nexus if tests fail.
Can you check the project configuration -> Post build Actions -> Deploy
artifacts to Maven repository -> *Advanced* button?
I guess you have the check-box for "Deploy even if the build is
unstable" checked and maybe that's why the deployment to Nexus is
attempted regardless of whether tests fail.

I am not exactly sure why this configuration facility is provided in the
first place.
(I mean when would you want to force the upload of artifacts that are
failing tests?)

> -Kedar


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]

Reply | Threaded
Open this post in threaded view
|

RE: Hudson deploys snapshots when maven unit tests fail

Dang H. Nguyen
All of our projects don't use the Hudson "Deploy" config that you've referred to. Instead, we specify "-U clean deploy" in the build section, under goals and options. I just tried to execute a build using the Hudson post-build Deploy config, and I got deployment errors (probably why the projects are configured the way they are now).

Deploying the main artifact pom.xml
[INFO ] Retrieving previous build number from
[INFO ] repository metadata for: 'snapshot com.kiha.server.services:social-network-service-deployment:1.8-SNAPSHOT' could not be found on repository: , so will be created
ERROR: Error deploying artifact: Resource to deploy not found: File: https://ops-nexus-1.kihatest.com:8443/nexus/content/repository/com/kiha/server/services/social-network-service-deployment/1.8-SNAPSHOT/social-network-service-deployment-1.8-20100723.151947-1.pom does not exist
org.apache.maven.artifact.deployer.ArtifactDeploymentException: Error deploying artifact: Resource to deploy not found: File: https://ops-nexus-1.kihatest.com:8443/nexus/content/repository/com/kiha/server/services/social-network-service-deployment/1.8-SNAPSHOT/social-network-service-deployment-1.8-20100723.151947-1.pom does not exist
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:94)
        at hudson.maven.reporters.MavenArtifactRecord.deploy(MavenArtifactRecord.java:119)
        at hudson.maven.reporters.MavenAggregatedArtifactRecord.deploy(MavenAggregatedArtifactRecord.java:79)
        at hudson.maven.RedeployPublisher.perform(RedeployPublisher.java:109)
        at hudson.tasks.BuildStepMonitor$1.perform(BuildStepMonitor.java:19)
        at hudson.model.AbstractBuild$AbstractRunner.perform(AbstractBuild.java:601)
        at hudson.model.AbstractBuild$AbstractRunner.performAllBuildSteps(AbstractBuild.java:580)
        at hudson.maven.MavenModuleSetBuild$RunnerImpl.post2(MavenModuleSetBuild.java:598)
        at hudson.model.AbstractBuild$AbstractRunner.post(AbstractBuild.java:528)
        at hudson.model.Run.run(Run.java:1264)
        at hudson.maven.MavenModuleSetBuild.run(MavenModuleSetBuild.java:306)
        at hudson.model.ResourceController.execute(ResourceController.java:88)
        at hudson.model.Executor.run(Executor.java:124)
Caused by: org.apache.maven.wagon.TransferFailedException: Resource to deploy not found: File: https://ops-nexus-1.kihatest.com:8443/nexus/content/repository/com/kiha/server/services/social-network-service-deployment/1.8-SNAPSHOT/social-network-service-deployment-1.8-20100723.151947-1.pom does not exist
        at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:283)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putArtifact(DefaultWagonManager.java:160)
        at org.apache.maven.artifact.deployer.DefaultArtifactDeployer.deploy(DefaultArtifactDeployer.java:80)
        ... 12 more
Caused by: org.apache.maven.wagon.ResourceDoesNotExistException: File: https://ops-nexus-1.kihatest.com:8443/nexus/content/repository/com/kiha/server/services/social-network-service-deployment/1.8-SNAPSHOT/social-network-service-deployment-1.8-20100723.151947-1.pom does not exist
        at org.apache.maven.wagon.providers.http.LightweightHttpWagon.put(LightweightHttpWagon.java:168)
        at org.apache.maven.artifact.manager.DefaultWagonManager.putRemoteFile(DefaultWagonManager.java:244)
        ... 14 more


________________________________________
From: kedar [[hidden email]]
Sent: Thursday, July 22, 2010 8:21 PM
To: [hidden email]
Subject: Re: Hudson deploys snapshots when maven unit tests fail

On 07/22/2010 06:44 PM, kedar wrote:

> On 07/22/2010 06:02 PM, Dang H. Nguyen wrote:
>>
>> This might be an old issue that's been resolved, but I want to know
>> if my understanding of http://issues.hudson-ci.org/browse/HUDSON-959
>> is correct. We're having Hudson projects fail unit tests, but Hudson
>> still deploys the snapshot artifacts into Nexus. The desired outcome
>> would be to have Hudson fail the build if the unit tests fail.
>>
>> If I'm reading HUDSON-959 correctly, I need to add "
>> -Dmaven.test.failure.ignore=false" to the MAVEN_OPTS parameter
>> (probably the global one). However, since HUDSON-959 is relatively
>> old, I want to know if this is still the correct way to fix this
>> problem.
>>
>> Thanks,
>>
>> Dang Nguyen
>>
> I think the bug report says that setting the Maven property is a
> workaround and it also describes the side effect of doing the
> work-around.
> The build is marked yellow when the tests fail (as against red when
> compilation/build-step fails). So, I guess you are saying that Hudson
> should
> fail the deployment of artifacts to Nexus (not the build) if the tests
> fail.
> I thought that that is what the resolution comment from Kohsuke means
> (deployment is done outside Maven).
>
> Let me do some checks. In the meanwhile, can you apply the workaround
> and confirm that the deployment to Nexus does not occur when tests fail?
>
I just checked and now think that Hudson is behaving correctly, i.e. it
does not (by default) deploy the artifacts to Nexus if tests fail.
Can you check the project configuration -> Post build Actions -> Deploy
artifacts to Maven repository -> *Advanced* button?
I guess you have the check-box for "Deploy even if the build is
unstable" checked and maybe that's why the deployment to Nexus is
attempted regardless of whether tests fail.

I am not exactly sure why this configuration facility is provided in the
first place.
(I mean when would you want to force the upload of artifacts that are
failing tests?)

> -Kedar


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]


---------------------------------------------------------------------
To unsubscribe, e-mail: [hidden email]
For additional commands, e-mail: [hidden email]