Example 14697

Shell Scripts

Embedded shell scripts as raw strings.

# 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: 57 # seconds
retry: 1
}

See also