pin - pipeline with Docker Golang API.
This guide helps you diagnose and resolve common issues when using Pin.
Problem: Job configuration is missing both image and dockerfile fields.
# ❌ Incorrect
job:
script:
- echo "hello"
Solution: Specify either an image or dockerfile:
# ✅ Correct - Using image
job:
image: alpine:latest
script:
- echo "hello"
# ✅ Correct - Using dockerfile
job:
dockerfile: "./Dockerfile"
script:
- echo "hello"
Problem: Invalid port format in configuration.
# ❌ Incorrect
port: "invalid:port:format:here"
Solution: Use valid port formats:
# ✅ Correct formats
port:
- "8080:80" # hostPort:containerPort
- "127.0.0.1:8080:80" # hostIP:hostPort:containerPort
- "192.168.1.100:8080:80" # specificIP:hostPort:containerPort
Problem: Pin cannot connect to Docker daemon.
Diagnostic Steps:
# Check if Docker is running
docker ps
# Check Docker daemon status
systemctl status docker # Linux
brew services list | grep docker # macOS
# Check Docker socket permissions
ls -la /var/run/docker.sock
Solutions:
sudo systemctl start docker
open -a Docker
2. **Fix permissions** (Linux):
```bash
sudo usermod -aG docker $USER
# Log out and back in
docker:
host: "tcp://localhost:2375" # For Docker Desktop
Problem: User doesn’t have permission to access Docker.
Solution:
# Add user to docker group (Linux)
sudo usermod -aG docker $USER
newgrp docker
# Or run with sudo (not recommended for regular use)
sudo pin apply -f pipeline.yaml
Problem: Script commands failed inside container.
Diagnostic Steps:
logsWithTime: true
script:
soloExecution: true script:
script:
- echo "Starting npm install..."
- npm install
- echo "npm install completed"
- echo "Starting tests..."
- npm test
Problem: File not found in container.
Diagnostic Steps:
# Enable file copying
copyFiles: true
script:
- ls -la
- pwd
- find . -name "package.json"
copyIgnore:
- "node_modules" # Don't accidentally ignore needed files
- ".git"
Problem: Port is occupied by another process.
Diagnostic Steps:
# Check what's using the port
lsof -i :8080
netstat -tulpn | grep 8080
# Kill process using port
kill -9 <PID>
Solutions:
port:
- "8081:8080" # Use 8081 instead of 8080
port:
- "127.0.0.1:8080:8080"
Problem: Service not accessible on specified port.
Diagnostic Steps:
script:
- sleep 5 # Wait for service to start
- curl -v http://localhost:8080/health
# Make sure service binds to 0.0.0.0, not just 127.0.0.1
script:
- node server.js --host=0.0.0.0 --port=8080
Problem: Container user doesn’t have permission to access files.
Solutions:
FROM node:18-alpine
# Some images run as non-root by default
USER root # If needed
script:
- chmod +x ./scripts/deploy.sh
- ./scripts/deploy.sh
Problem: Environment variables not properly set.
Diagnostic Steps:
script:
- env | sort
- echo "MY_VAR value: $MY_VAR"
env:
env: MY_VAR: value # Wrong format
### Conditional Execution Issues
#### Error: "condition evaluation failed"
**Problem**: Invalid condition syntax.
**Solutions**:
1. **Check condition syntax**:
```yaml
# ✅ Correct
condition: $BRANCH == "main"
condition: $BRANCH == "main" && $DEPLOY == "true"
condition: $VAR != "test"
# ❌ Incorrect
condition: BRANCH == "main" # Missing $
condition: $BRANCH = "main" # Single = instead of ==
script:
- echo "BRANCH value: $BRANCH"
- echo "DEPLOY value: $DEPLOY"
Problem: Invalid retry parameters.
Solutions:
# ✅ Correct retry configuration
retry:
attempts: 3 # 1-10
delay: 5 # 0-300 seconds
backoff: 2.0 # 0.1-10.0
# ❌ Invalid configurations
retry:
attempts: 15 # Too many attempts (max 10)
delay: 500 # Too long delay (max 300)
backoff: 0.05 # Too low backoff (min 0.1)
Problem: Jobs marked as parallel but not executing in parallel.
Solution:
# ✅ Correct parallel configuration
workflow:
- job1
- job2 # Both will run in parallel
job1:
image: alpine:latest
parallel: true
script:
- echo "Job 1 running"
job2:
image: alpine:latest
parallel: true
script:
- echo "Job 2 running"
# Add to your pipeline configuration
logsWithTime: true
# Use in scripts for debugging
script:
- set -x # Enable bash debug mode
- echo "Debug: Starting command"
- your-command
- echo "Debug: Command completed"
# Debug job to inspect container environment
debug:
image: alpine:latest
copyFiles: true
script:
- echo "=== System Information ==="
- uname -a
- echo "=== Environment Variables ==="
- env | sort
- echo "=== File System ==="
- ls -la
- df -h
- echo "=== Network ==="
- ip addr show || ifconfig
- echo "=== Processes ==="
- ps aux
# Network connectivity debug job
network-debug:
image: alpine:latest
script:
- apk add --no-cache curl netcat-openbsd
- echo "=== Testing DNS ==="
- nslookup google.com
- echo "=== Testing HTTP ==="
- curl -v http://google.com
- echo "=== Testing Port Connectivity ==="
- nc -zv google.com 80
Diagnostic Steps:
script:
- echo "Image pull completed at $(date)"
# Use specific, smaller images
image: node:18-alpine # Instead of node:latest
image: golang:1.21-alpine # Instead of golang:latest
copyFiles: true
copyIgnore:
- "node_modules"
- ".git"
- "*.log"
- "coverage"
Diagnostic Steps:
script:
- echo "=== Memory Usage ==="
- free -h
- echo "=== Disk Usage ==="
- df -h
Solutions:
image: alpine:latest # ~5MB
# Instead of ubuntu:latest (~70MB)
script:
- npm install
- npm run build
- rm -rf node_modules # Clean up after build
When reporting issues, include:
pin --version
# Your pipeline.yaml content
pin apply -f pipeline.yaml 2>&1 | tee debug.log
uname -a
docker –version
docker system df
### Common Log Patterns
Look for these patterns in logs:
- `validation error`: Configuration issues
- `connection refused`: Network/port problems
- `permission denied`: File/Docker permissions
- `no such file`: Missing files or incorrect paths
- `exit status 1`: Script command failures
### Enable Debug Mode
```bash
# Run with maximum verbosity
pin apply -f pipeline.yaml --verbose
# Or set environment variable
DEBUG=* pin apply -f pipeline.yaml
This troubleshooting guide covers the most common issues users encounter with Pin. For additional help, check the GitHub Issues page or create a new issue with detailed information about your problem.