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

Add pipeline-model-definition plugin #179

Merged
merged 21 commits into from
Sep 30, 2020
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
a8eb438
Add pipeline-model-definition plugin
chriskilding Jan 27, 2020
1c7f014
Bump pipeline-model-definition to 1.7.0, remove docker deps
chriskilding Jun 24, 2020
02bb058
fixes
chriskilding Jun 25, 2020
165f6d7
Use pipeline-stage-step 2.5
chriskilding Jun 25, 2020
6b68069
Turn off failFast while all remaining test failures are diagnosed
jglick Jun 25, 2020
ed4ebd6
Merge branch 'master' of github.com:jenkinsci/bom into add-pipeline-m…
jglick Jun 25, 2020
c7bb746
Use jackson2-api 2.11.0
chriskilding Jul 8, 2020
f3ea6d8
Revert "Use jackson2-api 2.11.0"
chriskilding Jul 9, 2020
3dbad5c
Use branch-api 2.5.7
chriskilding Jul 9, 2020
9c93910
Catch up to master, start from pipeline-model-definition plus minimal…
chriskilding Jul 13, 2020
945c570
Merge branch 'master' into add-pipeline-model-definition-plugin
chriskilding Jul 13, 2020
c5dead4
Merge branch 'master' of github.com:jenkinsci/bom into add-pipeline-m…
jglick Jul 17, 2020
fdae3eb
Use branch-api 2.5.8
chriskilding Jul 20, 2020
b489a73
Trying to make sure PCT failures always result in an unstable status.
jglick Jul 20, 2020
bcbe59a
Merge branch 'master' of github.com:jenkinsci/bom into add-pipeline-m…
jglick Jul 20, 2020
91fdadd
b489a73 was improperly marking plugins failed due to known test failures
jglick Jul 20, 2020
97a6938
Still not right; if Surefire starts to run but then the VM crashes, w…
jglick Jul 20, 2020
0efb311
Merge branch 'master' into add-pipeline-model-definition-plugin
chriskilding Sep 30, 2020
862b01e
Use ExampleStep in declarative pipeline test, reinstate failfast
chriskilding Sep 30, 2020
32499c4
Bump pipeline-model-definition to 1.7.2
chriskilding Sep 30, 2020
bd36b6b
Rebuild
chriskilding Sep 30, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 41 additions & 0 deletions bom-latest/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<properties>
<configuration-as-code-plugin.version>1.41</configuration-as-code-plugin.version>
<git-plugin.version>4.3.0</git-plugin.version>
<pipeline-model-definition-plugin.version>1.7.0</pipeline-model-definition-plugin.version>
<scm-api-plugin.version>2.6.3</scm-api-plugin.version>
<structs-plugin.version>1.20</structs-plugin.version>
<workflow-api-plugin.version>2.40</workflow-api-plugin.version>
Expand Down Expand Up @@ -78,6 +79,11 @@
<artifactId>workflow-job</artifactId>
<version>2.39</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<version>2.16</version>
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
Expand Down Expand Up @@ -171,6 +177,11 @@
<artifactId>git-server</artifactId>
<version>1.9</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jackson2-api</artifactId>
<version>2.10.2</version>
Copy link
Member

Choose a reason for hiding this comment

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

shouldn't this be:

Suggested change
<version>2.10.2</version>
<version>2.11.0</version>

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Can be. Also I just found that PMD uses 2.9.8, so maybe it needs to be pulled forward too

Copy link
Contributor

Choose a reason for hiding this comment

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

@chriskilding It doesn't care.

Copy link
Member

Choose a reason for hiding this comment

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

