fix(ci): require docker-capable Jenkins agent with preflight checks
This commit is contained in:
23
Jenkinsfile
vendored
23
Jenkinsfile
vendored
@@ -1,5 +1,7 @@
|
|||||||
pipeline {
|
pipeline {
|
||||||
agent any
|
// Build + deploy stages require Docker CLI/daemon access on the Jenkins node.
|
||||||
|
// Ensure this label maps to an agent with Docker installed and usable.
|
||||||
|
agent { label 'docker' }
|
||||||
|
|
||||||
environment {
|
environment {
|
||||||
REGISTRY_IMAGE = "plesk-agency-portal"
|
REGISTRY_IMAGE = "plesk-agency-portal"
|
||||||
@@ -8,6 +10,25 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
|
stage('Preflight') {
|
||||||
|
steps {
|
||||||
|
sh '''
|
||||||
|
set -euo pipefail
|
||||||
|
|
||||||
|
if ! command -v docker >/dev/null 2>&1; then
|
||||||
|
echo "Docker CLI is not available on this Jenkins agent."
|
||||||
|
echo "Run this pipeline on a Docker-capable node (label: docker) or install Docker on the current agent."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if ! docker version >/dev/null 2>&1; then
|
||||||
|
echo "Docker is installed but not usable by Jenkins (daemon/socket/permissions issue)."
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
stage('Checkout') {
|
stage('Checkout') {
|
||||||
steps {
|
steps {
|
||||||
checkout scm
|
checkout scm
|
||||||
|
|||||||
@@ -109,6 +109,14 @@ Configure these values in Jenkins job/folder/global environment or credentials-b
|
|||||||
|
|
||||||
The pipeline assumes Jenkins credentials are managed outside this repository.
|
The pipeline assumes Jenkins credentials are managed outside this repository.
|
||||||
|
|
||||||
|
Jenkins runtime requirements:
|
||||||
|
|
||||||
|
- The pipeline must run on a Jenkins agent with the `docker` label.
|
||||||
|
- That agent must have Docker CLI installed and permission to access Docker daemon/socket.
|
||||||
|
- `rsync` and `ssh` must also be available on the Jenkins agent.
|
||||||
|
|
||||||
|
If Docker is missing or inaccessible, the pipeline now fails early in a dedicated preflight stage with an explicit message.
|
||||||
|
|
||||||
## Deploy flow
|
## Deploy flow
|
||||||
|
|
||||||
Deployment is intentionally simple and bash-based:
|
Deployment is intentionally simple and bash-based:
|
||||||
|
|||||||
Reference in New Issue
Block a user