Skrypt Tworzący wolumen apps-data jeśli nie ma
This commit is contained in:
parent
a2c1237d85
commit
b1e3b38958
|
|
@ -0,0 +1,25 @@
|
||||||
|
pipeline {
|
||||||
|
agent any
|
||||||
|
|
||||||
|
environment {
|
||||||
|
VOLUME_NAME = 'apps-data' // Nazwa woluminu Dockera
|
||||||
|
}
|
||||||
|
|
||||||
|
stages {
|
||||||
|
stage('Create Docker Volume') {
|
||||||
|
steps {
|
||||||
|
script {
|
||||||
|
// Sprawdzenie i tworzenie woluminu w jednym kroku
|
||||||
|
sh """
|
||||||
|
if ! docker volume ls --filter name=${VOLUME_NAME} --format '{{.Name}}' | grep -qw ${VOLUME_NAME}; then
|
||||||
|
docker volume create ${VOLUME_NAME}
|
||||||
|
echo "Volume '${VOLUME_NAME}' created successfully."
|
||||||
|
else
|
||||||
|
echo "Volume '${VOLUME_NAME}' already exists."
|
||||||
|
fi
|
||||||
|
"""
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue