-
Notifications
You must be signed in to change notification settings - Fork 1.1k
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
[JENKINS-42971] GitSCMFileSystem consumes environment and expands branch name #1305
[JENKINS-42971] GitSCMFileSystem consumes environment and expands branch name #1305
Conversation
Hmm i wonder what the "/* Unreliable on Windows and not a platform specific test */" means in the failing test... |
:) It means that the test has been unreliable in the past on Windows and the maintainers did not have time to understand why it was unreliable on Windows. History of that is captured in the commit messages in case you want to see the sordid details. |
af89b80
to
a69a857
Compare
Hmm so I understand that I should just ammend commit and run it again as there might be a chance I didnt break it. I was not able to debug the test in my Idea for some strange reason, so I cannot tell if this test was affected by my changes Edit: Ok I was able to run it in debugger and it was probabbly not related to my changes :) |
pom.xml
Outdated
<pluginRepository><!-- TODO FOR DRAFT --> | ||
<id>incrementals.jenkins-ci.org</id> | ||
<url>https://repo.jenkins-ci.org/incrementals/</url> | ||
</pluginRepository> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
<pluginRepository><!-- TODO FOR DRAFT --> | |
<id>incrementals.jenkins-ci.org</id> | |
<url>https://repo.jenkins-ci.org/incrementals/</url> | |
</pluginRepository> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I must say that I wasnt able to compile it locally without these temporary .pom changes, but I assume they will be removed before it will be merged
Co-authored-by: Jesse Glick <[email protected]>
I did a small refactor of the calculation of the headName. I dont know what is the best practice in this project, I made a dedicated public static method, so that it could be tested standalone. Do you prefer a utility class or can we leave it as is ? |
4743bb8
to
d7159dc
Compare
I need it in incrementals, so I can make an integration test in workflow-cps, so i converted it to to PR (removed draft) |
Incrementals are published from draft PRs. |
pom.xml
Outdated
@@ -61,7 +61,7 @@ | |||
<revision>4.11.5</revision> | |||
<changelist>-SNAPSHOT</changelist> | |||
<gitHubRepo>jenkinsci/${project.artifactId}-plugin</gitHubRepo> | |||
<jenkins.version>2.303.3</jenkins.version> | |||
<jenkins.version>2.319.3</jenkins.version> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Update
Line 78 in d7159dc
<artifactId>bom-2.303.x</artifactId> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok i updated it, I hope correctly
private final String headName; | ||
private final String prefix; | ||
|
||
public HeadNameResult(String headName, String prefix) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Stylistically I would recommend
public HeadNameResult(String headName, String prefix) { | |
private HeadNameResult(String headName, String prefix) { |
and then moving calculateHeadName
inside this nested class, and renaming it accordingly (to simply calculate
, or create
, or make
, or of
, etc.).
@@ -283,15 +284,66 @@ public boolean supportsDescriptor(SCMSourceDescriptor descriptor) { | |||
return AbstractGitSCMSource.class.isAssignableFrom(descriptor.clazz); | |||
} | |||
|
|||
public static class HeadNameResult |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public static class HeadNameResult | |
static class HeadNameResult |
Not used outside this class and the test, right?
(In which case you could also simplify a bit by dropping private
from the fields and removing the getters—this is just an internal struct, no need for accessors.)
public void calculate_head_name_with_env() throws Exception | ||
{ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
public void calculate_head_name_with_env() throws Exception | |
{ | |
public void calculate_head_name_with_env() throws Exception { |
@@ -427,6 +429,43 @@ public void filesystem_supports_descriptor() throws Exception { | |||
assertTrue(SCMFileSystem.supports(descriptor)); | |||
} | |||
|
|||
@Issue("JENKINS-42971") | |||
@Test |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
May also want to assert behavior with a null env, undefined variable, etc.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
there is one for null env, but this is internal method, and there are many checks already in the calling method
#898 (comment) should be investigated. Also that PR touches |
Co-authored-by: Jesse Glick <[email protected]>
Hello pinging again as this PR is opened too long, can we either finish it up somehow or probabbly add some improvements? @MarkEWaite or @dwnusbaum or @car-roll ? |
Hmm |
Ping again (i apolagize in advance for pinging) |
Thanks for the ping. I'll be busy all this weekend preparing for DevOps World and then busy all week at DevOps World. I may be able to start the review a week or two after DevOps World |
Can we retrigger? If i force push (just to trigger build) the approvals will disapear and the test that failed seems to be some kind of unreliable test (should not affected by my change) |
Hello is it time now? :) |
Not yet. I'm on vacation with family and friends and won't return until the end of this week. I hope to start the review early next week, after some restart time as I return. |
Looking forward to this improvement to be merged. It suffers when working with a monorepo and not being able to turn on lightweight checkout. |
@MarkEWaite Hello can we like do this quick, there are only 2 files in this, one is test and one is the file. I am afraid that the build system will change soon and i will have to start over on this. Can you find some hour at least or 15 minutes to quick check it? some guys already approved it. There are also tests added. Please :) Also there is another plugin in different repo that cannot even start PR process until this one is merged if you will be ok with that. |
The branch name "master" is a default in many places. Using a non-default value in the tests (slightly) reduces the chances of a default being returned instead of the expected expansion of the variable.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for your patience @MartinKosicky . Approved..
I need to perform some interactive testing of an incremental build before it is released. I expect that release will happen later this week.
Just to clarify, who will merge the branch, you after the manual test? |
Yes, I'll merge the branch and I'll perform the release. |
After building and installing the workflow-cps plugin with the change, I was able to confirm that this resolves JENKINS-42971. Thanks! |
Thanks :) |
JENKINS-42971 Expand environment for branch names
GitSCMFileSystem now implements new SCM Builder APi that receives the Run that can is used to expand branch name with environment variables.