Skip to content

Commit

Permalink
[JENKINS-38865] First work on separating ModelAST.
Browse files Browse the repository at this point in the history
  • Loading branch information
abayer committed Oct 12, 2016
1 parent f4fffa2 commit 1fd77c6
Show file tree
Hide file tree
Showing 249 changed files with 563 additions and 232 deletions.
251 changes: 251 additions & 0 deletions pipeline-model-api/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,251 @@
<!--
~ The MIT License
~
~ Copyright (c) 2016, CloudBees, Inc.
~
~ Permission is hereby granted, free of charge, to any person obtaining a copy
~ of this software and associated documentation files (the "Software"), to deal
~ in the Software without restriction, including without limitation the rights
~ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
~ copies of the Software, and to permit persons to whom the Software is
~ furnished to do so, subject to the following conditions:
~
~ The above copyright notice and this permission notice shall be included in
~ all copies or substantial portions of the Software.
~
~ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
~ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
~ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
~ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
~ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
~ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
~ THE SOFTWARE.
-->

<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>plugin</artifactId>
<version>2.13</version>
</parent>

<groupId>org.jenkinsci.plugins</groupId>
<artifactId>pipeline-model-api</artifactId>
<version>0.5-SNAPSHOT</version>
<packaging>hpi</packaging>
<name>Pipeline: Model API</name>
<description>An opinionated, declarative Pipeline</description>
<url>https://wiki.jenkins-ci.org/display/JENKINS/Pipeline+Model+Definition+Plugin</url>

<licenses>
<license>
<name>MIT</name>
<url>http://opensource.org/licenses/MIT</url>
<distribution>repo</distribution>
</license>
</licenses>

<developers>
<developer>
<id>abayer</id>
<name>Andrew Bayer</name>
</developer>
</developers>

<scm>
<connection>scm:git:git://git@github.com/jenkinsci/pipeline-config-plugin.git</connection>
<developerConnection>scm:git:git@github.com:jenkinsci/pipeline-config-plugin.git</developerConnection>
<url>https://github.com/jenkinsci/pipeline-config-plugin</url>
<tag>HEAD</tag>
</scm>

<build>
<plugins>
<plugin>
<groupId>org.codehaus.gmaven</groupId>
<artifactId>gmaven-plugin</artifactId>
<version>1.4</version>
<configuration>
<providerSelection>1.8</providerSelection>
</configuration>
<executions>
<execution>
<goals>
<goal>generateStubs</goal>
<goal>compile</goal>
<goal>generateTestStubs</goal>
<goal>testCompile</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<systemProperties>
<property>
<name>hudson.udp</name>
<value>33849</value>
</property>
</systemProperties>
<argLine>-Xmx4g -XX:MaxPermSize=256m</argLine>
<reuseForks>true</reuseForks>
<forkCount>0.5C</forkCount>
<!-- TODO: I hate the retrying tests but given the nondeterministic whackiness of JENKINS-37101... -->
<rerunFailingTestsCount>3</rerunFailingTestsCount>
</configuration>
</plugin>

</plugins>
</build>

<dependencies>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps</artifactId>
<version>2.18</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-job</artifactId>
<version>2.6</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-multibranch</artifactId>
<version>2.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>script-security</artifactId>
<version>1.22</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-basic-steps</artifactId>
<version>2.1</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-durable-task-step</artifactId>
<version>2.4</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>pipeline-stage-step</artifactId>
<version>2.2</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>docker-workflow</artifactId>
<version>1.8</version>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>structs</artifactId>
<version>1.5</version>
</dependency>

<!-- JSON schema stuff -->
<dependency>
<groupId>com.github.fge</groupId>
<artifactId>json-schema-validator</artifactId>
<version>2.0.4</version>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.datatype</groupId>
<artifactId>jackson-datatype-json-org</artifactId>
<version>2.2.3</version>
</dependency>

<!-- TEST deps -->
<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.6.0</version>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jenkins-ci.main</groupId>
<artifactId>jenkins-test-harness-tools</artifactId>
<version>2.0</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-cps-global-lib</artifactId>
<version>2.3</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins</groupId>
<artifactId>git</artifactId>
<version>2.6.0</version>
<classifier>tests</classifier>
<scope>test</scope>
<exclusions>
<exclusion>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-scm-step</artifactId>
<version>2.2</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.jenkins-ci.plugins.workflow</groupId>
<artifactId>workflow-support</artifactId>
<version>2.2</version>
<classifier>tests</classifier>
<scope>test</scope>
</dependency>

</dependencies>

<properties>
<jenkins.version>2.7.1</jenkins.version>
<java.level>7</java.level>
<groovy.version>2.4.7</groovy.version>
</properties>

<repositories>
<repository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>repo.jenkins-ci.org</id>
<url>http://repo.jenkins-ci.org/public/</url>
</pluginRepository>
</pluginRepositories>

</project>
Original file line number Diff line number Diff line change
Expand Up @@ -25,12 +25,11 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.ast

import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Agent
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
* Represents what context in which to run the build - i.e., which label to run on, what Docker agent to run in, etc.
* Corresponds to {@link Agent}.
* Corresponds to Agent.
*
* @author Andrew Bayer
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,14 +27,11 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.BuildCondition
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Notifications
import org.jenkinsci.plugins.pipeline.modeldefinition.model.PostBuild
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
* Represents a single {@link BuildCondition} to be checked and possibly executed in either the {@link PostBuild} or
* {@link Notifications} sections.
* Represents a single BuildCondition to be checked and possibly executed in either the PostBuild or
* Notifications sections.
*
* @author Andrew Bayer
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Environment
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,9 +28,6 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.BuildCondition
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Notifications
import org.jenkinsci.plugins.pipeline.modeldefinition.model.StepsBlock
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Root
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,10 +28,6 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.BuildCondition
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Notifications
import org.jenkinsci.plugins.pipeline.modeldefinition.model.PostBuild
import org.jenkinsci.plugins.pipeline.modeldefinition.model.StepsBlock
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@
package org.jenkinsci.plugins.pipeline.modeldefinition.ast

import groovy.transform.ToString
import org.jenkinsci.plugins.pipeline.modeldefinition.steps.ScriptStep

/**
* Represents the special step for {@link ScriptStep}, which are executed without validation against the declarative subset.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,10 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Stage
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
* Represents an individual {@link Stage} and the {@link ModelASTBranch}s it may contain.
* Represents an individual Stage and the {@link ModelASTBranch}s it may contain.
*
* @author Kohsuke Kawaguchi
* @author Andrew Bayer
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Stage
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Stages
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ package org.jenkinsci.plugins.pipeline.modeldefinition.ast
import edu.umd.cs.findbugs.annotations.SuppressFBWarnings
import groovy.transform.ToString
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.Utils
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand All @@ -15,11 +14,19 @@ import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator
@ToString(includeSuper = true, includeSuperProperties = true)
@SuppressFBWarnings(value="SE_NO_SERIALVERSIONID")
public class ModelASTStep extends ModelASTElement {
public static Map<String,String> blockedStepsBase() {
return [
"stage": 'The stage step cannot be used in Declarative Pipelines',
"properties": 'The properties step cannot be used in Declarative Pipelines',
"parallel": "The parallel step can only be used as the only top-level step in a stage's step block"
]
}

/**
* A list of step names which are banned from being executed within a step block.
*/
public static Map<String, String> getBlockedSteps() {
return Utils.blockedStepsBase()
return blockedStepsBase()
}

String name;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,6 @@ import groovy.transform.EqualsAndHashCode
import groovy.transform.ToString
import net.sf.json.JSONArray
import net.sf.json.JSONObject
import org.jenkinsci.plugins.pipeline.modeldefinition.model.Tools
import org.jenkinsci.plugins.pipeline.modeldefinition.validator.ModelValidator

/**
Expand Down
Loading

0 comments on commit 1fd77c6

Please sign in to comment.