DevOps/Docker, Jenkins, Ansible, Terraform

Jenkins- DevOps CI/CD

prden 2024. 4. 27. 21:20

1. React - Jenkins

- Jenkins 서버 , 배포 서버 구분 

https://roomq.tistory.com/m/29

 

[CI&CD] EC2, Docker, Jenkins, React 프로젝트 CI/CD 구축

현재 진행 중인 구름톤 풀스택 과정에서 팀 프로젝트의 CI/CD를 구축해 보았습니다. CI/CD 구축은 처음 해봐서 구글링을 통해 다양한 구축법을 조사한 결과 오성원님의 블로그를 중심으로 추가/변

roomq.tistory.com

 

2. Jenkins Pipeline (DSL)

pipeline {
    agent any
    tools {
        maven 'maven3.8.2'
    }
    stages {
        stage('github clone') {
            steps {
                git 'https://github.com/joneconsulting/one-apigate.git'
            }
        }
        stage('build') {
            steps {
                sh '''
                    echo build start
                    mvn clean compile package -DskipTests=true
                '''
                
     //         sh 'mvn clean compile package -DskipTests=true'
            }
        }
        stage('deploy') {
            steps {
              deploy adapters: [tomcat9(credentialsId: 'deployer_user', path: '', url: 'http://192.168.0.8:8080/')], contextPath: null, war: '**/*.war'
            }
        }
        stage('ssh publisher') {
            steps {
               sshPublisher(publishers: [sshPublisherDesc(configName: 'aws-docker-server', transfers: [sshTransfer(cleanRemote: false, excludes: '', execCommand: 'docker build -t edowon0623/devops_exam1 -f Dockerfile .', execTimeout: 120000, flatten: false, makeEmptyDirs: false, noDefaultExcludes: false, patternSeparator: '[, ]+', remoteDirectory: '.', remoteDirectorySDF: false, removePrefix: 'target', sourceFiles: 'target/devops_demo-0.1.war')], usePromotionTimestamp: false, useWorkspaceInPromotion: false, verbose: false)])
            }
        }
    }
}

 

DSL은 외우는 게 아니고 Jenkins에서 변환하는 프로그램을 이용하면 된다. 

3. Jenkins - SonarQube 연동

소스코드 Convention

~

 

<참고>

 

GitHub - joneconsulting/cicd-web-project: Hello World project for CI/CD demo

Hello World project for CI/CD demo. Contribute to joneconsulting/cicd-web-project development by creating an account on GitHub.

github.com

 

GitHub - joneconsulting/jenkins_pipeline_script

Contribute to joneconsulting/jenkins_pipeline_script development by creating an account on GitHub.

github.com

 

GitHub - joneconsulting/jenkins_cicd_script

Contribute to joneconsulting/jenkins_cicd_script development by creating an account on GitHub.

github.com