From 04ebb9d1ede83e2dcbef98e21f5bbcfe65c72b80 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=A1=D0=B5=D1=80=D0=B3=D0=B5=D0=B9=20=D0=90=D0=BD=D1=82?= =?UTF-8?q?=D1=80=D0=BE=D0=BF=D0=BE=D0=B2?= Date: Fri, 14 Mar 2025 16:50:45 +0300 Subject: [PATCH] =?UTF-8?q?=D0=94=D0=BE=D0=B1=D0=B0=D0=B2=D0=B8=D0=BB=20?= =?UTF-8?q?=D0=B2=D0=BE=D0=B7=D0=BC=D0=BE=D0=B6=D0=BD=D0=BE=D1=81=D1=82?= =?UTF-8?q?=D1=8C=20=D1=80=D0=B5=D0=BB=D0=B8=D0=B7=D0=BE=D0=B2=20=D0=B2=20?= =?UTF-8?q?=D1=80=D0=B5=D0=B4=D0=B6=D0=B8=D1=81=D1=82=D1=80=D0=B8=20=D0=B8?= =?UTF-8?q?=20=D1=84=D0=B0=D0=B9=D0=BB=20=D0=B4CI=20=D0=B4=D0=BB=D1=8F=20G?= =?UTF-8?q?itLab?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Makefile | 10 ++++++++++ gitlab-ci.yml | 31 +++++++++++++++++++++++++++++++ 2 files changed, 41 insertions(+) create mode 100644 gitlab-ci.yml diff --git a/Makefile b/Makefile index 75a9adc..a4820db 100644 --- a/Makefile +++ b/Makefile @@ -1,3 +1,7 @@ +# Глобальные переменные +IMAGE ?= ansible +TAG ?= 0.1 +REGISTRY ?= hub.cism-ms.ru view create edit show delete test lint deploy new: @true @@ -21,6 +25,12 @@ rebuild: prune: docker system prune -af +release: + cp ~/.ssh/id_rsa . + docker login $(REGISTRY) + docker buildx build -t $(REGISTRY)/ansible/$(IMAGE):$(TAG) --platform linux/amd64,linux/arm64 --push . + rm id_rsa + #################################################################################################### # Работа с ролью diff --git a/gitlab-ci.yml b/gitlab-ci.yml new file mode 100644 index 0000000..d61c044 --- /dev/null +++ b/gitlab-ci.yml @@ -0,0 +1,31 @@ +stages: + - lint + - test + - deploy + +variables: + DOCKER_IMAGE: "ansible:latest" + +before_script: + - docker login -u "$CI_REGISTRY_USER" -p "$CI_REGISTRY_PASSWORD" $CI_REGISTRY + - docker pull $DOCKER_IMAGE + +lint: + stage: lint + script: + - docker run --rm -v $(pwd):/ansible $DOCKER_IMAGE make role lint + allow_failure: false + +test: + stage: test + script: + - docker run --rm -v $(pwd):/ansible $DOCKER_IMAGE make role test + allow_failure: false + +deploy: + stage: deploy + script: + - docker run --rm -v $(pwd):/ansible $DOCKER_IMAGE make role deploy + only: + - master + - /^cluster-.*$/