Quick start

Quick Start Examples for CICD

Step 1. Create Jenkinsfile

  1. 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

  1. https://ci.spcconsole.com (OAuth with Github account)

    1. Create New Item
    2. Configure multipipeline

      1. Rename multibranch pipeline
        • ex) Jenkins > next > # spc-ci-example > - Build > Rename
      2. Configure GitHub repository
        • Jenkins > next > # spc-ci-example > - Build > Configure
      3. Scan Repository
        • After the above configuration, the multibranch job will scan for new branches automatically.
      4. Build Strategies
        • Jenkins > next > # spc-ci-example > - Build > Configure
    3. 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' ])
    4. 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: '' ] ]) `

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

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