Microservice/Fatservice

Use Case: High Code Versioning with Versioning Tools API

Context

In a high-code development environment, managing versioning manually can be cumbersome and error-prone. Automating version management can greatly improve efficiency and consistency. This use case illustrates how a developer can use the Versioning Tools API to automate versioning locally, ensuring that each new build or release has a properly managed semantic version.

Scenario

A developer is working on a feature branch for a high-code application. After completing the feature, the developer needs to:

  1. Retrieve the next semantic version from the Versioning Tools API.

  2. Tag the local Git repository with this new version.

  3. Push the new tag to the remote repository.

Step-by-Step Guide

1. Retrieve the Next Version Identifier

The developer will first need to get the next semantic version for their service. This can be done using the Versioning Tools API.

Command:

curl -X 'POST' \
  'https://api.versioning.tools/v1/SemVer/myServiceId?apiKey=YOUR_API_KEY' \
  -H 'accept: */*'

Explanation:

  • myServiceId: Replace with your actual service ID.

  • YOUR_API_KEY: Replace with your API key.

Response:

{
  "version": "1.2.0"
}

The response provides the next semantic version, which in this case is 1.2.0.

2. Tag the Local Git Repository

With the new version obtained, the developer can now tag the local repository.

Command:

git tag v1.2.0 -m "Release version 1.2.0"

Explanation:

  • v1.2.0: The version received from the API.

  • -m "Release version 1.2.0": A message describing the tag.

3. Push the Tag to the Remote Repository

Finally, the developer needs to push the new tag to the remote repository to make it available to the team and other environments.

Command:

git push origin v1.2.0

Explanation:

  • origin: The name of the remote repository.

  • v1.2.0: The tag being pushed.

Example Workflow

Here’s an example workflow that a developer might follow:

  1. Complete Feature Development:

    • Finish coding and ensure all tests pass.

  2. Retrieve Next Version:

    NEXT_VERSION=$(curl -X 'POST' \
      'https://api.versioning.tools/v1/SemVer/myServiceId?apiKey=YOUR_API_KEY' \
      -H 'accept: */*')
  3. Tag the Repository:

    git tag "v$NEXT_VERSION" -m "Release version $NEXT_VERSION"
  4. Push the Tag:

    git push origin "v$NEXT_VERSION"
  5. Document Changes:

    • Update any relevant documentation or release notes with the new version information.


Last updated