Files
jenkins_gitlab_cicd/pipline_script.jenkinsfile
2023-03-14 04:53:44 +00:00

58 lines
2.1 KiB
Plaintext

pipeline {
agent none
stages {
stage('Git Clone Task') {
agent { node { label 'junghun-cicd-podman' } }
steps {
git credentialsId: 'gitid',
url: 'https://gitlab.dev-cloudps.com/root/bookinfo.git',
branch: 'main'
}
post {
failure {
echo 'Fail!'
}
success {
echo 'Done!'
}
}
}
stage('Podman Build') {
agent { node { label 'junghun-cicd-podman' } }
steps {
container('podman') {
sh './build-services.sh ${BUILD_NUMBER} harbor.dev-cloudps.com/reviews/reviews'
sh 'podman login harbor.dev-cloudps.com -u admin -p admin'
sh 'podman push harbor.dev-cloudps.com/reviews/reviews:${BUILD_NUMBER}'
}
}
}
stage('Argo Upload') {
agent { node { label 'junghun-cicd-argo' } }
steps {
container('upload') {
sh '''
git config --global --add safe.directory /home/jenkins/argo/workspace/cicdtest
git config --global user.email "sa_8001@jhcloud.kr"
git config --global user.name "junghun_test"
git clone https://root:platformps@gitlab.dev-cloudps.com/root/appyaml.git
'''
dir('appyaml') {
sh 'ls -l'
sh 'pwd'
sh """
rm -rf app.yaml
cp app.yaml.template app.yaml
sed -i 's|{{URL}}|harbor.dev-cloudps.com/reviews/reviews:${BUILD_NUMBER}|' app.yaml
git add *
git status
git commit -m 'Images & Version Changed'
git push -u origin master
"""
}
}
}
}
}
}