modification in jenkins

This commit is contained in:
Jazze7 2024-11-05 16:45:38 +05:30
parent 7058509e00
commit a2c01e70c7

18
Jenkinsfile vendored
View File

@ -11,19 +11,20 @@ pipeline {
}
stages {
// stage('Checkout') {
// steps {
// git branch: 'main', url: 'https://git.tech4biz.wiki/jassim/cicid.git'
// }
// }
stage('Checkout and Install Dependencies on Remote Server') {
stage('Checkout and Install Dependencies on Remote Server') {
steps {
script {
sshagent(credentials: [SSH_CREDENTIALS]) {
sh '''
ssh ${REMOTE_SERVER} << EOF
# Navigate to the workspace or create it if it doesn't exist
mkdir -p ${REMOTE_WORKSPACE}
cd ${REMOTE_WORKSPACE}
git clone https://git.tech4biz.wiki/jassim/cicid.git .
# Clone the repository if it does not exist
if [ ! -d "cicid" ]; then
git clone https://git.tech4biz.wiki/jassim/cicid.git
fi
cd cicid
git checkout main
yarn install
EOF
@ -57,8 +58,9 @@ pipeline {
sshagent(credentials: [SSH_CREDENTIALS]) {
sh '''
ssh ${REMOTE_SERVER} << EOF
cd ${REMOTE_WORKSPACE}/cicid
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
docker documentation-container || true
docker stop documentation-container || true
docker rm documentation-container || true
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}
EOF