Skip to content

Add Pipeline support && generic update#2

Merged
oleg-nenashev merged 19 commits into
jenkinsci:masterfrom
oleg-nenashev:pipeline-support
Dec 8, 2017
Merged

Add Pipeline support && generic update#2
oleg-nenashev merged 19 commits into
jenkinsci:masterfrom
oleg-nenashev:pipeline-support

Conversation

@oleg-nenashev
Copy link
Copy Markdown
Member

@oleg-nenashev oleg-nenashev commented Jan 2, 2017

I'm working on a pet project, which involves automation for Jenkins Pipeline based on libs. I need to test libs without committing changes, hence I decided to use Filesystem SCM plugin for such purpose. The plugin was very outdated (last release - 2011), hence there is a bunch of changes

  • Upgrade to the new Parent POM
  • Upgrade to the new core baseline (1.642.x)
  • Rework of the UI to use DataBound constructor (see screenshot of the changes)
  • Fixes of issues reported by FindBugs/Functional tests
  • Update SCM API to support Jobs/Runs
  • Delete button for the excludes/includes list

After the changes the plugin supports the scm step and can be used as a Library SCM source. Functional tests will be added later if original maintainers +1 the approach (CC @kohsuke, @samngms and @kutzi )

Old Config UI:

screen shot 2017-01-01 at 20 42 24

New config UI:

screen shot 2017-01-02 at 00 18 31

@reviewbybees

@ghost
Copy link
Copy Markdown

ghost commented Jan 2, 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.

@oleg-nenashev oleg-nenashev requested a review from jglick January 5, 2017 18:27
@jglick
Copy link
Copy Markdown
Member

jglick commented Jan 5, 2017

I need to test libs without committing changes, hence I decided to use Filesystem SCM plugin for such purpose.

Why not just use Replay?

@jglick jglick self-assigned this Jan 5, 2017
@oleg-nenashev
Copy link
Copy Markdown
Member Author

Why not just use Replay?

How it can help with Libraries? From what I see I will have to commit/push them every time. Not thet comfortable for the local development.

@jglick
Copy link
Copy Markdown
Member

jglick commented Jan 6, 2017

Why not just use Replay?

How it can help with Libraries? From what I see I will have to commit/push them every time.

No, at least for untrusted libraries you can replay library changes as well as main script or loaded script changes. For example, try

make -C workflow-aggregator-plugin/demo run

@jglick jglick removed their request for review February 6, 2017 18:48
@jglick jglick removed their assignment Feb 6, 2017
@BerndPfaff
Copy link
Copy Markdown

I used this snapshot in a Jenkins pipeline job. At first it was working as expected.
After that I tried to change the configuration of this job in the UI. But the SCM part of the pipeline configuration was changed to a different scm tool (e.g. CVS). It was also not possible to select "File System" as SCM tool anymore, even some other options were not available anymore in the drop-down menu.
Only after the configuration Pipeline Definitions was saved as "Pipeline script", instead of "Pipeline script from SCM", it was possible to change the configuration back as "Pipeline script from SCM" File System.
Is this a known issue?

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@BerndPfaff Nope, it is not. Will try to reproduce once I find some time to finish this pull request

@oleg-nenashev
Copy link
Copy Markdown
Member Author

Retriggering CI

@niothiel
Copy link
Copy Markdown

niothiel commented May 31, 2017

👍 Would love to see this update. We are doing something very similar and this looks immensely helpful.

@oleg-nenashev
Copy link
Copy Markdown
Member Author

I hope to finalize it soon

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@reviewbybees back to review.

@rsandell rsandell self-requested a review July 4, 2017 15:35
jglick
jglick previously requested changes Jul 5, 2017
Comment thread pom.xml
<licenses>
<license>
<name>MIT License</name>
<url>http://www.opensource.org/licenses/mit-license.php</url>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Does Netbeans already autoresolve it?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Yes I think so.

Comment thread pom.xml Outdated
<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-aggregator</artifactId>
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Do not use this plugin as a dependency even for tests. Specify workflow-cps, workflow-job, and any step plugins you need.

/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

fix

*/
public class PipelineLibraryTest {

}
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

???

Comment thread pom.xml Outdated
<version>2.4</version>
<scope>test</scope>
</dependency>
<!-- Transient upper bound dependencies -->
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Transitive?

import jenkins.SlaveToMasterFileCallable;

