Skip to main content
Version: Deploy 22.2

Stitch on CLIs

Some of the Stitch features, like preview or dry run, can be run through either Jython or XL CLI.

The Stitch Dry run allows you to execute a Stitch preview run with different sets of Stitch rules which are not yet defined in the system or that are run against the git branches. When a dry run is executed, the transformation engine will take all those rule files in the input or from the branch, validate them, parse them and use the rule files defined in them to do a Stitch transformation on specified deployment object.

Note: The limitation of the dry run, when used with files or directories, is that it won't parse any processor templates in the external files. Running dry run against a Branch doesn't have this limitation.

Dry run using XL CLI

The Stitch dry or preview run can be run using the XL CLI. Following are supported XL CLI document kinds. Running Stitch preview using

  • StitchPreview kind: Preview the stitch transformations by running the xl preview command:
---
apiVersion: xl-deploy/v1
kind: StitchDryRun
spec:
package: Applications/XL/cmd/AppWithCommands/1.0
environment: !value environmentName

The above example will take deployeds in package and run a Stitch preview for the environment. See Stitch peview for reference about preview and response received for this action.

  • StitchDryRun kind: Preview the stitch transformations by running the xl preview command:
---
apiVersion: xl-deploy/v1
kind: StitchDryRun
spec:
package: !value package
environment: !value environment
stitchSource: !value source
branchName: !value branch

The above example is similar to StitchPreview one with additional parameters for running dry run against given branch defined with stitchSource and branchName. See Stitch Branches for additional reference on GitOps for Stitch.

Dry run using Jython CLI

The Stitch dry run can be run using the Jython CLI. The methods available under the stitch in CLI are described below.

Validation of rule files

  • validateRules(stitchRules)
    • parameters:
      • stitchRules List of stitch rule YAMLs as String
    • returns: a list of errors, the list is empty if the rules provided are valid
  • validateRuleFiles(stitchFilePaths)
    • parameters:
      • stitchFilePaths List of stitch rule file paths
    • returns: a list of errors, the list is empty if the rules provided are valid
  • validateRuleFromDirectory(stitchDirectoryPath)
    • parameters:
      • stitchDirectoryPath A path to a directory containing stitch files
    • returns: a list of errors, the list is empty if the rules provided are valid

Dry run against Branch

  • dryRun(deployment, sourceId, branchName)
    • parameters:
      • deployment a deployment object
      • sourceId A source CI ID we want to run dry-run against.
      • branchName A branch name against which we want to run dry-run against.
    • returns: a PreviewResult object containing a map of Deployeds and it's invocation list with details about: input, output, diff, processors and errors
  • dryRunWithBreakpoint(deployedName, invocationId, processorId, deployment, sourceId, branchName)
    • parameters:
      • deployedName The name of the deployed against which we want to check the processor breakpoint run
      • invocationId The order number in a list of invocations against which we want to the check processor breakpoint run
      • processorId The UUID of the processor as a String - the actual place of breakpoint we want to see the diff for
      • deployment The deployment object
      • sourceId The source CI ID we want to run the dry-run against.
      • branchName The branch name against which we want to run the dry-run against.
    • returns: an InvocationDiffView object containing: input, output and diff for a processor call

Dry run against external defined rules

  • dryRun(deployment, stitchRules)
    • parameters:
      • deployment a deployment object
      • stitchRules A path to a directory containing stitch files
    • returns: a PreviewResult object containing a map of Deployeds and it's invocation list with details about: input, output, diff, processors and errors
  • dryRunRuleFileList(deployment, stitchFilePaths)
    • parameters:
      • deployment a deployment object
      • stitchFilePaths List of stitch rule file paths
    • returns: a PreviewResult object containing a map of Deployeds and it's invocation list with details about: input, output, diff, processors and errors
  • dryRunRuleDirectory(deployment, stitchDirectoryPath)
    • parameters:
      • deployment a deployment object
      • stitchDirectoryPath A path to a directory containing stitch files
    • returns: a PreviewResult object containing a map of Deployeds and it's invocation list with details about: input, output, diff, processors and errors