From ee06a76643c4fe42d823be672b880b2aaa8ca7c2 Mon Sep 17 00:00:00 2001 From: Vitaliy Potyarkin Date: Thu, 9 Jan 2025 11:11:03 +0300 Subject: [PATCH] [#54] Build and host OCI images on our own infra Similar to https://git.frostfs.info/TrueCloudLab/frostfs-s3-gw/issues/587 this PR introduces a CI pipeline that builds Docker images and pushes them to our selfhosted registry. Signed-off-by: Vitaliy Potyarkin --- .env | 2 +- .forgejo/workflows/oci-image.yml | 27 +++++++++++++++++++++++++++ Makefile | 8 +++++++- 3 files changed, 35 insertions(+), 2 deletions(-) create mode 100644 .forgejo/workflows/oci-image.yml diff --git a/.env b/.env index ecb9f36..c34389e 100644 --- a/.env +++ b/.env @@ -1,6 +1,6 @@ FROSTFS_HUB_IMAGE=truecloudlab/frostfs FROSTFS_FORGEJO_IMAGE=git.frostfs.info/truecloudlab/frostfs -AIO_IMAGE=truecloudlab/frostfs-aio +AIO_IMAGE=git.frostfs.info/truecloudlab/frostfs-aio AIO_VERSION=1.6.5 FROSTFS_CORE_TAG=0.44.9 diff --git a/.forgejo/workflows/oci-image.yml b/.forgejo/workflows/oci-image.yml new file mode 100644 index 0000000..31c1200 --- /dev/null +++ b/.forgejo/workflows/oci-image.yml @@ -0,0 +1,27 @@ +on: + pull_request: + push: + workflow_dispatch: + +jobs: + image: + name: OCI image + runs-on: docker + container: git.frostfs.info/truecloudlab/env:oci-image-builder-bookworm + steps: + - name: Clone git repo + uses: actions/checkout@v3 + + - name: Build OCI image + run: make image-aio + + - name: Push image to OCI registry + run: | + echo "$REGISTRY_PASSWORD" \ + | docker login --username truecloudlab --password-stdin git.frostfs.info + make image-push + if: >- + startsWith(github.ref, 'refs/tags/v') && + (github.event_name == 'workflow_dispatch' || github.event_name == 'push') + env: + REGISTRY_PASSWORD: ${{secrets.FORGEJO_OCI_REGISTRY_PUSH_TOKEN}} diff --git a/Makefile b/Makefile index 2b65034..bc3b947 100644 --- a/Makefile +++ b/Makefile @@ -8,7 +8,7 @@ REPO=$(notdir $(shell pwd)) VERSION ?= "$(shell git describe --tags --match "v*" 2>/dev/null || git rev-parse --short HEAD | sed 's/^v//')" # Variables for docker -AIO_IMAGE ?= "truecloudlab/frostfs-aio" +AIO_IMAGE ?= "git.frostfs.info/truecloudlab/frostfs-aio" LOG_DIR ?= "/var/log" # Variables for compose @@ -59,6 +59,12 @@ image-aio-custom: --build-arg NEOGO_TAG=$(NEOGO_TAG) \ -t $(AIO_IMAGE):$(AIO_VERSION) . +# Push aio Docker image to the registry +.PHONY: image-push +image-push: + @echo "⇒ Publish image" + @docker push $(AIO_IMAGE):$(AIO_VERSION) + # Start AIO up: @$(COMPOSE_CMD_UP)