-
Notifications
You must be signed in to change notification settings - Fork 195
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] CpsScmFlowDefinition sends build to SCMFileSystem in … #577
[JENKINS-42971] CpsScmFlowDefinition sends build to SCMFileSystem in … #577
Conversation
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.
Ought to include an integration test picking up jenkinsci/git-plugin#1305 and demonstrating effectiveness in solving the stated bug.
Im planning to add integration test here and unit test in Git plugin |
Done |
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
hmm, are these check fails related to this PR ? |
From a quick glance, looks like infrastructure problems with Windows agents; retriggered build. |
1f065b7
to
ea74d85
Compare
Now there is a bunch of :( |
ea74d85
to
cc23daa
Compare
OK, that much seems to be fixed, sorry for the interruption. @dduportal FYI |
Ok this is testCase I was working on but not that test, hmm. Locally they were all sucesful. I will assume that I broke something? |
5e5aea3
to
7239bbe
Compare
@@ -115,7 +115,7 @@ public boolean isLightweight() { | |||
Run<?,?> build = (Run<?,?>) _build; | |||
String expandedScriptPath = build.getEnvironment(listener).expand(scriptPath); | |||
if (isLightweight()) { | |||
try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm)) { | |||
try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm,null, build)) { |
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.
try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm,null, build)) { | |
try (SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm, null, build)) { |
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
Edit docs: #329 (comment) |
hmm, ill try to bump the versions? |
@jglick do you have any suggestion if I should bump the versions in git plugin? or what should we do here ? |
When I import the incremental build of git plugin to my Idea, I see different versions than those that were specified in the incremental .pom file. Also the test seems to look at the pom definitions? Or I dont know where it knows the versions, but I see that maven loaded a different version than was generated in the .pom |
You may need to configure your IDE to honor workflow-cps-plugin/.mvn/maven.config Line 1 in 9101f1b
mvn is authoritative.
possibly just means that this should subsume #574. |
Yes I am taking the incrementals, i saw this behaviour also in mvn dependency tree to confirm. |
4ee0b63
to
54d0770
Compare
hmm the build seemed to completely change , now i have to figure out how to build this thing in idea :( ok i seemed to broke the history by some dump rebase , eh |
fix newline Co-authored-by: Devin Nusbaum <[email protected]>
I think it shouls be ok now |
@MarkEWaite hello, will you have time so we can finalize these 3 PRs. This one is the last and I think you also tested this already when we were working with the git-scm |
I've added it to the plugins.txt file that I'm using for my testing of git plugin 5.0.0 and git client plugin 4.0.0. I'll include the details of JENKINS-42971 in my testing. |
I've confirmed that the incremental release of this pull request resolves JENKINS-42971. I tested with the git plugin 5.0.0 pre-release and the git client plugin 4.0.0 pre-release. |
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! Approved
Thank you :). Hmm just a quick question, how does the merging process work here? Who will merge this or we need more approvals? |
One of the maintainers needs to merge it. Since two of them have approved the pull request, I believe it is ready for merge. Once it is merged, the continuous delivery process will release a new version of the plugin. |
Note that in this project, being ready for merge is no guarantee that a pull request will be merged in a timely fashion. I routinely file PRs that are approved by maintainers with the green checkmark yet remain unmerged (and therefore unreleased) for an extended period of time. |
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.
Seems OK though I have not followed details recently. @dwnusbaum was most recently reviewing seriously; not sure if he is around to check latest changes.
plugin/src/test/java/org/jenkinsci/plugins/workflow/cps/CpsScmFlowDefinitionTest.java
Outdated
Show resolved
Hide resolved
def.setLightweight(true); | ||
p.setDefinition(def); | ||
|
||
r.assertBuildStatusSuccess(p.scheduleBuild2(0, new ParametersAction(new StringParameterValue("BRANCH", "master2")))); |
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.
Do you mean to also assert that it actually loaded the specified revision of flow.groovy
, for example by checking the altered message?
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.
FTR with main
reverted, the failure is as expected
java.lang.AssertionError:
unexpected build status; build log was:
------
Started
hudson.plugins.git.GitException: Command "git fetch --tags --force --progress --prune -- origin +refs/heads/${BRANCH}:refs/remotes/origin/${BRANCH}" returned status code 128:
stdout:
stderr: fatal: couldn't find remote ref refs/heads/${BRANCH}
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandIn(CliGitAPIImpl.java:2734)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.launchCommandWithCredentials(CliGitAPIImpl.java:2111)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl.access$500(CliGitAPIImpl.java:87)
at org.jenkinsci.plugins.gitclient.CliGitAPIImpl$1.execute(CliGitAPIImpl.java:623)
at jenkins.plugins.git.GitSCMFileSystem$BuilderImpl.build(GitSCMFileSystem.java:406)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:219)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:191)
at jenkins.scm.api.SCMFileSystem.of(SCMFileSystem.java:174)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:118)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinition.create(CpsScmFlowDefinition.java:70)
at org.jenkinsci.plugins.workflow.job.WorkflowRun.run(WorkflowRun.java:312)
at hudson.model.ResourceController.execute(ResourceController.java:107)
at hudson.model.Executor.run(Executor.java:449)
Finished: FAILURE
------
Expected: is <SUCCESS>
but: was <FAILURE>
at org.hamcrest.MatcherAssert.assertThat(MatcherAssert.java:20)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatus(JenkinsRule.java:1438)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatus(JenkinsRule.java:1444)
at org.jvnet.hudson.test.JenkinsRule.assertBuildStatusSuccess(JenkinsRule.java:1472)
at org.jenkinsci.plugins.workflow.cps.CpsScmFlowDefinitionTest.lightweight_brach_parametrised(CpsScmFlowDefinitionTest.java:222)
Would just be nice to strengthen the test to prove that it was really running from the correct branch, and not merely that the build passed.
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.
Hmm but on 4th august you wrote that :
jglick on Aug 4
Probably a more straightforward way to assert this. Or just delete entirely—the fact that the build ran at all (when the repo only contains the master2 branch) is proof enough that the fix worked, right?
I was parsing the log output before, or did i misunderstood the conversation before...
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.
Sigh, this is what happens when months go by between review comments. Fine enough as it is.
No, my recent review was just to try to help resolve #577 (comment) and a bad merge related to #612, which is something I worked on. I have not looked at this PR beyond that. |
I found no issues related to this change in my testing of git plugin 5.0.0 and git client plugin 4.0.0. I would like to see it merged and released. Thanks for your patience @MartinKosicky ! |
Most recent build from pull request 577 jenkinsci/workflow-cps-plugin#577
Does not include the expansion of environment variables in lightweight checkout. jenkinsci/workflow-cps-plugin#577 is the lightweight checkout pull request.
Thank you :) |
Thank you for driving this forward and for your patience. |
I added in CpsScmFlowDefinition (create) to send to lightweight checkout the build value into SCMFileSystem.of which is changed in jenkinsci/scm-api-plugin#160. The goal is to be able to expand branch value by build params if branch name contains for example ${BRANCH}