AWS EC2 에 Jenkins 서버 구축하기
https://yaboong.github.io/jenkins/2018/04/29/run-jenkins-on-aws-ec2/
AWS EC2 에 Jenkins 서버 구축하기
개요 Jenkins 서버를 AWS EC2 에 구축하는 방법을 알아본다.
yaboong.github.io
* Jenkins 설정에 대한 정리
https://lng1982.tistory.com/132
Jenkins 설정에 대한 정리
차기 프로젝트에서는 CI 툴을 사용하고자 Jenkins 사용법에 대해서 알아봤다. 빌드 방법은 maven을 이용해 war 생성 후 tomcat manager를 통해 war를 업로드 하는 식이다. 1. 먼저 Jenkins를 설치한 후 웹 사이트..
lng1982.tistory.com
* jenkins 권한 설정
[Jenkins] shell 명령어에서 sudo를 사용하기 위한 설정
젠킨스에서 빌드 진행 시 관리자 권한으로 실행이 필요한 경우가 있다. ex) sudo build_script.sh jenkins에 별다른 권한을 주지 않았다면 무조건 빌드 에러가 발생한다. ㅠㅠ 아래와 같이 관리자 권한을 주도록..
noota.tistory.com
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
Slack을 활용한 Jenkins 알림 받기
대다수의 개발자들이 테스트, 빌드, 배포를 위해 Jenkins를 사용하고있습니다. Jenkins에 Slack을 연동하면 더욱 노예가 될 수 업무와 가까워질수 있죠! 할리우드 명품배우도 인정 이번 포스팅에선 Jenkins와 Sla..
dogbirdfoot.tistory.com
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'
}
}
}