Sobes.tech
Junior

At what stage does the continuous integration process conclude?

sobes.tech AI

Answer from AI

Continuous Integration (CI) concludes after a successful build and testing of a new artifact or installation package. This artifact is ready to move to the next stage, which is usually continuous delivery or deployment.

Main stages of CI:

  1. Code commit: Developers regularly commit their changes to a shared repository.
  2. Build: The project is automatically built (compilation, packaging, etc.).
  3. Testing: Automated tests are run (unit, integration, etc.).

If all tests pass:

  • Artifact generation: A deployable artifact is created.
  • CI completion: The CI process is considered complete for this commit.

If tests fail:

  • The process is interrupted.
  • The team is notified of the failure.

Example steps in a CI pipeline:

# Example Jenkinsfile (Pipeline script)
pipeline {
    agent any
    stages {
        stage('Checkout') {
            steps {
                # Get code from repository
                checkout scm
            }
        }
        stage('Build') {
            steps {
                # Run build command (e.g., Maven, Gradle, npm)
                sh 'mvn clean package'
            }
        }
        stage('Test') {
            steps {
                # Run tests
                sh 'mvn test'
            }
        }
        stage('Artifact') {
            steps {
                # Archive artifact
                archiveArtifacts artifacts: 'target/*.jar', fingerprint: true
            }
        }
    }
}

Thus, CI focuses on automating the build and testing of each change, ensuring that new code integrates without issues. The subsequent stages (CD) are responsible for delivering/deploying this artifact.