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

[JENKINS-33273] Allow lightweight checkouts to be used from CpsScmFlowDefinition #97

Merged
merged 11 commits into from
Mar 3, 2017

Conversation

jglick
Copy link
Member

@jglick jglick commented Jan 13, 2017

Analogue of jenkinsci/workflow-multibranch-plugin#47 for standalone Pipeline projects.

@reviewbybees

pom.xml Outdated
@@ -199,7 +199,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.4.1</version>
<version>3.0.2-beta-2</version>
Copy link
Member Author

Choose a reason for hiding this comment

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

Will pick up jenkinsci/git-plugin#467 when available.

@ghost
Copy link

ghost commented Jan 13, 2017

This pull request originates from a CloudBees employee. At CloudBees, we require that all pull requests be reviewed by other CloudBees employees before we seek to have the change accepted. If you want to learn more about our process please see this explanation.

Queue.Executable _build = owner.getExecutable();
if (!(_build instanceof Run)) {
throw new IOException("can only check out SCM into a Run");
}
Run<?,?> build = (Run<?,?>) _build;
if (lightweight) {
SCMFileSystem fs = SCMFileSystem.of(build.getParent(), scm);
Copy link
Member

Choose a reason for hiding this comment

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

use try with resources

Copy link
Member

@stephenc stephenc left a comment

Choose a reason for hiding this comment

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

🐛 forgetting to close SCMFileSystem

Copy link
Member

@rsandell rsandell left a comment

Choose a reason for hiding this comment

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

🐝

@@ -0,0 +1,5 @@
<div>
If selected, try to obtain the Pipeline script contents directly from the SCM without performing a full checkout.
The advantage of this mode is its efficiency; however, you will not get any changelogs or polling based on the SCM.
Copy link
Member

Choose a reason for hiding this comment

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

You should be able to get the changelogs with the SCMFilesystem API...

Copy link
Member Author

Choose a reason for hiding this comment

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

Would require a significant rewrite. Currently workflow-job knows to record changelogs, or consider polling, based on SCMListener methods which cannot be called in lightweight mode. I considered such a large change (APIs etc.) out of scope here, especially given that

  • many people will not care about changelogs or polling for the SCM containing the script
  • if you checkout scm the same repo later, you will get those anyway

@@ -29,6 +29,9 @@ THE SOFTWARE.
<f:entry field="scriptPath" title="${%Script Path}">
<f:textbox default="Jenkinsfile"/>
</f:entry>
<f:entry field="lightweight" title="${%Lightweight checkout}">
Copy link
Member

Choose a reason for hiding this comment

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

I would think you would at most want an advanced option to not try lightweight. If you can do lightweight, why wouldn't you want to?

Copy link
Member Author

Choose a reason for hiding this comment

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

I preferred to err on the side of leaving existing behavior alone by default for now.

  • lack of changelog/polling support (see below)
  • new code path with likely bugs compared to original

Copy link

Choose a reason for hiding this comment

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

This box is selected by default. I think it is safer to maintain existing behavior for existing Pipelines.

Copy link
Member Author

Choose a reason for hiding this comment

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

That is what we are doing—default is used for new definitions.

pom.xml Outdated
@@ -95,7 +95,7 @@
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>scm-api</artifactId>
<version>1.1</version>
<version>2.0.1</version>
Copy link
Member Author

Choose a reason for hiding this comment

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

Should ideally be bumped up to whatever release actually makes it to the UC.

Copy link
Member

@stephenc stephenc left a comment

Choose a reason for hiding this comment

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

🐝 but I am concerned about excessive options being added

@recampbell
Copy link
Member

This looks mergable?

@jglick
Copy link
Member Author

jglick commented Mar 2, 2017

Needs a code review, and would like signoff from @HRMPW as well.

@HRMPW
Copy link

HRMPW commented Mar 2, 2017

The UI change is minimal and looks good. 🐝

@jglick jglick merged commit 89b4e8d into jenkinsci:master Mar 3, 2017
@jglick jglick deleted the SCMFileSystem-JENKINS-33273 branch March 3, 2017 15:02
dwnusbaum added a commit to dwnusbaum/workflow-cps-plugin that referenced this pull request Jun 1, 2020
[JENKINS-57085] Avoid complex StackTraceElement.fileName values
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
6 participants