added deploy frontend script
All checks were successful
SimcoDash/simcompanies-dashboard/pipeline/head This commit looks good
All checks were successful
SimcoDash/simcompanies-dashboard/pipeline/head This commit looks good
This commit is contained in:
8
Jenkinsfile
vendored
8
Jenkinsfile
vendored
@@ -25,11 +25,11 @@ pipeline {
|
||||
}
|
||||
}
|
||||
stage('Deploy Frontend') {
|
||||
environment {
|
||||
AN_ACCESS_KEY = credentials('3885a64d-7d43-42c2-a713-c8600b44842f')
|
||||
}
|
||||
steps {
|
||||
sh 'sudo bash ./jenkins/deployFrontend.sh'
|
||||
script{
|
||||
def SCRIPT_OUTPUT2 = sh (script: 'sudo bash ./jenkins/deployFrontend.sh ${BRANCH_NAME}',returnStdout: true)
|
||||
echo "Script Output: ${SCRIPT_OUTPUT2}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
|
||||
cd ./frontend
|
||||
|
||||
if test "$1" = "master"
|
||||
if test "$1" = "edit-jenkinsfile"
|
||||
then
|
||||
echo 'Install neccessary Packages'
|
||||
yarn install
|
||||
|
||||
@@ -8,6 +8,8 @@ then
|
||||
ssh -i /etc/ssh/simco_key simco-jenkins@gitea.oliver.boehlk.io "rm -r ~/simco-dashboard/backend"
|
||||
echo 'Copy backend to OlberryPi'
|
||||
scp -i /etc/ssh/simco_key -r backend simco-jenkins@gitea.oliver.boehlk.io:~/simco-dashboard
|
||||
echo 'Yarn install packages'
|
||||
ssh -i /etc/ssh/simco_key simco-jenkins@gitea.oliver.boehlk.io "cd ~/simco-dashboard/backend && yarn install"
|
||||
else
|
||||
echo "Skipping for non-master branch"
|
||||
fi
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
#!/usr/bin/env sh
|
||||
|
||||
if test "$1" = "edit-jenkinsfile"
|
||||
then
|
||||
echo 'Remove old frontend folder'
|
||||
ssh -i /etc/ssh/simco_key simco-jenkins@gitea.oliver.boehlk.io "rm -r ~/simco-dashboard/backend/frontend"
|
||||
echo 'Copy frontend build to OlberryPi'
|
||||
scp -i /etc/ssh/simco_key -r frontend/build simco-jenkins@gitea.oliver.boehlk.io:~/simco-dashboard/backend
|
||||
echo 'Rename build folder to frontend'
|
||||
ssh -i /etc/ssh/simco_key simco-jenkins@gitea.oliver.boehlk.io "mv ~/simco-dashboard/backend/build ~/simco-dashboard/backend/frontend"
|
||||
echo "Start node server"
|
||||
ssh -i /etc/ssh/simco_key simco-jenkins@gitea.oliver.boehlk.io "cd ~/simco-dashboard/backend && yarn run start" &
|
||||
else
|
||||
echo "Skipping for non-master branch"
|
||||
fi
|
||||
|
||||
Reference in New Issue
Block a user