Skip to main content

Module Reference

Module (top level object)

To create a module, a public git repository must be created with the module.yaml file.

A module is basically a group of steps.

The module.yaml file goes through a templating engine first before getting parsed. So some variables are available:

  • {{ .Job }} and its childs, which represent the Job object using the module. Can be useful if you want to dynamically set an value based on the job.
  • {{ .Step }} and its childs, which represent the Step object using the module. Can be useful if you want the step name.

If you want your user to pass custom steps, you can use {{- .Step.Use.Steps | toYaml | nindent <n> }} which is the group of steps.

Example:

# module.yaml
steps:
- name: my step
{{- .Step.Use.Steps | toYaml | nindent 2 }}
- name: my other step
# job.yaml
steps:
- name: module
use:
source: git/my-module
steps:
- name: step by user
- name: another step by user

Will render:

# module.yaml
steps:
- name: my step
- name: step by user
- name: another step by user
- name: my other step

Notice that the templating follows the Go format. You can also apply sprig templating functions.

To outputs environment variables, just append KEY=value to the "${DEEPSQUARE_ENV}" file, like this:

echo "KEY=value" >> "${DEEPSQUARE_ENV}"

An example of module is available here.

FieldTypeDescription
nameString!

Name of the module.

Go name: "Name".

descriptionString!

Description of the module.

Go name: "Description".

minimumResourcesJobResources!

Minimum job resources.

Go name: "MinimumResources".

inputs[ModuleInput!]

List of allowed arguments.

Go name: "Inputs".

outputs[ModuleOutput!]

List of exported environment variables.

Go name: "Outputs".

steps[Step!]!

Steps of the module.

Go name: "Steps".

.inputs[] ModuleInput

FieldTypeDescription
keyString!

Name of the input.

Go name: "Key".

descriptionString!

Description of the input.

Go name: "Description".

defaultString

Default value.

If not set, will default to empty string.

Go name: "Default".

.outputs[] ModuleOutput

FieldTypeDescription
keyString!

Name of the output.

Go name: "Key".

descriptionString!

Description of the output.

Go name: "Description".

Scalars

Boolean

The Boolean scalar type represents true or false.

Int

The Int scalar type represents non-fractional signed whole numeric values. Int can represent values between -(2^31) and 2^31 - 1.

String

The String scalar type represents textual data, represented as UTF-8 character sequences. The String type is most often used to represent free-form human-readable text.