From 3cf903df8aa9506471c2e370448aaae6b72f1f1d Mon Sep 17 00:00:00 2001 From: Dominik Rosiek Date: Mon, 3 Jun 2024 13:36:17 +0200 Subject: [PATCH] chore: set version and release_number labels in ubi image Signed-off-by: Dominik Rosiek --- .github/workflows/dev_builds.yml | 25 +++++++++++++------------ .github/workflows/release_builds.yml | 24 ++++++++++++------------ operator/Makefile | 9 ++++++++- sidecar/fluentbit/Makefile | 4 ++++ 4 files changed, 37 insertions(+), 25 deletions(-) diff --git a/.github/workflows/dev_builds.yml b/.github/workflows/dev_builds.yml index e0d68e2b..d68817e4 100644 --- a/.github/workflows/dev_builds.yml +++ b/.github/workflows/dev_builds.yml @@ -5,6 +5,7 @@ on: branches: - main - 'release-v[0-9]+.[0-9]+' + - 'dev-build/*' env: SIDECAR_IMAGE: "ghcr.io/sumologic/tailing-sidecar" @@ -42,13 +43,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Log in to AWS Public ECR to publish tailing sidecar image @@ -60,13 +61,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push to ECR tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag to ECR run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag to ECR - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Login to Docker Hub @@ -78,13 +79,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit build-otelcol-sidecar: @@ -156,13 +157,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Log in to AWS Public ECR to publish tailing sidecar operator image @@ -174,13 +175,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push to ECR tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag to ECR run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag to ECR - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Login to Docker Hub @@ -192,13 +193,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./operator push-helm-chart: diff --git a/.github/workflows/release_builds.yml b/.github/workflows/release_builds.yml index c370c405..fd686a6c 100644 --- a/.github/workflows/release_builds.yml +++ b/.github/workflows/release_builds.yml @@ -41,13 +41,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Log in to AWS Public ECR to publish tailing sidecar image @@ -59,13 +59,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push to ECR tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag to ECR run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag to ECR - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Login to Docker Hub @@ -77,13 +77,13 @@ jobs: run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Build and push tailing sidecar ubi image - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar image with latest tag run: make build-push-multiplatform TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit - name: Push tailing sidecar ubi image with latest tag - run: make build-push-ubi TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} TAG=${{ env.SIDECAR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./sidecar/fluentbit build-operator: @@ -115,13 +115,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Log in to AWS Public ECR to publish tailing sidecar operator image @@ -133,13 +133,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push to ECR tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag to ECR run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag to ECR - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE_ECR }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Login to Docker Hub @@ -151,13 +151,13 @@ jobs: run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Build and push tailing sidecar operator ubi image - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} + run: make build-push-ubi VERSION=${{ steps.extract_tag.outputs.tag }} IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ steps.extract_tag.outputs.tag }} working-directory: ./operator - name: Push tailing sidecar operator image with latest tag run: make build-push-multiplatform IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./operator - name: Push tailing sidecar operator ubi image with latest tag - run: make build-push-ubi IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} + run: make build-push-ubi VERSION=${{ env.LATEST_TAG }} IMG=${{ env.OPERATOR_IMAGE_DOCKERHUB }}:${{ env.LATEST_TAG }} working-directory: ./operator push-helm-chart: diff --git a/operator/Makefile b/operator/Makefile index e163407c..abb51c4e 100755 --- a/operator/Makefile +++ b/operator/Makefile @@ -28,6 +28,9 @@ else GOBIN=$(shell go env GOBIN) endif +# UBI image variables +RELEASE_NUMBER ?= "1" + # Run tests # Set default shell as bash SHELL := /bin/bash @@ -175,7 +178,11 @@ generate: controller-gen # Build the docker image docker-build: - docker build . -f ${DOCKERFILE} -t ${IMG} + docker build . \ + --build-arg RELEASE_NUMBER=$(RELEASE_NUMBER) \ + --build-arg VERSION=$(VERSION) \ + -f ${DOCKERFILE} \ + -t ${IMG} # Push the docker image docker-push: diff --git a/sidecar/fluentbit/Makefile b/sidecar/fluentbit/Makefile index 853597e9..7f67ace1 100755 --- a/sidecar/fluentbit/Makefile +++ b/sidecar/fluentbit/Makefile @@ -9,6 +9,8 @@ root_dir := $(dir $(abspath $(mkfile_path)/..)) TAG ?= "localhost:32000/sumologic/tailing-sidecar:latest" DOCKERFILE ?= Dockerfile +RELEASE_NUMBER ?= 1\ +VERSION ?= "" all: build push @@ -21,6 +23,8 @@ run: build docker run --rm -it \ -v $(DIR_TO_TAIL):/tmp/host \ -v $(FLUENT_BIT_DB_DIR):/tailing-sidecar/var \ + --build-arg RELEASE_NUMBER=$(RELEASE_NUMBER) \ + --build-arg VERSION=$(VERSION) \ --env "PATH_TO_TAIL=/tmp/host/$(FILES_PATTERN)" \ --env "LOG_LEVEL=${LOG_LEVEL}" $(TAG)