From 2bc8867eaf247e217235b6fa1a1d081680e6d86d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Adam=20=C5=A0trauch?= Date: Fri, 19 Nov 2021 18:09:15 +0100 Subject: [PATCH] Drone CI pipelines --- .drone.yml | 53 +++++++++++++++++++++++------------------------------ Makefile | 11 ++++++----- 2 files changed, 29 insertions(+), 35 deletions(-) diff --git a/.drone.yml b/.drone.yml index ef2ad59..b9ea599 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,17 +1,19 @@ kind: pipeline -type: ssh -name: image builder - -server: - host: 192.168.1.2 - user: build - password: - from_secret: ssh_password +type: docker +name: image building steps: -- name: build +- name: build&push squashed image + image: harbor.hq.rosti.cz/library/builder:35 + environment: + username: robot$rosti+rosti + password: + from_secret: repo_password + repo: harbor.hq.rosti.cz + privileged: true commands: - - make build + - echo "$password" | podman login -u $username --password-stdin $repo + - make push trigger: event: @@ -21,27 +23,18 @@ trigger: --- kind: pipeline -type: ssh -name: production image builder - -server: - host: 192.168.1.2 - user: build - password: - from_secret: ssh_password +type: docker +name: test image building steps: -- name: build +- name: test build + image: harbor.hq.rosti.cz/library/builder:35 environment: - DOCKER_USERNAME: creckx - DOCKER_PASSWORD: - from_secret: docker_password + username: robot$rosti+rosti + password: + from_secret: repo_password + repo: harbor.hq.rosti.cz + privileged: true commands: - - docker login -u $DOCKER_USERNAME --password $DOCKER_PASSWORD - - make push - -trigger: - event: - - promote - target: - - production + - echo "$password" | podman login -u $username --password-stdin $repo + - make build diff --git a/Makefile b/Makefile index 5e4f611..dcf017b 100644 --- a/Makefile +++ b/Makefile @@ -1,19 +1,20 @@ +REPO=harbor.hq.rosti.cz/rosti/runtime DOCKER=docker -VERSION=2021.09-1 +VERSION=2021.11-1 all: build build: $(DOCKER) pull debian:buster - $(DOCKER) build -t rosti/runtime:dev . + $(DOCKER) build -t ${REPO}:dev . test: DOCKER=$(DOCKER) ./tests.sh squashed: $(DOCKER) pull debian:buster - $(DOCKER) build --squash -t rosti/runtime:dev-squashed . + $(DOCKER) build --squash -t ${REPO}:dev-squashed . push: squashed - $(DOCKER) tag rosti/runtime:dev-squashed rosti/runtime:$(VERSION) - $(DOCKER) push rosti/runtime:$(VERSION) + $(DOCKER) tag ${REPO}:dev-squashed ${REPO}:$(VERSION) + $(DOCKER) push ${REPO}:$(VERSION)