From b1e3b38958420dbec86795502a6d0a1f94fd8b18 Mon Sep 17 00:00:00 2001 From: Artur Date: Thu, 19 Dec 2024 23:58:32 +0100 Subject: [PATCH] =?UTF-8?q?Skrypt=20Tworz=C4=85cy=20wolumen=20apps-data=20?= =?UTF-8?q?je=C5=9Bli=20nie=20ma?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- deploy-this/create-common-volume.jenkinsfile | 25 ++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 deploy-this/create-common-volume.jenkinsfile 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 + """ + } + } + } + } +}