From c782497f4d07c5f0181667ae85221c631013c6aa Mon Sep 17 00:00:00 2001 From: Aleksandr Vodyanov Date: Mon, 20 Jan 2025 13:43:29 +0300 Subject: [PATCH] [DO-1495] add cmake-format (!2) Co-authored-by: aleksandr.vodyanov Reviewed-on: https://git.avroid.tech/Docker/clang-format/pulls/2 --- .gitea/workflows/build-and-push-image.yaml | 49 ++++++++++++++++++++++ CHANGELOG.md | 8 ++++ Dockerfile | 7 ++-- Makefile | 13 +++--- 4 files changed, 69 insertions(+), 8 deletions(-) create mode 100644 .gitea/workflows/build-and-push-image.yaml diff --git a/.gitea/workflows/build-and-push-image.yaml b/.gitea/workflows/build-and-push-image.yaml new file mode 100644 index 0000000..1017f63 --- /dev/null +++ b/.gitea/workflows/build-and-push-image.yaml @@ -0,0 +1,49 @@ +name: Build and publish docker image + +on: [push] + +env: + CI: ON + +# Allow workflow to be manually run from the Gitea UI + workflow_dispatch: + +jobs: + build_and_push: + runs-on: docker + name: Builds the image and publishes to docker hub + container: + image: harbor.avroid.tech/docker-hub-proxy/catthehacker/ubuntu:act-latest + steps: + - run: printenv + + - name: Login to Harbor Docker Registry + uses: docker/login-action@v3 + with: + registry: https://harbor.avroid.tech + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_TOKEN }} + + - name: Check out repository code + uses: actions/checkout@v3 + + - name: "Build image" + run: | + make build + + - name: "Push image" + run: | + make push + if: ${{ gitea.ref == 'refs/heads/master' }} + + - name: "Clear image" + run: | + make clean + + - name: Create and push tag + run: | + git config user.name "Jenkins" + git config user.email "svc-jenkins@avroid.tech" + git tag $(make getTag) + git push origin $(make getTag) + if: ${{ gitea.ref == 'refs/heads/master' }} diff --git a/CHANGELOG.md b/CHANGELOG.md index d81f613..10fd5e0 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,6 +5,14 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [14-node20-1] - 2025-20-01 + +### Added +* cmake-format + +### Changed +* refactor Makefile + ## [14-node20] - 2023-11-01 ### Added diff --git a/Dockerfile b/Dockerfile index 960eb6b..8c66fcd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -5,7 +5,7 @@ ARG UBUNTU_VERSION=22.04 FROM ${DOCKER_REGISTRY}/ubuntu:${UBUNTU_VERSION} LABEL maintainer="devops " \ - description="Image with LLVM clang-format, for check sources" \ + description="Image with LLVM clang-format and cmake-format for check sources" \ tools.nodejs.version="20.9.0" ARG CLANG_TOOLS_VERSION=14 @@ -21,10 +21,10 @@ ARG USER_HOME=/home/${USER} ARG NEXUS_DOMAIN_NAME='nexus.avroid.tech' ARG NEXUS_URL="https://${NEXUS_DOMAIN_NAME}" -ENV TZ Europe/Moscow +ENV TZ=Europe/Moscow # Подавляем вывод в консоль интерактивных диалогов у служебных команд -ENV DEBIAN_FRONTEND noninteractive +ENV DEBIAN_FRONTEND=noninteractive RUN sed -ie "s/deb\ http\:\/\/archive.ubuntu.com\/ubuntu/deb\ [trusted=yes] https\:\/\/${NEXUS_DOMAIN_NAME}\/repository\/all-apt-proxy-archive-ubuntu-com/g" /etc/apt/sources.list \ && sed -ie "s/deb\ http\:\/\/security.ubuntu.com\/ubuntu/deb\ [trusted=yes] https\:\/\/${NEXUS_DOMAIN_NAME}\/repository\/all-apt-proxy-security-ubuntu-com/g" /etc/apt/sources.list \ @@ -64,6 +64,7 @@ RUN wget -O - "${NEXUS_URL}/repository/all-raw-proxy-apt-llvm-org/llvm-snapshot. && apt-get install -y \ clang-format-${CLANG_TOOLS_VERSION} \ clang-tidy-${CLANG_TOOLS_VERSION} \ + cmake-format \ parallel \ && ln -s /usr/bin/clang-format-${CLANG_TOOLS_VERSION} /usr/bin/clang-format \ && ln -s /usr/bin/clang-tidy-${CLANG_TOOLS_VERSION} /usr/bin/clang-tidy \ diff --git a/Makefile b/Makefile index 3456ef8..3d90e14 100644 --- a/Makefile +++ b/Makefile @@ -3,10 +3,16 @@ IMAGE_NAME = clang-format IMAGE_GROUP = devops APP_VERSION = 14 -REVISION = -node20 +REVISION = -node20-1 IMAGE_TAG = $(APP_VERSION)$(REVISION) DOCKER_REGISTRY = harbor.avroid.tech +CI_FLAGS = + +ifeq ($(CI), false) + CI_FLAGS = --no-cache +endif + all: @echo 'DEFAULT:' @echo ' make build' @@ -16,16 +22,13 @@ all: build: DOCKER_BUILDKIT=1 docker build \ - --no-cache \ --pull \ + --network=host \ --platform linux/amd64 \ -t $(DOCKER_REGISTRY)/$(IMAGE_GROUP)/$(IMAGE_NAME):$(IMAGE_TAG) \ --build-arg CLANG_TOOLS_VERSION=$(APP_VERSION) . push: -ifeq ($(CI), false) - docker login https://$(DOCKER_REGISTRY) -endif docker push $(DOCKER_REGISTRY)/$(IMAGE_GROUP)/$(IMAGE_NAME):$(IMAGE_TAG) getTag: