Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #14 from abayer/jenkins-38152
JENKINS-38152 - expose execution model on WorkflowRun
- Loading branch information
Showing
26 changed files
with
399 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
# Information on extending/integrating with Pipeline Model Definition | ||
|
||
## API Endpoints | ||
|
||
All API endpoints are exposed under `JENKINS_URL/pipeline-model-converter` currently. | ||
|
||
### JSON Schema | ||
* *URL*: `JENKINS_URL/pipeline-model-converter/schema` | ||
* *Parameters*: None | ||
* *Info*: JSON schema for the JSON representation of the model. | ||
* *Returns*: The JSON schema | ||
|
||
### Validation of `Jenkinsfile` | ||
* *URL*: `JENKINS_URL/pipeine-model-converter/validateJenkinsfile` | ||
* *Parameters*: `jenkinsfile` - the `Jenkinsfile` contents | ||
* *Info*: Takes a `Jenkinsfile` and validates its syntax, semantics, steps, parameters etc on the Jenkins master. | ||
* *Returns*: JSON with a `result` field that will either be `success` or `failure`. If `failure`, there'll be an additional array in the `errors` field of the error messages encountered. | ||
|
||
### Validation of JSON representation | ||
* *URL*: `JENKINS_URL/pipeine-model-converter/validateJson` | ||
* *Parameters*: `json` - the JSON representation | ||
* *Info*: Takes a JSON representation of the model and validates its syntax, semantics, steps, parameters etc on the Jenkins master. | ||
* *Returns*: JSON with a `result` field that will either be `success` or `failure`. If `failure`, there'll be an additional array in the `errors` field of the error messages encountered. | ||
|
||
### Conversion to JSON representation from Jenkinsfile | ||
* *URL*: `JENKINS_URL/pipeline-model-converter/toJson` | ||
* *Parameters*: `jenkinsfile` - the `Jenkinsfile` contents | ||
* *Info*: Takes a `Jenkinsfile` and converts it to the JSON representation for its `pipeline` step. | ||
* *Returns*: JSON with a `result` field that will either be `success` or `failure`. If `success`, the JSON representation will be in the `json` field. If `failure`, there'll be an additional array in the `errors` field of the error messages encountered. | ||
|
||
### Conversion to Jenkinsfile from JSON representation | ||
* *URL*: `JENKINS_URL/pipeline-model-converter/toJenkinsfile` | ||
* *Parameters*: `json` - the JSON representation of the model | ||
* *Info*: Takes the JSON representation of the model and converts it to the contents for a `Jenkinsfile` invoking the `pipeline` step. | ||
* *Returns*: JSON with a `result` field that will either be `success` or `failure`. If `success`, the `Jenkinsfile` contents will be in the `jenkinsfile` field. If `failure`, there'll be an additional array in the `errors` field of the error messages encountered. | ||
|
||
## Java API | ||
|
||
### JSON schema | ||
* *API call*: `org.jenkinsci.plugins.pipeline.parser.Converter.getJSONSchema()` | ||
* *Parameters*: None | ||
* *Returns*: Returns the JSON representation schema | ||
|
||
### `WorkflowRun` execution model | ||
* *API call*: `someWorkflowRun.getAction(ExecutionModelAction.class).getStages()` | ||
* *Parameters*: None | ||
* *Returns*: The `ModelASTStages` for a particular `WorkflowRun`. This is generated at the beginning of build execution, stripped of | ||
`sourceLocation` references for serialization purposes, and attached to the `WorkflowRun`. Stage and branch execution order can be found here, | ||
even when the build hasn't gotten to those stages or branches yet, since the model dictates execution order. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
40 changes: 40 additions & 0 deletions
40
...ain/java/org/jenkinsci/plugins/pipeline/modeldefinition/actions/ExecutionModelAction.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* 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. | ||
*/ | ||
|
||
package org.jenkinsci.plugins.pipeline.modeldefinition.actions; | ||
|
||
import hudson.model.InvisibleAction; | ||
import org.jenkinsci.plugins.pipeline.modeldefinition.ast.ModelASTStages; | ||
|
||
public class ExecutionModelAction extends InvisibleAction { | ||
private final ModelASTStages stages; | ||
|
||
public ExecutionModelAction(ModelASTStages s) { | ||
this.stages = s; | ||
} | ||
|
||
public ModelASTStages getStages() { | ||
return stages; | ||
} | ||
} |
Oops, something went wrong.