CI/CD Use Case

CI/CD Use Case

Overview

This documentation provides a step-by-step guide on how to integrate versioning into a CI/CD pipeline using a versioning API. By versioning the build scripts themselves, we ensure that each build highlights the current version of the build script. Users can manually increase the version in the web console, and the versioning API will display the current version during the build process.

API Endpoints

  • Get Version: [GET] api.versioning.tools/semver/{serviceId}?apiKey={apiKey}

Use Case

Scenario

Consider a CI/CD pipeline where build scripts (e.g., YAML files) are frequently updated. We want to integrate a feature that fetches and displays the current version of the build script during each build. Users can manually increase the version via a web console. This ensures that the build process highlights the version of the build script in use.

Components

  1. CI/CD Pipeline Integration:

    1. The pipeline fetches and displays the current version of the build script during the build process.

    2. Post build TBA

  2. Manual Version Management: Users can manually update the version of the build script via the versioning console.

Implementation

1. CI/CD Pipeline Integration

Fetch and Display Version

Add a step in the build script to fetch the current version from the versioning API and display it during the build process.

# Example YAML build script for a CI/CD pipeline

stages:
  - build

build:
  stage: build
  script:
    - echo "Fetching current version of the build script..."
    - >
      VERSION=$(curl -s https://api.versioning.tools/semver/your_cicd_service_id?apiKey=your_api_key)
    - echo "Current Build Script Version: $VERSION"
    - # Additional build steps here

2. Manual Version Management

Managers or developers can manually update the version of the build script through the versioning console:

  • URL: https://console.versioning.tools

  • Steps:

    1. Log in to the console.

    2. Select the appropriate service (your CI/CD pipeline's name).

    3. Increase the version number based on changes to the build scripts.

Last updated