Настройка CICD с помощью Drone
This commit is contained in:
parent
686a5a0c10
commit
c419254048
34
.drone.yml
34
.drone.yml
@ -3,15 +3,20 @@ type: docker
|
|||||||
name: gitlab-notify
|
name: gitlab-notify
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: package
|
- name: create jar
|
||||||
image: maven:3.8.6-eclipse-temurin-17
|
image: maven:3.8.6-eclipse-temurin-17
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- develop
|
||||||
|
ref:
|
||||||
|
- refs/tags/v.*.*.*
|
||||||
volumes:
|
volumes:
|
||||||
- name: m2
|
- name: m2
|
||||||
path: /root/.m2/repository
|
path: /root/.m2/repository
|
||||||
commands:
|
commands:
|
||||||
- mvn -U clean package
|
- mvn -U clean package
|
||||||
|
|
||||||
- name: docker-publish
|
- name: docker publish develop
|
||||||
image: upagge/docker-buildx:latest
|
image: upagge/docker-buildx:latest
|
||||||
environment:
|
environment:
|
||||||
DOCKER_REGISTRY_TOKEN:
|
DOCKER_REGISTRY_TOKEN:
|
||||||
@ -20,6 +25,9 @@ steps:
|
|||||||
from_secret: DOCKER_IMAGE_NAME
|
from_secret: DOCKER_IMAGE_NAME
|
||||||
DOCKER_REGISTRY_USER:
|
DOCKER_REGISTRY_USER:
|
||||||
from_secret: DOCKER_REGISTRY_USER
|
from_secret: DOCKER_REGISTRY_USER
|
||||||
|
when:
|
||||||
|
branch:
|
||||||
|
- develop
|
||||||
volumes:
|
volumes:
|
||||||
- name: dockersock
|
- name: dockersock
|
||||||
path: /var/run
|
path: /var/run
|
||||||
@ -28,9 +36,31 @@ steps:
|
|||||||
- docker buildx create --use
|
- docker buildx create --use
|
||||||
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:develop" .
|
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:develop" .
|
||||||
|
|
||||||
|
- name: docker publish release
|
||||||
|
image: upagge/docker-buildx:latest
|
||||||
|
environment:
|
||||||
|
DOCKER_REGISTRY_TOKEN:
|
||||||
|
from_secret: DOCKER_REGISTRY_TOKEN
|
||||||
|
DOCKER_IMAGE_NAME:
|
||||||
|
from_secret: DOCKER_IMAGE_NAME
|
||||||
|
DOCKER_REGISTRY_USER:
|
||||||
|
from_secret: DOCKER_REGISTRY_USER
|
||||||
|
when:
|
||||||
|
ref:
|
||||||
|
- refs/tags/v.*.*.*
|
||||||
|
volumes:
|
||||||
|
- name: dockersock
|
||||||
|
path: /var/run
|
||||||
|
commands:
|
||||||
|
- echo "$DOCKER_REGISTRY_TOKEN" | docker login docker.io --username $DOCKER_REGISTRY_USER --password-stdin
|
||||||
|
- docker buildx create --use
|
||||||
|
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$DOCKER_IMAGE_NAME:latest" -t "$DOCKER_IMAGE_NAME:$DRONE_TAG" .
|
||||||
|
|
||||||
trigger:
|
trigger:
|
||||||
branch:
|
branch:
|
||||||
- develop
|
- develop
|
||||||
|
ref:
|
||||||
|
- refs/tags/v.*.*.*
|
||||||
|
|
||||||
services:
|
services:
|
||||||
- name: docker
|
- name: docker
|
||||||
|
@ -1,63 +0,0 @@
|
|||||||
stages:
|
|
||||||
- build
|
|
||||||
- deploy
|
|
||||||
|
|
||||||
build-develop:
|
|
||||||
image: maven:3.8.6-eclipse-temurin-17
|
|
||||||
stage: build
|
|
||||||
variables:
|
|
||||||
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
|
|
||||||
only:
|
|
||||||
- develop
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
script:
|
|
||||||
- 'mvn -U clean package'
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- gitlab-app/target/gitlab-notification.jar
|
|
||||||
|
|
||||||
docker-build-develop:
|
|
||||||
image: upagge/docker-buildx:latest
|
|
||||||
stage: deploy
|
|
||||||
only:
|
|
||||||
- develop
|
|
||||||
except:
|
|
||||||
- tags
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
|
|
||||||
script:
|
|
||||||
- docker buildx create --use
|
|
||||||
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$CI_REGISTRY_IMAGE:develop" .
|
|
||||||
|
|
||||||
build-release:
|
|
||||||
image: maven:3.8.6-eclipse-temurin-17
|
|
||||||
stage: build
|
|
||||||
variables:
|
|
||||||
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
|
|
||||||
only:
|
|
||||||
- /^v.*$/
|
|
||||||
except:
|
|
||||||
- branches
|
|
||||||
script:
|
|
||||||
- 'mvn -U clean package'
|
|
||||||
artifacts:
|
|
||||||
paths:
|
|
||||||
- gitlab-app/target/gitlab-notification.jar
|
|
||||||
|
|
||||||
docker-build-release:
|
|
||||||
image: upagge/docker-buildx:latest
|
|
||||||
stage: deploy
|
|
||||||
only:
|
|
||||||
- /^v.*$/
|
|
||||||
except:
|
|
||||||
- branches
|
|
||||||
services:
|
|
||||||
- docker:dind
|
|
||||||
before_script:
|
|
||||||
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
|
|
||||||
script:
|
|
||||||
- docker buildx create --use
|
|
||||||
- docker buildx build --push --platform linux/amd64,linux/arm64/v8 -t "$CI_REGISTRY_IMAGE:latest" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" .
|
|
Loading…
Reference in New Issue
Block a user