-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add initial support for validating GoCD pipeline file syntax
- Loading branch information
1 parent
c0582d6
commit 2fb9958
Showing
13 changed files
with
860 additions
and
18 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
package artifacts_and_html_reports | ||
|
||
import cd.go.contrib.plugins.configrepo.groovy.dsl.GoCD | ||
|
||
GoCD.script { | ||
pipeline { | ||
pipeline('website') { | ||
group = "example-group" | ||
|
||
trackingTool { | ||
link = 'https://github.com/gocd/api.go.cd/issues/${ID}' | ||
regex = ~/##(\\d+)/ | ||
} | ||
|
||
materials { | ||
git { | ||
url = 'https://github.com/gocd/api.go.cd' | ||
branch = 'release-18.1.0' | ||
} | ||
} | ||
stages { | ||
stage('build-website') { | ||
jobs { | ||
job('build') { | ||
tasks { | ||
bash { | ||
commandString = 'bundle install --path .bundle -j4' | ||
} | ||
bash { | ||
commandString = 'bundle exec rake build' | ||
} | ||
} | ||
|
||
artifacts { | ||
build { | ||
source = 'build/18.1.0' | ||
destination = 'website' | ||
} | ||
} | ||
|
||
tabs { | ||
tab('website') { path = 'website/18.1.0/index.html' } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,61 @@ | ||
{ | ||
"format_version": 9, | ||
"label_template": "${COUNT}", | ||
"enable_pipeline_locking": false, | ||
"name": "my_pipeline", | ||
"group": "configrepo-example", | ||
"tracking_tool": null, | ||
"timer": null, | ||
"environment_variables": [], | ||
"materials": [ | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/NikAraga/gocd-pipeline-sample-json.git", | ||
"destination": "code", | ||
"filter": { | ||
"ignore": [ | ||
"**/*.*", | ||
"**/*.html" | ||
] | ||
}, | ||
"name": "git", | ||
"auto_update": true, | ||
"branch": "master", | ||
"submodule_folder": null | ||
} | ||
], | ||
"stages": [ | ||
{ | ||
"name": "my_stage_1", | ||
"fetch_materials": true, | ||
"clean_working_directory": false, | ||
"never_cleanup_artifacts": false, | ||
"approval": null, | ||
"environment_variables": [], | ||
"jobs": [ | ||
{ | ||
"name": "my_job_1", | ||
"run_instance_count": null, | ||
"timeout": 0, | ||
"environment_variables": [], | ||
"tasks": [ | ||
{ | ||
"type": "exec", | ||
"run_if": "passed", | ||
"on_cancel": { | ||
"type": "exec", | ||
"command": "ls", | ||
"working_directory": null | ||
}, | ||
"command": "echo", | ||
"arguments": [ | ||
"Hello From GOCD pipeline" | ||
], | ||
"working_directory": null | ||
} | ||
], | ||
"properties": null | ||
} | ||
] | ||
} | ||
} |
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,60 @@ | ||
#ci.gocd.yaml | ||
format_version: 9 | ||
environments: | ||
testing: | ||
environment_variables: | ||
DEPLOYMENT: testing | ||
secure_variables: | ||
ENV_PASSWORD: "s&Du#@$xsSa" | ||
pipelines: | ||
- example-deploy-testing | ||
- build-testing | ||
pipelines: | ||
mypipe1: # definition of mypipe1 pipeline | ||
group: mygroup # note that the group name can contain only of alphanumeric & underscore characters | ||
display_order: 10 | ||
label_template: "${mygit[:8]}" | ||
lock_behavior: none | ||
parameters: # list of parameters that can be configured for a pipeline | ||
param1: value1 | ||
materials: | ||
mygit: # this is the name of material, the name can contain only of alphanumeric & underscore characters | ||
# keyword git says about type of material and url at once | ||
git: http://my.example.org/mygit.git | ||
branch: ci | ||
myupstream: # this name does not matter, but there should be no 2 materials with the same name | ||
# type is optional here, material type is implied based on presence of pipeline and stage fields | ||
# type: dependency | ||
pipeline: pipe2 | ||
stage: test | ||
stages: # list of stages in order | ||
- build: # name of stage | ||
clean_workspace: true | ||
jobs: | ||
csharp: # name of the job | ||
resources: | ||
- net45 | ||
artifacts: | ||
- build: | ||
source: bin/ | ||
destination: build | ||
- test: | ||
source: tests/ | ||
destination: test-reports/ | ||
- test: | ||
source: coverage.xml | ||
tabs: | ||
report: test-reports/index.html | ||
tasks: # ordered list of tasks to execute in job csharp | ||
fetch: | ||
pipeline: pipe2 | ||
stage: build | ||
job: test | ||
source: test-bin/ | ||
destination: bin/ | ||
- exec: # indicates type of task | ||
command: make | ||
arguments: | ||
- "VERBOSE=true" | ||
# shorthand for script-executor plugin | ||
- script: ./build.sh ci |
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 @@ | ||
package artifacts_and_html_reports | ||
|
||
import cd.go.contrib.plugins.configrepo.groovy.dsl.GoCD | ||
|
||
GoCD.script { | ||
pipelines { | ||
pipeline('website') { | ||
group = "example-group" | ||
|
||
trackingTool { | ||
link = 'https://github.com/gocd/api.go.cd/issues/${ID}' | ||
regex = ~/##(\\d+)/ | ||
} | ||
|
||
materials { | ||
git { | ||
url = 'https://github.com/gocd/api.go.cd' | ||
branch = 'release-18.1.0' | ||
} | ||
} | ||
stages { | ||
stage('build-website') { | ||
jobs { | ||
job('build') { | ||
tasks { | ||
bash { | ||
commandString = 'bundle install --path .bundle -j4' | ||
} | ||
bash { | ||
commandString = 'bundle exec rake build' | ||
} | ||
} | ||
|
||
artifacts { | ||
build { | ||
source = 'build/18.1.0' | ||
destination = 'website' | ||
} | ||
} | ||
|
||
tabs { | ||
tab('website') { path = 'website/18.1.0/index.html' } | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} | ||
} |
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,62 @@ | ||
{ | ||
"format_version" : 9, | ||
"label_template": "${COUNT}", | ||
"enable_pipeline_locking": false, | ||
"name": "my_pipeline", | ||
"group" : "configrepo-example", | ||
"tracking_tool": null, | ||
"timer": null, | ||
"environment_variables": [], | ||
"materials": [ | ||
{ | ||
"type": "git", | ||
"url": "https://github.com/NikAraga/gocd-pipeline-sample-json.git", | ||
"destination": "code", | ||
"filter": { | ||
"ignore": [ | ||
"**/*.*", | ||
"**/*.html" | ||
] | ||
}, | ||
"name": "git", | ||
"auto_update": true, | ||
"branch": "master", | ||
"submodule_folder": null | ||
} | ||
], | ||
"stages": [ | ||
{ | ||
"name": "my_stage_1", | ||
"fetch_materials": true, | ||
"clean_working_directory": false, | ||
"never_cleanup_artifacts": false, | ||
"approval": null, | ||
"environment_variables": [], | ||
"jobs": [ | ||
{ | ||
"name": "my_job_1", | ||
"run_instance_count": null, | ||
"timeout": 0, | ||
"environment_variables": [], | ||
"tasks": [ | ||
{ | ||
"type": "exec", | ||
"run_if": "passed", | ||
"on_cancel": { | ||
"type": "exec", | ||
"command": "ls", | ||
"working_directory": null | ||
}, | ||
"command": "echo", | ||
"arguments": [ | ||
"Hello From GOCD pipeline" | ||
], | ||
"working_directory": null | ||
} | ||
], | ||
"properties": null | ||
} | ||
] | ||
} | ||
] | ||
} |
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 @@ | ||
# Dummy file to test |
Oops, something went wrong.