Anyway if we are introducing plugins to the BOM, may as well pick the newest version now, or Dependabot will offer it soon enough.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Looks like it wasn't quite that simple... had to backpedal that for now.

  • pipeline-model-api 1.7.0 wants Jackson 2.9.8
  • CasC test-harness 1.36 wants Jackson 2.10.2 (though I don't get how we are even getting 1.36, as the BOM declares 1.41 and nothing seems to override this)

Copy link
Member

Choose a reason for hiding this comment

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

I don't get how we are even getting 1.36, as the BOM declares 1.41

In all LTS lines?

Copy link
Member

Choose a reason for hiding this comment

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

Not sure I understand the problem. One plugin wants 2.9.8+, another wants 2.10.2+, we pick 2.11.0, all should be fine?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I don't get how we are even getting 1.36, as the BOM declares 1.41

In all LTS lines?

Ah, 2.204.x was the culprit.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

The sample POM doesn't directly depend on Jackson at the moment, so I guess that left the version conflict unresolved. I'll add a dependency.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

pipeline-model-api seems happy to be bumped to Jackson 2.11.0 though. jenkinsci/pipeline-model-definition-plugin#399

</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>jdk-tool</artifactId>
Expand Down Expand Up @@ -216,6 +227,11 @@
<artifactId>pipeline-input-step</artifactId>
<version>2.11</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<version>2.3</version>
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plain-credentials</artifactId>
Expand Down Expand Up @@ -282,6 +298,31 @@
<artifactId>jquery-detached</artifactId>
<version>1.2.1</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-api</artifactId>
<version>${pipeline-model-definition-plugin.version}</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-declarative-agent</artifactId>
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
<version>1.1.1</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-definition</artifactId>
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
<version>${pipeline-model-definition-plugin.version}</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-extensions</artifactId>
<version>${pipeline-model-definition-plugin.version}</version>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-stage-tags-metadata</artifactId>
<version>${pipeline-model-definition-plugin.version}</version>
</dependency>
<!-- Non-plugins: -->
<dependency>
<groupId>org.jenkins-ci</groupId>
Expand Down
10 changes: 10 additions & 0 deletions sample-plugin/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,16 @@
<artifactId>pipeline-input-step</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-definition</artifactId>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-declarative-agent</artifactId>
chriskilding marked this conversation as resolved.
Show resolved Hide resolved
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>timestamper</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
package io.jenkins.tools.bom.sample;

import org.jenkinsci.plugins.workflow.cps.CpsFlowDefinition;
import org.jenkinsci.plugins.workflow.job.WorkflowJob;
import org.jenkinsci.plugins.workflow.job.WorkflowRun;
import org.junit.ClassRule;
import org.junit.Rule;
import org.junit.Test;
import org.jvnet.hudson.test.BuildWatcher;
import org.jvnet.hudson.test.JenkinsRule;

public class DeclarativePipelineTest {
@ClassRule
public static BuildWatcher buildWatcher = new BuildWatcher();

@Rule
public JenkinsRule r = new JenkinsRule();

@Test
public void smokes() throws Exception {
final WorkflowRun run = runPipeline(m(
"pipeline {",
" agent none",
" stages {",
" stage('Example') {",
" steps {",
" echo 'Hello world'",
Copy link
Member

Choose a reason for hiding this comment

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

May as well

Suggested change
" echo 'Hello world'",
" example(x: 'some value')",

and for that matter just move this to ExampleStepTest.

" }",
" }",
" }",
"}"));

r.assertBuildStatusSuccess(run);
r.assertLogContains("Hello world", run);
}

/**
* Run a pipeline job synchronously.
*
* @param definition the pipeline job definition
* @return the started job
*/
private WorkflowRun runPipeline(String definition) throws Exception {
final WorkflowJob project = r.createProject(WorkflowJob.class, "example");
project.setDefinition(new CpsFlowDefinition(definition, true));
final WorkflowRun workflowRun = project.scheduleBuild2(0).waitForStart();
r.waitForCompletion(workflowRun);
return workflowRun;
}

/**
* Approximates a multiline string in Java.
*
* @param lines the lines to concatenate with a newline separator
* @return the concatenated multiline string
*/
private static String m(String... lines) {
return String.join("\n", lines);
}
}