diff --git a/deploy-this/create-common-volume.jenkinsfile b/deploy-this/create-common-volume.jenkinsfile new file mode 100644 index 0000000..c8bb226 --- /dev/null +++ b/deploy-this/create-common-volume.jenkinsfile @@ -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 + """ + } + } + } + } +}