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

Merge branch '4-Vyuzitie-cachce-miesto-artifacts-pomocou-tags-pre-runnery' into 'main'

Resolve "Vyuzitie cachce miesto artifacts pomocou tags pre runnery"

Closes #4

See merge request !4
parents f92f3b3b d6caed10
1 merge request!4Resolve "Vyuzitie cachce miesto artifacts pomocou tags pre runnery"
Pipeline #178338 passed with stages
in 4 minutes and 19 seconds
...@@ -2,6 +2,10 @@ variables: ...@@ -2,6 +2,10 @@ variables:
DOCKER_HOST: $DOCKER_HOST_BIO DOCKER_HOST: $DOCKER_HOST_BIO
PROJECT_NAME: "backend" PROJECT_NAME: "backend"
cache:
key: $CI_COMMIT_REF_NAME
paths:
- build/
stages: stages:
- build - build
...@@ -17,6 +21,8 @@ stages: ...@@ -17,6 +21,8 @@ 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
...@@ -25,6 +31,8 @@ gradlew-bootJar: ...@@ -25,6 +31,8 @@ gradlew-bootJar:
docker-build-latest: docker-build-latest:
stage: build stage: build
image: docker:git image: docker:git
tags:
- cache
only: only:
refs: refs:
- main - main
...@@ -35,16 +43,14 @@ docker-build-latest: ...@@ -35,16 +43,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 +58,7 @@ docker-build-tag: ...@@ -52,11 +58,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
...@@ -67,6 +69,8 @@ docker-build-tag: ...@@ -67,6 +69,8 @@ docker-build-tag:
verification-unit: verification-unit:
stage: verification stage: verification
image: eclipse-temurin:11-jdk-alpine image: eclipse-temurin:11-jdk-alpine
tags:
- worker
allow_failure: true allow_failure: true
script: script:
- ./gradlew test - ./gradlew test
...@@ -76,6 +80,7 @@ verification-unit: ...@@ -76,6 +80,7 @@ verification-unit:
junit: build/test-results/test/**/TEST-*.xml junit: build/test-results/test/**/TEST-*.xml
expire_in: 10 mins expire_in: 10 mins
# =========================================================================== # ===========================================================================
# Stage: publish # Stage: publish
# =========================================================================== # ===========================================================================
...@@ -83,25 +88,27 @@ verification-unit: ...@@ -83,25 +88,27 @@ verification-unit:
docker-push-latest: docker-push-latest:
stage: publish stage: publish
image: docker image: docker
tags:
- cache
only: only:
- main - 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 +118,8 @@ docker-push-tag: ...@@ -111,6 +118,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 +132,8 @@ deploy-bioinformatika.pef.mendelu.cz: ...@@ -123,6 +132,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 +141,3 @@ deploy-bioinformatics.ibp.cz: ...@@ -130,6 +141,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