https://yaboong.github.io/jenkins/2018/04/29/run-jenkins-on-aws-ec2/
* Jenkins 설정에 대한 정리
https://lng1982.tistory.com/132
* jenkins 권한 설정
node {
dw_news_shell = "sudo /home/ec2-user/dw-news/jenkins_run.sh "
stage('Naver'){
channel = "naver"
sh dw_news_shell + channel
}
stage('Daum'){
channel = "daum"
sh dw_news_shell + channel
}
stage('Google'){
channel = "google"
sh dw_news_shell + channel
}
stage('NOSP'){
channel = "nosp"
sh dw_news_shell + channel
}
}
https://dogbirdfoot.tistory.com/16
pipeline {
agent any
tools {nodejs "node-v8.15.1"}
environment {
// Slack configuration
SLACK_COLOR_DANGER = '#E01563'
SLACK_COLOR_INFO = '#6ECADC'
SLACK_COLOR_WARNING = '#FFC300'
SLACK_COLOR_GOOD = '#3EB991'
} // environment
stages {
stage('Install') {
steps {
echo 'Install'
wrap([$class: 'BuildUser']) {
slackSend (color: "${env.SLACK_COLOR_WARNING}",
channel: "#devops",
message: "*Deploy Started:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${env.BUILD_USER}\n More info at: ${env.BUILD_URL}")
}
sh "npm install && npm run bower_install"
}
}
stage('Compile') {
steps {
echo 'npm run build'
sh "npm run build"
sh "`aws ecr get-login --no-include-email`"
sh "docker build -t zeliter/front-web-user ."
sh "docker tag zeliter/front-web-user:latest 666251637146.dkr.ecr.ap-northeast-2.amazonaws.com/zeliter/front-web-user:latest"
sh "docker push 666251637146.dkr.ecr.ap-northeast-2.amazonaws.com/zeliter/front-web-user:latest"
}
}
stage('Test') {
steps {
echo 'Testing'
}
}
stage('Deploy') {
steps {
echo 'Deploying'
// sh "mvn dockerfile:push"
sh "aws ecs update-service --cluster zeliter-dev-composer --service zeliter-development --task-definition zeliter-dev --desired-count 1 --force-new-deployment"
}
}
}
post {
always {
echo 'This will always run'
}
success {
wrap([$class: 'BuildUser']) {
echo "${BUILD_USER}"
sh "git push origin HEAD:deploy/zeliter-dev-cluster"
sh 'printenv'
echo 'This will run only if successful'
slackSend (color: "${env.SLACK_COLOR_GOOD}",
channel: "#devops",
message: "*SUCCESS:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${BUILD_USER}\n More info at: ${env.BUILD_URL}")
}
}
failure {
echo 'This will run only if failed'
slackSend (color: "${env.SLACK_COLOR_GOOD}",
channel: "#devops",
message: "*Failure:* Job ${env.JOB_NAME} build ${env.BUILD_NUMBER} by ${env.BUILD_USER_ID}\n More info at: ${env.BUILD_URL}")
}
unstable {
echo 'This will run only if the run was marked as unstable'
}
changed {
echo 'This will run only if the state of the Pipeline has changed'
echo 'For example, if the Pipeline was previously failing but is now successful'
}
}
}
'AWS' 카테고리의 다른 글
AWS Lightsail (0) | 2019.08.22 |
---|---|
서비스 등록 (#시작서비스, #자동시작) (0) | 2019.06.24 |
AWS CLI : 로컬 폴더와 S3 폴더 동기화 (싱크, sync) (0) | 2019.06.12 |
Lambda 와 Aurora 연동 (0) | 2019.05.30 |
AWS Glue - Data lake 사례 (0) | 2019.05.20 |