Jenkins integration
Integrate Alpacon into Jenkins pipelines using the official Docker container.
Prerequisites
- Jenkins with Docker Pipeline plugin
- Alpacon workspace and API token
Quick start
1. Add credentials
In Manage Jenkins → Credentials, add:
- ALPACON_WORKSPACE_URL:
https://your-workspace.us1.alpacon.io(Secret text) - ALPACON_API_TOKEN: Your API token (Secret text)
2. Create pipeline
pipeline {
agent {
docker {
image 'alpacax/alpacon-cli:latest'
args '--entrypoint=""'
}
}
environment {
ALPACON_WORKSPACE_URL = credentials('ALPACON_WORKSPACE_URL')
ALPACON_API_TOKEN = credentials('ALPACON_API_TOKEN')
}
stages {
stage('Deploy') {
steps {
sh 'alpacon login $ALPACON_WORKSPACE_URL -t $ALPACON_API_TOKEN'
sh 'alpacon websh prod-server "cd /app && git pull && pm2 restart app"'
}
}
}
}
Important: args '--entrypoint=""' is required to override the container’s default entrypoint.
Usage examples
Execute remote commands
pipeline {
agent {
docker {
image 'alpacax/alpacon-cli:latest'
args '--entrypoint=""'
}
}
environment {
ALPACON_WORKSPACE_URL = credentials('ALPACON_WORKSPACE_URL')
ALPACON_API_TOKEN = credentials('ALPACON_API_TOKEN')
TARGET_SERVER = 'prod-server'
}
stages {
stage('Deploy') {
steps {
sh 'alpacon login $ALPACON_WORKSPACE_URL -t $ALPACON_API_TOKEN'
sh 'alpacon websh $TARGET_SERVER "echo Hello from Jenkins"'
sh 'alpacon websh $TARGET_SERVER "pwd"'
sh 'alpacon websh $TARGET_SERVER "whoami"'
}
}
}
}
Execute commands as root
pipeline {
agent {
docker {
image 'alpacax/alpacon-cli:latest'
args '--entrypoint=""'
}
}
environment {
ALPACON_WORKSPACE_URL = credentials('ALPACON_WORKSPACE_URL')
ALPACON_API_TOKEN = credentials('ALPACON_API_TOKEN')
}
stages {
stage('Deploy') {
steps {
sh 'alpacon login $ALPACON_WORKSPACE_URL -t $ALPACON_API_TOKEN'
sh 'alpacon websh -r prod-server "whoami"'
sh 'alpacon websh -r prod-server "docker ps"'
}
}
}
}
Troubleshooting
Entrypoint error
Symptom: Container doesn’t run the expected command
Solution: Make sure to include args '--entrypoint=""' in docker agent configuration.