jenkins-infra / plugin-modernizer-tool

MIT License
10 stars 9 forks source link

Error: Missing relative path in pom file preventing parent download #261

Open gounthar opened 2 months ago

gounthar commented 2 months ago

Jenkins and plugins versions report

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugins badge,build-timestamp --recipes AddPluginsBom,AddCodeOwner --export-datatables
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Starting Plugin Modernizer 
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Skipping forking plugin badge in dry-run mode 
Skipping sync plugin badge in dry-run mode 
Fetching plugin code locally badge... 
Thread[JGit-FileStoreAttributeReader-1,5,main]: got smaller file timestamp on / (/.workspace/mark), /home/gitpod/.cache/jenkins-plugin-modernizer-cli/badge/sources/.git: 2024-09-12T15:00:39Z < 2024-09-12T15:00:39.795861241Z. Aborting measurement at resolution PT0.204138759S. 
Missing relative path in pom file preventing parent download 
Skipping plugin badge due to metadata/precondition errors. Check logs for more details. 
Skipping forking plugin build-timestamp in dry-run mode 
Skipping sync plugin build-timestamp in dry-run mode 
Fetching plugin code locally build-timestamp... 
Missing relative path in pom file preventing parent download 
Skipping plugin build-timestamp due to metadata/precondition errors. Check logs for more details. 
************* 
Plugin: badge 
Error: Missing relative path in pom file preventing parent download 
************* 
************* 
Plugin: build-timestamp 
Error: Missing relative path in pom file preventing parent download 
************* 
Plugin Modernizer finished. 

What Operating System are you using (both controller, and any agents involved in the problem)?

GitPod

Reproduction steps

java -jar plugin-modernizer-cli/target/jenkins-plugin-modernizer-999999-SNAPSHOT.jar --dry-run --plugins badge,build-timestamp --recipes AddPluginsBom,AddCodeOwner --export-datatables
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Starting Plugin Modernizer 
Picked up JAVA_TOOL_OPTIONS: -XX:+UseContainerSupport -XX:ActiveProcessorCount=1
Skipping forking plugin badge in dry-run mode 
Skipping sync plugin badge in dry-run mode 
Fetching plugin code locally badge... 
Thread[JGit-FileStoreAttributeReader-1,5,main]: got smaller file timestamp on / (/.workspace/mark), /home/gitpod/.cache/jenkins-plugin-modernizer-cli/badge/sources/.git: 2024-09-12T15:00:39Z < 2024-09-12T15:00:39.795861241Z. Aborting measurement at resolution PT0.204138759S. 
Missing relative path in pom file preventing parent download 
Skipping plugin badge due to metadata/precondition errors. Check logs for more details. 
Skipping forking plugin build-timestamp in dry-run mode 
Skipping sync plugin build-timestamp in dry-run mode 
Fetching plugin code locally build-timestamp... 
Missing relative path in pom file preventing parent download 
Skipping plugin build-timestamp due to metadata/precondition errors. Check logs for more details. 
************* 
Plugin: badge 
Error: Missing relative path in pom file preventing parent download 
************* 
************* 
Plugin: build-timestamp 
Error: Missing relative path in pom file preventing parent download 
************* 
Plugin Modernizer finished. 

Expected Results

logs

Actual Results

error

Anything else?

No response

Are you interested in contributing a fix?

No response

jonesbusy commented 2 months ago

More a missing feature than a bug

Error: Missing relative path in pom file preventing parent download 

Looks correct according to https://github.com/jenkinsci/badge-plugin/blob/master/pom.xml#L7

I think it work if by chanche you have already the parent pom on your local cache. Which is probably not the case on gitpod

Solution would be to statically extract the parent version and install it via maven invoker

mvn dependency:get -Dartifact=org.jenkins-ci.plugins:plugin:4.87:pom -DremoteRepositories=https://repo.jenkins-ci.org/public/ -Dtransitive=false

Then we can apply the recipe to include the relative path

gounthar commented 2 months ago

Thanks, I will have a look.👍

gounthar commented 2 months ago

The proposed workaround does not work for me. 🤷

Fetching plugin code locally build-timestamp... 
Missing relative path in pom file preventing parent download 
Skipping plugin build-timestamp due to metadata/precondition errors. Check logs for more details. 
************* 
Plugin: badge 
Error: Missing relative path in pom file preventing parent download 
************* 
************* 
Plugin: build-timestamp 
Error: Missing relative path in pom file preventing parent download 
************* 
Plugin Modernizer finished. 
gounthar commented 1 month ago

It's still the case today. 🤔