Skip to content

Fix & Refactor the Release and Docker publishing pipeline#423

Merged
arm4b merged 2 commits intomainfrom
feature/release-ci
Apr 10, 2023
Merged

Fix & Refactor the Release and Docker publishing pipeline#423
arm4b merged 2 commits intomainfrom
feature/release-ci

Conversation

@arm4b
Copy link
Copy Markdown
Contributor

@arm4b arm4b commented Apr 8, 2023

Closes #293, and also fixes the Release pipelines for Docker images so we don't need to run it manually including the version in the workflow dispatch.

Instead of that, the version is taken from the release/tag automatically.
With that, the release pipeline takes care of proper Docker image building and publishing when release manager creates a versioned release on Github.

image

Docker build rules

The BitOps docker image versioning is described in the https://bitops.sh/versioning/#images and it works as before. Logically NO changes to these rules were introduced.

To repeat:

  • Development
    • PR build: (now added)
      • build the base and omnibus images for testing purposes (no push)
    • main branch:
      • build base image and push it with dev-base docker tag
      • build omnibus image (based on dev-base) and push it with dev docker tag
      • build predefined images just to check if there are no errors
  • Release (now fully automated)
    • v1.2.3
      • Build and push the base image and tag it as: 1.2.3-base, base
      • Build and push the omnibus image (based on 1.2.3-base) and tag it as: omnibus-1.2.3, 1.2.3, latest
      • Build predefined images and tag as aws-ansible-1.2.3, aws-helm-1.2.3, aws-terraform-1.2.3

The release pipelines were tested in my fork of BitOps https://github.com/armab/bitops/commits/main and Docker Hub.

@arm4b arm4b added bug 🪲 Something isn't working enhancement ✨ New feature or request CI/CD refactor labels Apr 8, 2023
@runforesight
Copy link
Copy Markdown

runforesight bot commented Apr 8, 2023

Foresight Summary

Image Image Image Image 
Major Impacts
Foresight hasn't detected any major impact on your workflows and tests.

View More Details

✅  CI workflow has finished in 3 minutes 11 seconds and finished at 8th Apr, 2023.


Job Failed Steps Tests
lint-black -     🔗  N/A See Details
tests-unit -     🔗  N/A See Details
lint-pylint -     🔗  N/A See Details
build-base-image -     🔗  N/A See Details
build-prebuilt-images (aws-ansible) -     🔗  N/A See Details
build-prebuilt-images (aws-helm) -     🔗  N/A See Details
build-prebuilt-images (aws-terraform) -     🔗  N/A See Details
build-prebuilt-images (omnibus) -     🔗  N/A See Details

🔎 See details on Foresight

*You can configure Foresight comments in your organization settings page.

@@ -1 +1 @@
FROM bitovi/bitops:{{ tags.bitops_base | default("dev-base") }}
FROM bitovi/bitops:{{ tag[0] | replace('v', '') }}{{ tag[1:] }}
Copy link
Copy Markdown
Contributor Author

@arm4b arm4b Apr 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

FYI what this does, - removes the v prefix (if exists) from v1.2.3 in the Docker tag during templating

@arm4b arm4b added this to the v2.5.0 milestone Apr 8, 2023
Comment on lines +197 to +216
name: Tag the Docker image
id: meta
uses: docker/metadata-action@v4
with:
images: |
bitovi/bitops
# disable automatic 'latest' tag generation
flavor: latest=false
# https://bitops.sh/versioning/
tags: |
# DEVELOPMENT
# On 'main' branch push, - build 'omnibus' image and publish it as 'dev' Docker tag
type=raw,value=dev,enable=${{ (github.ref_name == 'main') && (matrix.target == 'omnibus') }}
# RELEASE
# On a versioned release push '2.0.0-omnibus', '2.0.0-aws-ansible', etc Docker tags
type=semver,pattern={{version}}-${{ matrix.target }},enable=${{ github.event_name == 'release' }}
# If omnibus release, push additional versioned '1.2.3' Docker tag
type=semver,pattern={{version}},enable=${{ (github.event_name == 'release') && (matrix.target == 'omnibus') }}
# On release update additional 'latest' Docker tag for Omnibus image
type=raw,value=latest,enable=${{ (github.event_name == 'release') && (matrix.target == 'omnibus') }}
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The BitOps versioning tagging strategy is happening here with help of
https://github.com/marketplace/actions/docker-metadata-action

Copy link
Copy Markdown
Contributor

@LeoDiazL LeoDiazL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks awesome @armab. Code looks good. If it's tested, then ... merge away!
Would like to release it myself to see how easy it is live.

@arm4b arm4b merged commit 43d0113 into main Apr 10, 2023
@arm4b arm4b deleted the feature/release-ci branch April 10, 2023 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug 🪲 Something isn't working CI/CD enhancement ✨ New feature or request refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

CI/CD Refactoring & Release pipeline

2 participants