Quick start
Quick Start Examples for CICD
Step 1. Create Jenkinsfile
Add a Jenkinsfile to your branch
- ${WORKSPACE}/Jenkinsfile ```groovy @Library(‘spc-ci@v2’) _
def ctx = ci([ service: ‘spc-ci-example’, branch: ‘master’,
components: [ [ name: "spc-ci-example", type: "docker", source: "spc-ci-example:latest", ] ], build_closure: { echo 'spc-ci-example build' sh ''' make clean make docker-build ''' }, test_closure: { echo 'spc-ci-example test' sh '''make testci''' }, ansible: [ git_branch: 'master', playbook: 'platform.yml', tags: 'spc-ci-example', extras: '' ]]) ```
Step 2. Create Jenkins Job
https://ci.spcconsole.com (OAuth with Github account)
- Create New Item
- Copy from # spc-ci-example
Configure multipipeline
- Rename multibranch pipeline
- ex) Jenkins > next > # spc-ci-example > - Build > Rename

- ex) Jenkins > next > # spc-ci-example > - Build > Rename
- Configure GitHub repository
- Jenkins > next > # spc-ci-example > - Build > Configure

- Jenkins > next > # spc-ci-example > - Build > Configure
- Scan Repository
- After the above configuration, the multibranch job will scan for new branches automatically.

- After the above configuration, the multibranch job will scan for new branches automatically.
- Build Strategies
- Jenkins > next > # spc-ci-example > - Build > Configure

- Jenkins > next > # spc-ci-example > - Build > Configure
- Rename multibranch pipeline
Update pipeline for promote
- ex) Jenkins > next > # spc-ci-example > PROMOTE > STG promote to stg > configure > pipeline
groovy @Library('spc-ci@v2') _ ci.promote([ service: 'spc-ci-example', promote_to: 'stg' ])
- ex) Jenkins > next > # spc-ci-example > PROMOTE > STG promote to stg > configure > pipeline
Update pipeline for deployment
- ex) Jenkins > next > # spc-ci-example > DEPLOY eu-lab-central-1 > DEV deploy on eu-lab-central-1 > configure > pipeline
groovy @Library('spc-ci@v2') _ ci.deploy([ service: 'spc-ci-example', environment: 'dev', region: 'eu-lab-central-1', ansible: [ git_branch: 'v2', playbook: 'platform.yml', tags: 'spc-ci', extras: '' ] ])`
- ex) Jenkins > next > # spc-ci-example > DEPLOY eu-lab-central-1 > DEV deploy on eu-lab-central-1 > configure > pipeline
- Create New Item
Step 3. Build
- Whenever a code commit occurs, a build should be triggered.

Step 4. Promotion

Step 5. Deploy

- NOTE: Check ‘# spc-ci-example’ job
Step 6. Add WebHook URL
- Add a web-hook URL to your repository settings.
- It’s the trigger of CI.

Last modified November 20, 2020: Update grafana guilde (3f24643)