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
543f826e
Commit
543f826e
authored
2 years ago
by
Dobromir Palushev
Browse files
Options
Downloads
Plain Diff
Merge branch 'just-a-test' into 'main'
updated logic of the test-job See merge request
!39
parents
159e34e4
167537fc
No related branches found
No related tags found
1 merge request
!39
updated logic of the test-job
Pipeline
#19159
failed
2 years ago
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+31
-21
31 additions, 21 deletions
.gitlab-ci.yml
k8s-manifests/ingress.yaml.tmpl
+1
-1
1 addition, 1 deletion
k8s-manifests/ingress.yaml.tmpl
with
32 additions
and
22 deletions
.gitlab-ci.yml
+
31
−
21
View file @
543f826e
...
...
@@ -28,26 +28,33 @@ stages:
-
gcloud config set compute/zone ${GCP_COMPUTE_REGION}
-
gcloud container clusters get-credentials ${GCP_PROJECT_ID}-gke
# run-tests:
# stage: test
# tags:
# - docker-privileged
# image: docker:${DOCKER_VERSION}
# services:
# - name: docker:${DOCKER_VERSION}-dind
# alias: containerhost
# script:
# - docker run -p 27017:27017 -d --name mongo-container --rm mongo:${MONGO_VERSION}
# - docker build
# --tag "${CONTAINER_TAG}-test"
# --target=test
# --build-arg MONGODB_URL_TEST=mongodb://containerhost:27017/todo-app
# --build-arg JWT_SECRET_TEST=my-very-secret-jwt
# "./app"
# after_script:
# - docker stop mongo-container
# - docker images -a | grep "mongo" | awk '{print $3}' | xargs docker rmi --force
# - docker image rm --force "${CONTAINER_TAG}-test"
run-tests
:
stage
:
test
tags
:
-
docker-privileged
image
:
docker:${DOCKER_VERSION}
services
:
-
name
:
docker:${DOCKER_VERSION}-dind
alias
:
localhost
script
:
-
docker run -p 27017:27017
--detach
--name mongo-container
--rm
--network=host
mongo:${MONGO_VERSION}
-
docker build
--tag "${CONTAINER_TAG}-test"
--target=test
--network=host
--build-arg MONGODB_URL_TEST=mongodb://localhost:27017/todo-app
--build-arg JWT_SECRET_TEST=my-very-secret-jwt
--add-host=host.docker.internal:localhost
"./app"
after_script
:
-
docker stop mongo-container
-
docker images -a | grep "mongo" | awk '{print $3}' | xargs docker rmi --force
-
docker image rm --force "${CONTAINER_TAG}-test"
build-image
:
stage
:
build
...
...
@@ -120,10 +127,12 @@ deploy-image:
when
:
'
always'
variables
:
ENVIRONMENT_NAME
:
'
staging'
STATIC_IP
:
'
staging-todoapp-ip'
-
if
:
$CI_COMMIT_REF_NAME !~ /main/
when
:
'
always'
variables
:
ENVIRONMENT_NAME
:
'
production'
STATIC_IP
:
'
todoapp-ip'
tags
:
-
docker
image
:
google/cloud-sdk:${GOOGLE_CLOUD_SDK_IMAGE_VERSION}
...
...
@@ -137,7 +146,8 @@ deploy-image:
-
DEPLOYMENT_MANIFEST=$(sed -e "s,{{image}},${IMAGE},g" ./deployment.yaml.tmpl)
-
echo "${DEPLOYMENT_MANIFEST}" | kubectl apply --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}" --filename -
-
kubectl apply -f service.yaml --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}"
-
kubectl apply -f ingress.yaml --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}"
-
INGRESS_MANIFEST=$(sed -e "s,{{static-ip-name}},${STATIC_IP},g" ./ingress.yaml.tmpl)
-
echo "${INGRESS_MANIFEST}" | kubectl apply --namespace "${ENVIRONMENT_NAME}-${K8S_NAMESPACE}" --filename -
This diff is collapsed.
Click to expand it.
k8s-manifests/ingress.yaml
→
k8s-manifests/ingress.yaml
.tmpl
+
1
−
1
View file @
543f826e
...
...
@@ -5,7 +5,7 @@ metadata:
annotations:
kubernetes.io/ingress.class: "gce" # an external load-balancer
kubernetes.io/ingress.allow-http: "false" # disabling HTTP
kubernetes.io/ingress.global-static-ip-name
:
todoapp-ip
# staging-todoapp-ip for staging
kubernetes.io/ingress.global-static-ip-name:
{{static-ip-name}}
# staging-todoapp-ip for staging
networking.gke.io/managed-certificates: todoapp-managed-cert # defined in the infrastructure repository
spec:
# rules:
...
...
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