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
Branches
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:
DOCKER_HOST: $DOCKER_HOST_BIO
PROJECT_NAME: "backend"
cache:
key: $CI_COMMIT_REF_NAME
paths:
- build/
stages:
- build
......@@ -17,6 +21,8 @@ stages:
gradlew-bootJar:
stage: build
tags:
- worker
image: eclipse-temurin:11-jdk-alpine
script:
- ./gradlew bootJar
......@@ -25,6 +31,8 @@ gradlew-bootJar:
docker-build-latest:
stage: build
image: docker:git
tags:
- cache
only:
refs:
- main
......@@ -35,16 +43,14 @@ docker-build-latest:
- mkdir -p build
script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:latest .
- docker save $DOCKER_NAMESPACE/$PROJECT_NAME:latest | bzip2 > build/image.tar.bz2
artifacts:
paths:
- build/image.tar.bz2
expire_in: 10 mins # Optional: Set an expiration time for the artifact
- docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-build-tag:
stage: build
image: docker:git
tags:
- cache
only:
variables:
- $CI_COMMIT_TAG
......@@ -52,11 +58,7 @@ docker-build-tag:
- mkdir -p build
script:
- docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG .
- docker save $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG | bzip2 > build/image.tar.bz2
artifacts:
paths:
- build/image.tar
expire_in: 10 mins # Optional: Set an expiration time for the artifact
- docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
......@@ -67,6 +69,8 @@ docker-build-tag:
verification-unit:
stage: verification
image: eclipse-temurin:11-jdk-alpine
tags:
- worker
allow_failure: true
script:
- ./gradlew test
......@@ -76,6 +80,7 @@ verification-unit:
junit: build/test-results/test/**/TEST-*.xml
expire_in: 10 mins
# ===========================================================================
# Stage: publish
# ===========================================================================
......@@ -83,25 +88,27 @@ verification-unit:
docker-push-latest:
stage: publish
image: docker
tags:
- cache
only:
- main
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script:
- bzip2 -d -c build/image.tar.bz2 > build/image.tar
- docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-push-tag:
stage: publish
image: docker
tags:
- cache
only:
variables:
- $CI_COMMIT_TAG
before_script:
- docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script:
- bzip2 -d -c build/image.tar.bz2 > build/image.tar
- docker load -i build/image.tar
- docker push $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
......@@ -111,6 +118,8 @@ docker-push-tag:
deploy-bioinformatika.pef.mendelu.cz:
stage: deploy
tags:
- master
only:
- main
script:
......@@ -123,6 +132,8 @@ deploy-bioinformatika.pef.mendelu.cz:
deploy-bioinformatics.ibp.cz:
stage: deploy
tags:
- master
only:
variables:
- $CI_COMMIT_TAG
......@@ -130,6 +141,3 @@ deploy-bioinformatics.ibp.cz:
- scp .env 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"
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