From 9f0de3a97be7ac016b965a3f8bb9590bd0456e9a Mon Sep 17 00:00:00 2001 From: Cizz22 Date: Mon, 13 Jan 2025 14:06:13 +0700 Subject: [PATCH] test ci#3 --- Jenkinsfile | 27 +++++++++++++++++++++++++-- 1 file changed, 25 insertions(+), 2 deletions(-) diff --git a/Jenkinsfile b/Jenkinsfile index 8f94881..3fb7975 100644 --- a/Jenkinsfile +++ b/Jenkinsfile @@ -8,8 +8,15 @@ pipeline { DOCKER_CREDENTIALS = credentials('aimodocker') // Replace with your image name IMAGE_NAME = 'oh-service' + // Replace with your docker compose service name + SERVICE_NAME = 'oh-app' // Variable for Git commit hash GIT_COMMIT_HASH = '' + + // Replace with the SSH credentials for development server + // SSH_CREDENTIALS = credentials('backend-server-digitaltwin') + // SSH_CREDENTIALS_USR = 'aimo' + // SSH_SERVER_IP = '192.168.1.82' } stages { @@ -54,6 +61,22 @@ pipeline { """ } } + + // stage('Deploy') { + // steps { + // script { + // sshagent(credentials: [SSH_CREDENTIALS]) { + // sh """ + // ssh -o StrictHostKeyChecking=no ${SSH_CREDENTIALS_USR}@${SSH_SERVER_IP} ' + // cd ~/digital-twin/Docker + // sudo docker compose pull ${SERVICE_NAME} + // sudo docker compose up -d ${SERVICE_NAME} + // ' + // """ + // } + // } + // } + // } } post { @@ -75,10 +98,10 @@ pipeline { } } success { - echo "Successfully built and pushed Docker image with tags: latest and ${GIT_COMMIT_HASH}" + echo "Successfully built, pushed, and deployed Docker image with tags: latest and ${GIT_COMMIT_HASH}" } failure { - echo 'Failed to build/push Docker image!' + echo 'Failed to build/push/deploy Docker image!' } } } \ No newline at end of file