public class RemoteCopyDir implements FileCallable<Boolean> {
public class RemoteCopyDir extends SlaveToMasterFileCallable<Boolean> {
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Probably also wrong, though the class appears unused anyway so maybe just delete it.

import java.io.*;
import java.util.ArrayList;
import java.util.List;
import jenkins.security.SlaveToMasterCallable;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

unused import

<j:jelly xmlns:j="jelly:core" xmlns:st="jelly:stapler" xmlns:d="jelly:define" xmlns:l="/lib/layout" xmlns:t="/lib/hudson" xmlns:f="/lib/form">
<f:entry title="Path" help="/plugin/filesystem_scm/help-path.html">
<f:textbox name="fs_scm.path" value="${scm.path}" />
<f:entry title="Path" field="path" help="/plugin/filesystem_scm/help-path.html">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Move help file to this folder and help need not be specified.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It came from the old structure. I would prefer to refactor it later

</f:entry>
<f:entry title="Clear Workspace" help="/plugin/filesystem_scm/help-clearWorkspace.html">
<f:checkbox name="fs_scm.clearWorkspace" checked="${scm.clearWorkspace}"/>
<f:entry title="Clear Workspace" field="clearWorkspace" help="/plugin/filesystem_scm/help-clearWorkspace.html">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto.

</f:block>
</f:optionalBlock>
</table>
<f:entry title="Copy Hidden Files/Folders" field="copyHidden" help="/plugin/filesystem_scm/help-copyHidden.html">
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Ditto.

}

@Extension
@Symbol("fsscm")
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Should not include the scm. Maybe just filesystem?


@Override
public boolean requiresWorkspaceForPolling() {
return super.requiresWorkspaceForPolling(); //To change body of generated methods, choose Tools | Templates.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why?


public class RemoteCopyDir extends SlaveToMasterFileCallable<Boolean> {
/**
* @deprecated Not used anymore
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So just delete it.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Breaks binary compatibility. I do not want to touch it for now

// Init repo
// File fsscmDir = tmpDir.newFolder("fsscm");
// File jenkinsfile = new File(fsscmDir, "Jenkinsfile");
// FileUtils.write(jenkinsfile, "echo `Hello, world!`");
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Why commented out?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The test is still the mess

@jglick jglick dismissed their stale review July 17, 2017 18:54

Blockers fixed. Tests still look incomplete.

@oleg-nenashev
Copy link
Copy Markdown
Member Author

OK, now the test just hangs

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@jglick @niothiel @BerndPfaff I have released the current state as alpha-1. It should become available in the experimental UC soon. I will test it more before the release, especially the case from @BerndPfaff though I was unable to reproduce it.

@tanandy
Copy link
Copy Markdown

tanandy commented Aug 24, 2017

i got the same problem as @BerndPfaff

docker run --rm --name ci-jenkins-io-dev -v maven-repo:/home/xxx/test_demo/.m2 -v /home/xxx/shared-lib:/var/jenkins_home/pipeline-library -e DEV_HOST=${CURRENT_HOST} -p 8080:8080 -p 50000:50000 -e "JAVA_OPTS=-Dhttp.proxyHost=xxx -Dhttp.proxyPort=3128" -e "http_proxy=xxx" -e "https_proxy=xxx" onenashev/demo-jenkins-config-as-code

i create new pipeline job foo and put a wrong path into fspath then save (as admin:admin)
FS SCM disappear

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@tanandy Ack, I will double check it once I get back to the plugin

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@tanandy @BerndPfaff Fixed that stupid issue in the code and released alpha-2. Sorry, was working on other things and this slipped down the priority list

@tanandy
Copy link
Copy Markdown

tanandy commented Dec 6, 2017

@oleg-nenashev thanks a lot 👍

@maloups
Copy link
Copy Markdown

maloups commented Dec 6, 2017

It works perfectly! :)
Thank you very much!

@oleg-nenashev
Copy link
Copy Markdown
Member Author

I asked @jglick, he is fine with merging. I am about releasing it tomorrow. CC @abayer @svanoort just in case they have any comments/concerns.

@svanoort
Copy link
Copy Markdown
Member

svanoort commented Dec 6, 2017

I probably won't be able to review before then.

@oleg-nenashev
Copy link
Copy Markdown
Member Author

@svanoort just let me know if you want to review it. I can wait with release till Friday EoBD in your timezone. You know, conference-driven development :)

@oleg-nenashev oleg-nenashev merged commit ba9dad6 into jenkinsci:master Dec 8, 2017
@oleg-nenashev
Copy link
Copy Markdown
Member Author

🚢 🇮🇹

@oleg-nenashev
Copy link
Copy Markdown
Member Author

I will not bump the version to 2.0, there is no significant compat breakages

@oleg-nenashev
Copy link
Copy Markdown
Member Author

Well, I changed my mind after some consideration. In the worst case I will introduce 3.0 if I ever implement the SCM API

@oleg-nenashev
Copy link
Copy Markdown
Member Author

Oh well, better to be on the safe side OTOH

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

7 participants