Skip to content

Commit

Permalink
Merge pull request #178 from cloudbees-days/cd-ro-workshop
Browse files Browse the repository at this point in the history
reformat
  • Loading branch information
zvercodebender committed Sep 18, 2023
2 parents e92c20c + 6d9ab42 commit 615335e
Show file tree
Hide file tree
Showing 172 changed files with 176 additions and 0 deletions.
68 changes: 68 additions & 0 deletions labs/cloudbees-cdro-v2/support/dsl/Workshop_Service_Catalog.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
catalog 'Workshop', {
projectName = 'Workshop'

catalogItem '1. Basic Release', {
description = '''<xml>
<title>
Create a new released based on pipeline templates
</title>
<htmlData>
<![CDATA[
Create a new release from existing pipeline templates
]]>
</htmlData>
</xml>'''
buttonLabel = 'Create'
catalogName = 'Workshop'
dslString = '''def StartDate = (new Date())
def StartDateStr = (String) StartDate.format( "yyyy-MM-dd" )
def EndDateStr = (String) (StartDate+14).format( "yyyy-MM-dd" )
release args.releaseName, {
projectName = args.targetProject
plannedStartDate = StartDateStr
plannedEndDate = EndDateStr
pipelineProjectName = "Workshop"
pipelineName = "Pipeline_base"
Release_Name = args.releaseTag
String[] tags = args.releaseTag.replaceAll("[.]", "").split(", ");
for (String tagItem: tags) {
tag tagItem
}
}'''
endTargetJson = '''{
"source": "parameter",
"object": "release",
"objectName": "releaseName",
"objectProjectName": "targetProject",
"objectId": "id"
}'''
iconUrl = 'icon-pipeline.svg'
useFormalParameter = '1'

formalParameter 'releaseName', {
label = 'Release Name'
orderIndex = '1'
required = '1'
type = 'entry'
}

formalParameter 'releaseTag', {
label = 'Release Tags'
orderIndex = '2'
required = '1'
type = 'entry'
}
formalParameter 'targetProject', defaultValue: '$[/myUser/userName]', {
expansionDeferred = '0'
label = 'Target Project'
orderIndex = '3'
required = '1'
type = 'project'
}
}
}
108 changes: 108 additions & 0 deletions labs/cloudbees-cdro-v2/support/dsl/pipeline_Base.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
pipeline 'pipeline_Base', {
projectName = 'Workshop'

formalParameter 'ec_stagesToRun', {
expansionDeferred = '1'
}

stage 'Release Readiness', {
colorCode = '#289ce1'
pipelineName = 'pipeline_Base'
gate 'POST', {
task 'No Code Smells', {
gateCondition = '$[/javascript myStageRuntime.tasks[\'Get latest SonarQube scan results\'].job.getLastSonarMetrics.code_smells != null || myStageRuntime.tasks[\'Get latest SonarQube scan results\'].job.getLastSonarMetrics.code_smells < 1]'
gateType = 'POST'
subproject = 'Workshop'
taskType = 'CONDITIONAL'
}
}

task 'Git changelog', {
actualParameter = [
'branch': 'main',
'commit': '',
'config': '/projects/Workshop/pluginConfigurations/Git-Source-Code-Sync',
'depth': '',
'gitRepoFolder': '/tmp/demo-app',
'mirror': 'false',
'overwrite': 'true',
'pathspecs': '',
'referenceFolder': '',
'repoUrl': 'https://github.com/cloudbees-days/cdro-workshop-demo-app',
'resultPropertySheet': '/myJob/clone',
'shallowSubmodules': 'false',
'submodules': 'false',
'tag': '',
]
stageSummaryParameters = '[{"label":"cloneData","name":"cloneData"}]'
subpluginKey = 'EC-Git'
subprocedure = 'Clone'
taskType = 'PLUGIN'
}

task 'Get latest SonarQube scan results', {
actualParameter = [
'config': '/projects/Workshop/pluginConfigurations/cb-demos-sonar',
'resultFormat': 'propertysheet',
'resultSonarProperty': '/myJob/getLastSonarMetrics',
'sonarMetricsComplexity': 'all',
'sonarMetricsDocumentation': 'all',
'sonarMetricsDuplications': 'all',
'sonarMetricsIssues': 'all',
'sonarMetricsMaintainability': 'all',
'sonarMetricsMetrics': 'all',
'sonarMetricsQualityGates': 'all',
'sonarMetricsReliability': 'all',
'sonarMetricsSecurity': 'all',
'sonarMetricsTests': 'all',
'sonarProjectKey': 'petclinic',
'sonarProjectName': 'petclinic',
'sonarProjectVersion': '2.2.0.BUILD-SNAPSHOT',
'sonarTaskId': '',
'sonarTimeout': '',
]
subpluginKey = 'EC-SonarQube'
subprocedure = 'Get Last SonarQube Metrics'
taskType = 'PLUGIN'
}
}

stage 'Quality Assurance', {
colorCode = '#ff7f0e'
pipelineName = 'pipeline_Base'
task 'Deploy to QA', {
command = 'echo "Deploy to QA"'
taskType = 'COMMAND'
}
}

stage 'Production', {
colorCode = '#2ca02c'
pipelineName = 'pipeline_Base'
gate 'PRE', {
task 'Manual approval', {
gateType = 'PRE'
notificationEnabled = '1'
notificationTemplate = 'ec_default_gate_task_notification_template'
subproject = 'Workshop'
taskType = 'APPROVAL'
approver = [
'rbroker',
]
}
}

task 'Deploy to Production', {
command = 'echo "Deploy to Production"'
taskType = 'COMMAND'
}
}

// Custom properties

property 'ec_counters', {

// Custom properties
pipelineCounter = '1'
}
}

0 comments on commit 615335e

Please sign in to comment.