[FOLIO-2935] Jenkins "deploy" stage failed due to file recreation issue Created: 04/Jan/21  Updated: 06/Jan/21  Resolved: 05/Jan/21

Status: Closed
Project: FOLIO
Components: Continuous Integration
Affects versions: None
Fix versions: None

Type: Task Priority: P2
Reporter: Dima Tkachenko Assignee: John Malconian
Resolution: Done Votes: 0
Labels: None
Remaining Estimate: Not Specified
Time Spent: Not Specified
Original estimate: Not Specified

Issue links:
Relates
relates to FOLIO-2928 Maven deploy fails on mod-remote-stor... Closed
Sprint: DevOps: Sprint 105, DevOps: Sprint 103, DevOps: Sprint 104
Development Team: FOLIO DevOps

 Description   

mod-password-validator cannot be built due to an issue with file recreation during "deploy" stage (https://jenkins-aws.indexdata.com/job/folio-org/job/mod-password-validator/job/master/28/consoleFull):

[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ mod-password-validator ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 40 source files to /home/jenkins/workspace/rg_mod-password-validator_master/target/classes
[INFO] -------------------------------------------------------------
[ERROR] COMPILATION ERROR : 
[INFO] -------------------------------------------------------------
[ERROR] /home/jenkins/workspace/rg_mod-password-validator_master/src/main/java/org/folio/pv/mapper/ValidationRuleMapper.java:[16,8] Internal error in the mapping processor: java.lang.RuntimeException: javax.annotation.processing.FilerException: Attempt to recreate a file for type org.folio.pv.mapper.ValidationRuleMapperImpl  	at org.mapstruct.ap.internal.processor.MapperRenderingProcessor.createSourceFile(MapperRenderingProcessor.java:59)  	at org.mapstruct.ap.internal.processor.MapperRenderingProcessor.writeToSourceFile(MapperRenderingProcessor.java:39)  	at org.mapstruct.ap.internal.processor.MapperRenderingProcessor.process(MapperRenderingProcessor.java:29)  	at org.mapstruct.ap.internal.processor.MapperRenderingProcessor.process(MapperRenderingProcessor.java:24)  	at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:283)  	at org.mapstruct.ap.MappingProcessor.processMapperTypeElement(MappingProcessor.java:263)  	at org.mapstruct.ap.MappingProcessor.processMapperElements(MappingProcessor.java:221)  	at org.mapstruct.ap.MappingProcessor.process(MappingProcessor.java:156)  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.callProcessor(JavacProcessingEnvironment.java:980)  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.discoverAndRunProcs(JavacProcessingEnvironment.java:896)  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment$Round.run(JavacProcessingEnvironment.java:1222)  	at jdk.compiler/com.sun.tools.javac.processing.JavacProcessingEnvironment.doProcessing(JavacProcessingEnvironment.java:1334)  	at

I suspect "mvn -DskipTests deploy" has to include clean phase to remove the file previously generated during "mvn clean org.jacoco:jacoco-maven-plugin:prepare-agent install org.jacoco:jacoco-maven-plugin:report"



 Comments   
Comment by David Crossley [ 04/Jan/21 ]

Dima Tkachenko The mod-remote-storage solved this with https://github.com/folio-org/mod-remote-storage/pull/10 adding "auto-clean" to their POM.

Perhaps this needs to be added to mod-spring-template.

Comment by Dima Tkachenko [ 05/Jan/21 ]

Hi David Crossley,

Thanks for the tip. Yes it might work in this particular case, but this solution adjusts any maven goal which could be not a desired behavior. For instance there is no need to recompile the whole code if tests are to be executed. Or if someone wants to get a dependency report he/she would need to wait until everything is rebuild from scratch.

Is there any problem with customizing "deploy" stage of Jenkins build by adding "clean" phase?

cc: Taras Spashchenko, Viachaslau Khandramai

Comment by Jakub Skoczen [ 05/Jan/21 ]

Julian Ladisch any idea why we are not seeing this issue with RMB-based modules?

Comment by Dima Tkachenko [ 05/Jan/21 ]

Jakub Skoczen
This issue is specific to MapStruct library and the way it generates the necessary files for the mapping. It does it during "compile" phase. Compilation is a part of both "install" and "deploy". But before the deploy there is no clean up and the file created during installation is still there.

RMB based modules don't use this library that's why the issue hasn't been faced before

I'll try to enable pre-cleaning specifically for deployment but not sure if it'll work or not

Comment by John Malconian [ 05/Jan/21 ]

Added an explicit 'clean' phase to the maven deploy step in the main Maven build pipeline. No need for additional POM configuration.

Comment by Dima Tkachenko [ 06/Jan/21 ]

Thanks, John Malconian

Generated at Thu Feb 08 23:24:21 UTC 2024 using Jira 1001.0.0-SNAPSHOT#100246-sha1:7a5c50119eb0633d306e14180817ddef5e80c75d.