Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
ss22-devops-project-app
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
Dobromir Palushev
ss22-devops-project-app
Commits
7fca0293
Commit
7fca0293
authored
2 years ago
by
Dobromir Palushev
Browse files
Options
Downloads
Patches
Plain Diff
added pipeline code (wip)
parent
1476733f
No related branches found
No related tags found
No related merge requests found
Pipeline
#19049
failed
2 years ago
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
.gitlab-ci.yml
+88
-0
88 additions, 0 deletions
.gitlab-ci.yml
with
88 additions
and
0 deletions
.gitlab-ci.yml
0 → 100644
+
88
−
0
View file @
7fca0293
workflow
:
rules
:
-
if
:
'
$CI_PIPELINE_SOURCE
==
"merge_request_event"'
when
:
always
-
if
:
>-
$CI_PIPELINE_SOURCE == "push"
&& ($CI_COMMIT_BRANCH == "staging" || $CI_COMMIT_BRANCH == "master")
when
:
always
-
when
:
never
variables
:
DOCKER_VERSION
:
'
20.10.12'
K8S_NAMESPACE
:
'
devops-s22-deployable'
CONTAINER_TAG
:
'
${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}'
stages
:
-
test
-
build
-
deploy
job_test-image
:
stage
:
test
tags
:
-
docker-priviliged
image
:
docker:$DOCKER_VERSION
services
:
-
name
:
docker:$DOCKER_VERSION-dind
script
:
-
docker build
--tag "${CONTAINER_TAG}-test"
--target=test
"./"
after_script
:
-
docker image rm --force "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
job_build-image
:
stage
:
build
needs
:
-
'
job_test-image'
rules
:
-
if
:
$CI_COMMIT_BRANCH != "staging" && $CI_COMMIT_BRANCH != "master"
when
:
'
never'
tags
:
-
docker-priviliged
image
:
docker:$DOCKER_VERSION
services
:
-
name
:
docker:$DOCKER_VERSION-dind
script
:
-
SERVER_PUBLIC_URL=""
-
DB_HOST=""
-
docker build
--tag "${CONTAINER_TAG}"
--build-arg JWT_SECRET=${JWT_SECRET}
--build-arg SERVER_PUBLIC_URL=${SERVER_PUBLIC_URL}
--build-arg DB_HOST=${DB_HOST}
"./"
-
docker login -u ${CI_REGISTRY_USER} -p ${CI_REGISTRY_PASSWORD} ${CI_REGISTRY}
-
docker push "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
after_script
:
-
docker image rm --force "${CI_REGISTRY_IMAGE}:${CI_PIPELINE_IID}-${CI_COMMIT_SHORT_SHA}"
job_deploy-image
:
stage
:
deploy
needs
:
-
'
job_build-image'
rules
:
-
if
:
$CI_COMMIT_REF_NAME =~ /staging/
when
:
'
always'
variables
:
ENVIRONMENT_NAME
:
'
staging'
-
if
:
$CI_COMMIT_REF_NAME !~ /staging/
when
:
'
always'
variables
:
ENVIRONMENT_NAME
:
'
prod'
tags
:
-
docker
image
:
name
:
k8s-image
entrypoint
:
[
'
'
]
script
:
# - IMAGE="${CI_REGISTRY_IMAGE}:${VERSION}"
-
kubectl apply
--kubeconfig ${SECRET_KUBECONFIG_PATH}
--namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}"
--kustomize -
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
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