test cicd

This commit is contained in:
Struchkov Mark 2022-01-26 12:41:36 +03:00
parent 03e286225d
commit 35c3c5b49b

View File

@ -1,36 +1,53 @@
image: maven:3.8.4-openjdk-17
variables:
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
stages: stages:
- build - build
- deploy - deploy
build: build:
image: maven:3.8.4-openjdk-17
stage: build stage: build
variables:
MAVEN_OPTS: "-Dmaven.repo.local=./.m2/repository"
only: only:
- /^v.*$/ - test
except: # except:
- branches # - branches
script: script:
- 'mvn -U clean package' - 'mvn -U clean package'
artifacts: artifacts:
paths: paths:
- gitlab-app/target/gitlab-notification.jar - gitlab-app/target/gitlab-notification.jar
docker-build-master: docker-build:
image: docker:latest image: docker/buildx-bin
stage: deploy stage: deploy
only: only:
- /^v.*$/ - test
except: # except:
- branches # - branches
services: services:
- docker:dind - docker:dind
before_script: before_script:
- echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin - echo "$CI_REGISTRY_PASSWORD" | docker login $CI_REGISTRY --username $CI_REGISTRY_USER --password-stdin
script: script:
- cd gitlab-app - cd gitlab-app
- docker build --no-cache -f Dockerfile-linux -t "$CI_REGISTRY_IMAGE:latest" . -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" - docker buildx create --use
- docker push "$CI_REGISTRY_IMAGE:latest" - docker buildx build --push --no-cache --platform linux/arm/v7,linux/arm64/v8,linux/amd64 -f Dockerfile-linux -t "$CI_REGISTRY_IMAGE:latest" -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" .
- docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG" # - docker push "$CI_REGISTRY_IMAGE:latest"
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
#docker-build-master:
# image: docker/buildx-bin
# 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:
# - cd gitlab-app
# - docker build --no-cache -f Dockerfile-linux -t "$CI_REGISTRY_IMAGE:latest" . -t "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"
# - docker push "$CI_REGISTRY_IMAGE:latest"
# - docker push "$CI_REGISTRY_IMAGE:$CI_COMMIT_TAG"