Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
frontend-vue-2
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Bioinformatics
frontend-vue-2
Commits
c7312cb0
Commit
c7312cb0
authored
1 year ago
by
Michal Petrovič
Browse files
Options
Downloads
Patches
Plain Diff
Update .gitlab-ci.yml file
parent
f88e5743
1 merge request
!4
Resolve "Vyuzitie cachce miesto artifacts pomocou tags pre runnery"
Pipeline
#166546
passed with warnings with stage
Stage:
in 8 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+121
-25
121 additions, 25 deletions
.gitlab-ci.yml
with
121 additions
and
25 deletions
.gitlab-ci.yml
+
121
−
25
View file @
c7312cb0
variables
:
variables
:
DOCKER_HOST
:
$DOCKER_HOST_BIO
DOCKER_HOST
:
$DOCKER_HOST_BIO
PROJECT_NAME
:
"
frontend"
PROJECT_NAME
:
"
frontend"
cache
:
cache
:
key
:
$CI_COMMIT_REF_NAME
key
:
$CI_COMMIT_REF_NAME
paths
:
paths
:
-
build/
-
build/
stages
:
stages
:
-
analyse
-
build
-
build
-
test
-
publish
-
create
-
deploy
-
read
job1
:
# ===========================================================================
stage
:
build
# Stage: analyse
# ===========================================================================
include
:
-
template
:
Code-Quality.gitlab-ci.yml
code_quality
:
tags
:
tags
:
-
rancher02
-
rancher02
script
:
stage
:
analyse
-
echo "Building on rancher02"
services
:
[]
# Shut off Docker-in-Docker
variables
:
REPORT_FORMAT
:
html
artifacts
:
paths
:
[
gl-code-quality-report.html
]
job2
:
# second job has to be run to create both artefacts
stage
:
test
code_quality_json
:
tags
:
tags
:
-
rancher03
-
rancher02
script
:
extends
:
code_quality
-
echo "Running tests on a worker runner"
variables
:
REPORT_FORMAT
:
json
artifacts
:
paths
:
[
gl-code-quality-report.json
]
create-cache
:
stage
:
create
# ===========================================================================
# Stage: build
# ===========================================================================
docker-build-latest
:
stage
:
build
image
:
docker:git
tags
:
tags
:
-
cache
-
cache
only
:
refs
:
-
main
except
:
variables
:
-
$CI_COMMIT_TAG
before_script
:
-
mkdir -p build
script
:
script
:
-
docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:latest .
-
docker save -o build/image.tar $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-build-tag
:
stage
:
build
image
:
docker:git
only
:
variables
:
-
$CI_COMMIT_TAG
before_script
:
-
mkdir -p build
-
mkdir -p build
-
echo "Hello World" > build/hello.txt
script
:
-
echo "Cache file created."
-
docker build -t $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG .
-
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
# ===========================================================================
# Stage: test
#
# TODO
# ===========================================================================
read-cache
:
stage
:
read
# ===========================================================================
# Stage: publish
# ===========================================================================
docker-push-latest
:
stage
:
publish
image
:
docker
tags
:
tags
:
-
cache
-
cache
only
:
-
main
before_script
:
-
docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script
:
-
docker load -i build/image.tar
# - docker push $DOCKER_NAMESPACE/$PROJECT_NAME:latest
docker-push-tag
:
stage
:
publish
image
:
docker
only
:
variables
:
-
$CI_COMMIT_TAG
before_script
:
-
docker login -u $DOCKER_USERNAME -p $DOCKER_TOKEN $DOCKER_REGISTRY
script
:
-
docker load -i build/image.tar
-
docker push $DOCKER_NAMESPACE/$PROJECT_NAME:$CI_COMMIT_TAG
# ===========================================================================
# Stage: deploy
# ===========================================================================
deploy-bioinformatika.pef.mendelu.cz
:
stage
:
deploy
only
:
-
main
script
:
-
cp .env /home/bioinformatics/
-
cd /home/bioinformatics/
-
docker-compose config > docker-swarm.yml
# - docker stack deploy -c docker-compose.yml test_stack
# after_script:
# - docker system prune -f
deploy-bioinformatics.ibp.cz
:
stage
:
deploy
only
:
variables
:
-
$CI_COMMIT_TAG
script
:
script
:
-
if [ -f build/hello.txt ]; then
-
scp .env root@bioinformatics.ibp.cz:/opt/
echo "Reading cached file:";
-
scp docker-compose.yml root@bioinformatics.ibp.cz:/opt/
cat build/hello.txt;
-
ssh root@bioinformatics.ibp.cz "cd /opt && export $(xargs < .env) && docker stack deploy dna-analyser -c docker-compose.yml"
else
echo "Cached file not found.";
fi
This diff is collapsed.
Click to expand it.
Preview
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment