Skip to content

785 - Shell Scripts

Embedded shell scripts as raw strings. This is an example of a MAML document.

maml
# Automation scripts
{
  name: "migrate"
  shell: "/bin/bash"
  # Initial setup script
  setup: """
#!/bin/bash
set -euo pipefail

echo "Setting up environment..."
npm install
npm run build
echo "Done!"
"""

  # Deployment script
  deploy: """
#!/bin/bash
set -euo pipefail

VERSION=$(git describe --tags)
echo "Deploying $VERSION"

docker build -t app:$VERSION .
docker push app:$VERSION
kubectl set image deployment/app app=app:$VERSION

echo "Deployed $VERSION successfully"
"""

  timeout: 71 # seconds
  retry: 4
}

See Also