Creating and publishing a module
Creating a module is quite easy:
- 
Create a git repository on a public git hosting service. For this guide, let's create it on github:

 - 
Clone that repository.
git clone git@github.com:deepsquare-io/workflow-module-example.git - 
At the root of the repository, create a
module.yamland fill it with your group of steps.name: 'Hello World'
description: 'An example of module'
inputs:
- key: WHO
description: 'Who to greet'
default: 'World'
outputs:
- key: RESULT
despcription: 'Resulting string'
minimumResources:
tasks: 1
cpusPerTask: 1
memPerCpu: 100
gpus: 0
steps:
- name: 'Say hello World'
run:
container:
registry: registry-1.docker.io
image: library/busybox:latest
command: |
echo "Running with {{ .Job.Resources.MemPerCPU }}M of memory"
echo "Hello ${WHO}"
echo "RESULT=Hello ${WHO}" >> ${DEEPSQUARE_ENV}You must describe:
- The 
nameof the module. - A module 
description. - The 
minimumResourceswhich are the minimum requirements for your module to work as expected. - The 
stepswhich is the main body of the module. 
Optionally, you can describe:
- expected 
inputswhich the user of the module can use by adding a value to theargsfield of the StepUse. - expected 
outputs, which can be exported if the user of the module specify theexportEnvAsfield of the StepUse. 
Notice that the
module.yamlgoes through a Go template engine before being used. This means you can access to context variables likeJoborStep. This can help you design your module according based on the job or step specifications. - The 
 - 
Commit and push.
user@~/workflow-module-examplegit add module.yaml
git commit -m "added module.yaml"
git push -u origin main - 
Add tags to your module.
user@~/workflow-module-examplegit tag -m "v1" v1
git push origin v1
git tag -m "v1.0.0" v1.0.0
git push origin v1.0.0 
That's it! Now users can use your module by either specifying:
github.com/deepsquare-io/workflow-module-example@v1github.com/deepsquare-io/workflow-module-example@v1.0.0github.com/deepsquare-io/workflow-module-example@<commit-sha>, the commit SHA can be shorten to 7 characters.