WEBBOOK CHAPTER

CI/CD, 서버실에서 클라우드까지: 5장. Pipeline as Code를 단일 진실원으로 만든다

5장. Pipeline as Code를 단일 진실원으로 만든다

Jenkins 공식 문서는 Jenkinsfile을 source control에 두면 review, audit trail, single source of truth를 얻는다고 설명한다. Pipeline as Code를 기준으로 UI에만 있는 shell script를 줄인다. UI에는 credential reference, agent policy 같은 운영 설정이 남을 수 있으므로 configuration backup과 ownership을 별도로 둔다.


pipeline {
  agent any
  stages {
    stage('Verify') { steps { sh 'npm test' } }
    stage('Build')  { steps { sh 'npm run build' } }
  }
}

pipeline code도 코드다. syntax lint, fixture 실행, code review, versioned shared library와 rollback이 필요하다. 한 파일에 모든 서비스를 위한 조건문을 쌓지 않는다. 공통 policy와 서비스별 명령의 경계를 정한다.