modification in jenkins
This commit is contained in:
parent
7058509e00
commit
a2c01e70c7
18
Jenkinsfile
vendored
18
Jenkinsfile
vendored
@ -11,19 +11,20 @@ pipeline {
|
|||||||
}
|
}
|
||||||
|
|
||||||
stages {
|
stages {
|
||||||
// stage('Checkout') {
|
stage('Checkout and Install Dependencies on Remote Server') {
|
||||||
// steps {
|
|
||||||
// git branch: 'main', url: 'https://git.tech4biz.wiki/jassim/cicid.git'
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
stage('Checkout and Install Dependencies on Remote Server') {
|
|
||||||
steps {
|
steps {
|
||||||
script {
|
script {
|
||||||
sshagent(credentials: [SSH_CREDENTIALS]) {
|
sshagent(credentials: [SSH_CREDENTIALS]) {
|
||||||
sh '''
|
sh '''
|
||||||
ssh ${REMOTE_SERVER} << EOF
|
ssh ${REMOTE_SERVER} << EOF
|
||||||
|
# Navigate to the workspace or create it if it doesn't exist
|
||||||
|
mkdir -p ${REMOTE_WORKSPACE}
|
||||||
cd ${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
|
git checkout main
|
||||||
yarn install
|
yarn install
|
||||||
EOF
|
EOF
|
||||||
@ -57,8 +58,9 @@ pipeline {
|
|||||||
sshagent(credentials: [SSH_CREDENTIALS]) {
|
sshagent(credentials: [SSH_CREDENTIALS]) {
|
||||||
sh '''
|
sh '''
|
||||||
ssh ${REMOTE_SERVER} << EOF
|
ssh ${REMOTE_SERVER} << EOF
|
||||||
|
cd ${REMOTE_WORKSPACE}/cicid
|
||||||
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
|
docker pull ${DOCKER_IMAGE}:${DOCKER_TAG}
|
||||||
docker documentation-container || true
|
docker stop documentation-container || true
|
||||||
docker rm documentation-container || true
|
docker rm documentation-container || true
|
||||||
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}
|
docker run -d -p 3000:3000 --name documentation-container ${DOCKER_IMAGE}:${DOCKER_TAG}
|
||||||
EOF
|
EOF
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user