Skip to content

Latest commit

 

History

History

examples

Examples

The following are a list of examples. This list is autogenerated using togomak --disable-concurrency at togomak.

Dynamic ANSI colors

ANSI colors are provided as functions and variables which can be used to created colored terminal output platform agnostically.

Example

Stage Conditions

Make stage run conditionally based on if argument.

Example

Demo of Togomak v1 Features

Includes the most used features of togomak v1, previously on togomak v1 README.md

Example

Customizing Docker Entrypoint

This example provides a custom entrypoint for the docker container when natively calling them.

Example

Using Docker

Run scripts in docker containers natively, from togomak. This example deals with mounting volumes and using the ubuntu:latest docker container.

Example

Environment Variables

Derive environment variables from the host environment, and also pass them to stages using the env {} sub block.

Example

Simple Stage

Uses stage args argument to perform a simple ls -al

Example

Using for_each

This example uses a for_each on a stage using a map. Each item in the map specified as the argument to for_each will be iterated over and assigned each.key and each.value.

Example

Using for_each on a module

This is essentially the same example as for_each, but using this on module on a nested set array. In addition, this module also uses a remote github repository source for its module.

Example

Function

Demonstrates the use of default functions and string interpolation in stage scripts. This example deals with the env() helper function.

Example

Git

Uses the data.git provider to clone a git repository and read contents of specific files to memory.

Example

Git Tags

same example as git but retrieves file from a specific tag.

Example

Stage hooks

Runs a stage before or after the execution of a stage using pre_hook and post_hook. post_hook will run regardless of the stage execution statuses, which can be useful to check if a step failed or not.

Example

Imports

This example imports a subfolder and a remote repository togomak pipeline code and merges the caller pipeline with its contents to create a flattened pipeline.

Example

Lifecycles

Uses Togomak lifecycles to classify stages using phases. Consider reading Lifecycle Usage for a detailed explanation.

Example

Local Blocks

Uses a simple local block in a stage.

Example

Macros

Note Consider using module instead.

Invokes a stage with parameters as a macro, which can be reused, imported or customized with parameters.

Example

Using Modules with variable inputs

This example loads a local module from a subfolder and passed it local.* values as inputs. This example is a module which does addition.

Example

Simple Module

A simple module from a local directory.

Example

Pre and Post steps

Runs a step at the beginning, or the end of the pipeline, before and after all the stages, modules complete.

Example

Prompt

Deprecated, use variable {} instead. Prompt data provider requests information from the user before the pipeline starts. This, however is done directly by the variable {} block, accessible through the var.<name> attribute.

Example

Using macros

This example has a recursive, nested macro invocation.

Example

Terraform

Example on using Terraform data source blocks, using the hashicorp/random provider to create a random_pet name, and use them directly in your togomak pipeline, illustrating similar use cases where pipelines need to run against IP addresses of Terraform provisioned resources.

Example