Skip to content

Instantly share code, notes, and snippets.

View gmaxey's full-sized avatar

Greg Maxey gmaxey

View GitHub Profile
@gmaxey
gmaxey / IntegerReduction.groovy
Last active March 22, 2019 13:15
Steps to reduce an integer to one digit
/* Groovy
How many steps to reduce an integer to one digit, where "reduce" is the result of multiplying the integer's digits.
See: https://youtu.be/Wim9WJeDTHQ
*/
def InputInteger = 277777788888899
def FullList=""
@gmaxey
gmaxey / RowColumnLabeledTableSlurper.groovy
Created June 28, 2018 14:26
Convert a table with row and column labels into a Groovy data structure
def RowColumnLabeledTableSlurper = { t ->
/*
Convert a table with row and column labels into a Groovy data structure
C1 C2 C3
R1 1 2 3
R2 4 5 6
to
@gmaxey
gmaxey / Subpipelines.groovy
Created June 27, 2018 15:06
Electric Flow subpipeline example
/*
Electric Flow DSL - Subpipeline Example
Creates a master pipeline with multiple sub- and sub-sub-pipelines. When run, one of the sub-sub-pipelines intentionally fails; the Pipeline Portfolio view clearly show the issue and allows easy traceback.
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile "Subpipelines.google"
or, run this file through the DSLIDE
@gmaxey
gmaxey / unplug_collision_report.dsl
Last active June 28, 2018 20:31
Electric Flow unplug plugin environment collision report
/*
Electric Flow DSL for unplug - Collision Report
Dependencies
- unplug v2.1.0 or later
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile "unplug_collision_report.dsl"
@gmaxey
gmaxey / CreateReleasesFromJira.groovy
Last active June 27, 2018 14:18
Create Electric Flow Releases from Jira Version/Releases using the EC-Rest plugin
/*
Electric Flow DSL - Create Releases from Jira
This example shows how to create Flow Release from Jira Versions (Releases)
Dependencies
- EC-Rest
- A configuration
@gmaxey
gmaxey / JiraTriggerUsingRetry.groovy
Last active June 15, 2018 15:38
Use of Jira to trigger a pipeline stage promotion using task retry
/*
Electric Flow DSL - Pipeline triggering from Jira ticket state change
This example shows how a Jira ticket created in a pipeline can be used to enable a stage promotion from Jira. The ticket is created in a pipeline task, aproved in Jira, satisfying the pipeline stage exit criteria. The pipeline gate task retry feature is used to wait for the Jira ticket to be completed.
Dependencies
- EC-JIRA
- A Jira configuration
@gmaxey
gmaxey / PipelineOutputParameters.groovy
Created June 13, 2018 16:30
Use of output parameters in pipelines to pass data between task and gate conditions
/*
Electric Flow DSL - Use of Output Parameters in Pipelines
With version 8.2, output parameters were added. These are very useful in pipeline contexts as an easy way to share data between tasks. The following example shows how a task procedure's output can be used in a subsequent task and also as a gate condition.
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile PipelineOutputParameters.groovy
2. Run the pipeline, Project Name: Output Parameters, Pipeline Name: Use Output Parameters
@gmaxey
gmaxey / Collision Report.groovy
Created June 1, 2018 18:29
Generate Electric Flow Environment Reservation Conflict Report
/*
Electric Flow DSL - Collision Report Generator
Dependencies
- EF-ReportingTools plugin, https://github.com/electric-cloud/EF-ReportingTools
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile "Collision Report.groovy"
@gmaxey
gmaxey / PipelineWaitForSubpipelineStage.groovy
Last active May 8, 2018 20:14
Wait for subpipeline stage to completed
/*
Electric Flow DSL - Wait for subpipeline stage to completed
Master pipeline launches Slave pipeline, but waits for Slave pipeline first stage to complete before continuing to its second stage, then waits for the Slave pipeline to complete successfully before completing.
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile PipelineWaitForSubpipelineStage.groovy
2. Run the pipeline, Project Name: Pipeline synchronization, Pipeline: Master
@gmaxey
gmaxey / SmartMap.groovy
Created May 3, 2018 15:39
Create Electric Flow SmartMap view
/*
Electric Flow DSL minimal data to generate SmartMap view (new in EF v8.3)
Instructions
1. Run the DSL through EC-DSLIDE or from the command line:
- ectool evalDsl --dslFile SmartMap.groovy
2. Navigate to Applications, select Project Name: Smart Map, Application Name: App A
3. Select SmartMap Topology View