Skip to content
Snippets Groups Projects
Commit e2f7a2cb authored by Michal Petrovič's avatar Michal Petrovič
Browse files

Update .gitlab-ci.yml file

parent f92f3b3b
1 merge request!4Resolve "Vyuzitie cachce miesto artifacts pomocou tags pre runnery"
Pipeline #166573 failed with stages
in 2 minutes
...@@ -17,17 +17,22 @@ stages: ...@@ -17,17 +17,22 @@ stages:
gradlew-bootJar: gradlew-bootJar:
stage: build stage: build
tags:
- worker
image: eclipse-temurin:11-jdk-alpine image: eclipse-temurin:11-jdk-alpine
script: script:
- ./gradlew bootJar # - ./gradlew bootJar
- echo "bootJar"
docker-build-latest: docker-build-latest:
stage: build stage: build
image: docker:git image: docker:git
only: tags:
refs: - cache
- main # only:
# refs:
# - main
except: except:
variables: variables:
- $CI_COMMIT_TAG - $CI_COMMIT_TAG
...@@ -35,16 +40,14 @@ docker-build-latest: ...@@ -35,16 +40,14 @@ docker-build-latest:
- mkdir -p build - mkdir -p build
script: script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:latest . - docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:latest .
- docker save $DOCKER_NAMESPACE/$PROJECT_NAME:latest | bzip2 > build/image.tar.bz2 - docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:latest
artifacts:
paths:
- build/image.tar.bz2
expire_in: 10 mins # Optional: Set an expiration time for the artifact
docker-build-tag: docker-build-tag:
stage: build stage: build
image: docker:git image: docker:git
tags:
- cache
only: only:
variables: variables:
- $CI_COMMIT_TAG - $CI_COMMIT_TAG
...@@ -52,11 +55,7 @@ docker-build-tag: ...@@ -52,11 +55,7 @@ docker-build-tag:
- mkdir -p build - mkdir -p build
script: script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG . - docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG .
- docker save $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG | bzip2 > build/image.tar.bz2 - docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
artifacts:
paths:
- build/image.tar
expire_in: 10 mins # Optional: Set an expiration time for the artifact
...@@ -64,17 +63,7 @@ docker-build-tag: ...@@ -64,17 +63,7 @@ docker-build-tag:
# Stage: test # Stage: test
# =========================================================================== # ===========================================================================
verification-unit:
stage: verification
image: eclipse-temurin:11-jdk-alpine
allow_failure: true
script:
- ./gradlew test
artifacts:
when: always
reports:
junit: build/test-results/test/**/TEST-*.xml
expire_in: 10 mins
# =========================================================================== # ===========================================================================
# Stage: publish # Stage: publish
...@@ -83,25 +72,27 @@ verification-unit: ...@@ -83,25 +72,27 @@ verification-unit:
docker-push-latest: docker-push-latest:
stage: publish stage: publish
image: docker image: docker
only: tags:
- main - cache
# only:
# - main
before_script: before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY - docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script: script:
- bzip2 -d -c build/image.tar.bz2 > build/image.tar
- docker load -i build/image.tar - docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:latest # - docker push $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-push-tag: docker-push-tag:
stage: publish stage: publish
image: docker image: docker
tags:
- cache
only: only:
variables: variables:
- $CI_COMMIT_TAG - $CI_COMMIT_TAG
before_script: before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY - docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script: script:
- bzip2 -d -c build/image.tar.bz2 > build/image.tar
- docker load -i build/image.tar - docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG - docker push $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
...@@ -111,6 +102,8 @@ docker-push-tag: ...@@ -111,6 +102,8 @@ docker-push-tag:
deploy-bioinformatika.pef.mendelu.cz: deploy-bioinformatika.pef.mendelu.cz:
stage: deploy stage: deploy
tags:
- master
only: only:
- main - main
script: script:
...@@ -123,6 +116,8 @@ deploy-bioinformatika.pef.mendelu.cz: ...@@ -123,6 +116,8 @@ deploy-bioinformatika.pef.mendelu.cz:
deploy-bioinformatics.ibp.cz: deploy-bioinformatics.ibp.cz:
stage: deploy stage: deploy
tags:
- master
only: only:
variables: variables:
- $CI_COMMIT_TAG - $CI_COMMIT_TAG
...@@ -130,6 +125,3 @@ deploy-bioinformatics.ibp.cz: ...@@ -130,6 +125,3 @@ deploy-bioinformatics.ibp.cz:
- scp .env root@bioinformatics.ibp.cz:/opt/ - scp .env root@bioinformatics.ibp.cz:/opt/
- scp docker-compose.yml root@bioinformatics.ibp.cz:/opt/ - scp docker-compose.yml root@bioinformatics.ibp.cz:/opt/
- ssh root@bioinformatics.ibp.cz "cd /opt && export $(xargs < .env) && docker stack deploy dna-analyser -c docker-compose.yml" - ssh root@bioinformatics.ibp.cz "cd /opt && export $(xargs < .env) && docker stack deploy dna-analyser -c docker-compose.yml"
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment