SAP / jenkins-library

Jenkins shared library for Continuous Delivery pipelines.
https://www.project-piper.io
Apache License 2.0
769 stars 583 forks source link

mavenBuild: issue with custom maven settings.xml loaded from URL #4897

Open maryia-haladko opened 2 months ago

maryia-haladko commented 2 months ago

Hi colleagues!

Our team started to set up the piper pipeline and we have our custom settings.xml which is uploaded to the Artifactory and it is used in the piper configuration:

general:
  ....
  projectSettingsFile: 'https://****settings.xml'
  ....

It's perfectly loaded and used in the artifactPrepareVersion step and in the mavenBuild step install part, but when it comes to deploy, we are facing with the following issue:

Could not create or update project settings xml: Could not update settings xml: failed to unmarshal settings xml file 'https://****settings.xml': failed to read file '.pipeline/mavenProjectSettings': open .pipeline/mavenProjectSettings: no such file or directory

The first issue I see from the code that here https://github.com/SAP/jenkins-library/blob/master/pkg/maven/settings.go#L173 the fact that the setting file can be a URL and not a local file isn't taken into account.

The second issue, the file doesn't have an extension .xml https://github.com/SAP/jenkins-library/blob/master/pkg/maven/settings.go#L171 and https://github.com/SAP/jenkins-library/blob/master/pkg/maven/settings.go#L177.

So even if with the first issue the file doesn't exist, the .pipeline/mavenProjectSettings.xml should be found, because it was created from the projectSettingsFile property URL for mvn install part. But the file isn't found, I assume, because the file doesn't have an extension (issue 2).

Could you, please, check the mentioned issues and whether they are valid? Thank you in advance!

github-actions[bot] commented 3 weeks ago

Thank you for your contribution! This issue is stale because it has been open 60 days with no activity. In order to keep it open, please remove stale label or add a comment within the next 10 days. If you need a Piper team member to remove the stale label make sure to add @SAP/jenkins-library-team to your comment.

maryia-haladko commented 3 weeks ago

Hi @SAP/jenkins-library-team, please remove stale label

anilkeshav27 commented 2 weeks ago

@maryia-haladko , in artifactPrepareVersion do you also pass the file or is it a default file that we enforce that is SAP specefic ?

the step can download if the parameter value is a url

artifactory is generally internet facing and will need credentials to download. the step does not handle url which needs credentials to download the settings xml

maryia-haladko commented 2 weeks ago

@anilkeshav27, i use global setting projectSettingsFile

atm i use my own fork with the fix https://github.com/SAP/jenkins-library/commit/b39e2677a20c855a6cd0ccbf2c3f53593cf9f6f3, piper downloads the file from internal artifactory without the issues