Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

allow interpolation of SCM urls #450

Merged
merged 4 commits into from
Feb 8, 2023
Merged

Conversation

jtnord
Copy link
Member

@jtnord jtnord commented Feb 8, 2023

ammend #442 to allow use of project.artifactId and artifactId as properties inside the SCM section

testing a project with maven 4.0.0-alpha4 showed no warnings or errors about this use case, and we have many plugins that use it.

Whilst fixing all the plugin is nobale - that would unessescarily hold up future improvements.

  • Make sure you are opening from a topic/feature/bugfix branch (right side) and not your main branch!
  • Ensure that the pull request title represents the desired changelog entry
  • Please describe what you did
  • Link to relevant issues in GitHub or Jira
  • Link to relevant pull requests, esp. upstream and downstream changes
  • Ensure you have provided tests - that demonstrates feature works or fixes the issue

ammend jenkinsci#442 to allow use of project.artifactId and artifactId as
properties inside the SCM section

testing a project with maven 4.0.0-alpha4 showed no warnings or errors
about this use case, and we have many plugins that use it.

Whilst fixing all the plugin is nobale - that would unessescarily hold
up future improvements.
if (original == null) {
return null;
}
return original.replace("${project.artifactId}", artifactId).replace("${artifactId}", artifactId);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

whilst this could have used a regular expression to do a replacement in one - this is easier to test and any runtime overhead difference between the 2 would disapear into the timing of actually running tests.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, looks like I was a bit too aggressive in #442. The original code had:

                transformedConnectionUrl.replaceAll(
                        "\\$\\{project\\.artifactId\\}", pomData.artifactId);

so we probably only need to deal with project.artifactId rather than artifactId. There can't be too many of these if this is working in BOM: how hard would it be to just fix them up? Also are these mostly proprietary or open source plugins?

Also the method could be private.

Copy link
Member Author

@jtnord jtnord Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Package scope to allow testing the method.

Had tried a regexp so that really needed the test but switched from regexp and left the test.

Happy to simplify to just project.artifactId.

Looks to be about 30+ stopped triaging after seeing same failure repeated.

Given this is a simple change I would say once I have a pr to validate this we should merge and I can fixup plugins at leisure and then we can eventually revert this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh I forgot to commit the unit test 🤦

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anything that has been incrementalified should be using flatten-maven-plugin which will interpolate these variables in the published POM so I am guessing this is probably a bigger issue in proprietary plugins.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yup, most are proprietary, electricflow is the only one that jumps out from OSS land.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

probably only need to deal with project.artifactId rather than artifactId

Adapted in 817dafc

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

electricflow is the only one that jumps out from OSS land

Which I filed a PR to fix two weeks ago: jenkinsci/electricflow-plugin#333

Never ceases to amaze me how long it takes for my PRs to be acknowledged and merged.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh never mind, that PR wouldn't have fixed the issue because the plugin isn't incrementalized. I'll file a separate PR to incrementalify it.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if (original == null) {
return null;
}
return original.replace("${project.artifactId}", artifactId).replace("${artifactId}", artifactId);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah I see, looks like I was a bit too aggressive in #442. The original code had:

                transformedConnectionUrl.replaceAll(
                        "\\$\\{project\\.artifactId\\}", pomData.artifactId);

so we probably only need to deal with project.artifactId rather than artifactId. There can't be too many of these if this is working in BOM: how hard would it be to just fix them up? Also are these mostly proprietary or open source plugins?

Also the method could be private.

@basil basil merged commit 142eefa into jenkinsci:master Feb 8, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants