Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
MetaGer
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor 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
open-source
MetaGer
Commits
eee6348e
Commit
eee6348e
authored
2 years ago
by
Dominik Hebeler
Browse files
Options
Downloads
Patches
Plain Diff
fixed deployment not stopping for review
parent
242076f6
No related branches found
No related tags found
No related merge requests found
Changes
3
Pipelines
2
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
.gitlab/ci/build_docker_images.yml
+10
-10
10 additions, 10 deletions
.gitlab/ci/build_docker_images.yml
.gitlab/ci/deploy.yml
+4
-11
4 additions, 11 deletions
.gitlab/ci/deploy.yml
.gitlab/deployment_scripts/delete_deployment.sh
+13
-0
13 additions, 0 deletions
.gitlab/deployment_scripts/delete_deployment.sh
with
27 additions
and
21 deletions
.gitlab/ci/build_docker_images.yml
+
10
−
10
View file @
eee6348e
...
@@ -10,9 +10,9 @@ fpm:
...
@@ -10,9 +10,9 @@ fpm:
-
echo '!metager/vendor' >> .dockerignore
-
echo '!metager/vendor' >> .dockerignore
script
:
script
:
-
docker build --network=host
-
docker build --network=host
--target=production
--target=production
-f build/fpm/Dockerfile
-f build/fpm/Dockerfile
-t ${CI_REGISTRY_IMAGE}/$DOCKER_FPM_IMAGE_NAME:$DOCKER_FPM_IMAGE_TAG .
-t ${CI_REGISTRY_IMAGE}/$DOCKER_FPM_IMAGE_NAME:$DOCKER_FPM_IMAGE_TAG .
-
docker push ${CI_REGISTRY_IMAGE}/$DOCKER_FPM_IMAGE_NAME:$DOCKER_FPM_IMAGE_TAG
-
docker push ${CI_REGISTRY_IMAGE}/$DOCKER_FPM_IMAGE_NAME:$DOCKER_FPM_IMAGE_TAG
after_script
:
after_script
:
-
docker logout $CI_REGISTRY
-
docker logout $CI_REGISTRY
...
@@ -26,9 +26,9 @@ nginx:
...
@@ -26,9 +26,9 @@ nginx:
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
-
docker login -u $CI_REGISTRY_USER -p $CI_REGISTRY_PASSWORD $CI_REGISTRY
script
:
script
:
-
docker build --network=host
-
docker build --network=host
--target=production
--target=production
-f build/nginx/Dockerfile
-f build/nginx/Dockerfile
-t ${CI_REGISTRY_IMAGE}/$DOCKER_NGINX_IMAGE_NAME:$DOCKER_NGINX_IMAGE_TAG .
-t ${CI_REGISTRY_IMAGE}/$DOCKER_NGINX_IMAGE_NAME:$DOCKER_NGINX_IMAGE_TAG .
-
docker push ${CI_REGISTRY_IMAGE}/$DOCKER_NGINX_IMAGE_NAME:$DOCKER_NGINX_IMAGE_TAG
-
docker push ${CI_REGISTRY_IMAGE}/$DOCKER_NGINX_IMAGE_NAME:$DOCKER_NGINX_IMAGE_TAG
after_script
:
after_script
:
-
docker logout $CI_REGISTRY
-
docker logout $CI_REGISTRY
...
@@ -42,8 +42,8 @@ nginx:
...
@@ -42,8 +42,8 @@ nginx:
variables
:
variables
:
FPM_REPOSITORY_ID
:
418
FPM_REPOSITORY_ID
:
418
NGINX_REPOSITORY_ID
:
416
NGINX_REPOSITORY_ID
:
416
NODE_REPOSITORY_ID
:
41
6
NODE_REPOSITORY_ID
:
41
9
KEEP_N
:
9
# Trim to the latest 9 revisions as the 10th will be deleted in the next stage
KEEP_N
:
9
# Trim to the latest 9 revisions as the 10th will be deleted in the next stage
before_script
:
before_script
:
-
chmod go-r $KUBECONFIG
-
chmod go-r $KUBECONFIG
script
:
script
:
...
@@ -61,7 +61,7 @@ cleanup_revision_images_review:
...
@@ -61,7 +61,7 @@ cleanup_revision_images_review:
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
when
:
never
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH
'
-
if
:
"
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH
"
cleanup_revision_images_development
:
cleanup_revision_images_development
:
extends
:
extends
:
...
@@ -85,4 +85,4 @@ cleanup_revision_images_production:
...
@@ -85,4 +85,4 @@ cleanup_revision_images_production:
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
-
if
:
'
$CI_COMMIT_BRANCH
!=
"master"'
when
:
never
when
:
never
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"'
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.gitlab/ci/deploy.yml
+
4
−
11
View file @
eee6348e
...
@@ -59,7 +59,7 @@ deploy_review:
...
@@ -59,7 +59,7 @@ deploy_review:
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
when
:
never
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH
'
-
if
:
"
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH
"
stop_review
:
stop_review
:
stage
:
deploy
stage
:
deploy
...
@@ -69,20 +69,13 @@ stop_review:
...
@@ -69,20 +69,13 @@ stop_review:
action
:
stop
action
:
stop
variables
:
variables
:
DEPLOYMENT_CHART_NAME
:
review-${CI_COMMIT_REF_SLUG}
DEPLOYMENT_CHART_NAME
:
review-${CI_COMMIT_REF_SLUG}
KEEP_N
:
0
# Environment gets deleted. No Image Tags to keep
KEEP_N
:
0
# Environment gets deleted. No Image Tags to keep
FPM_REPOSITORY_ID
:
418
FPM_REPOSITORY_ID
:
418
NGINX_REPOSITORY_ID
:
416
NGINX_REPOSITORY_ID
:
416
script
:
script
:
-
echo "Removing Image Tags..."
-
.gitlab/deployment_scripts/delete_deployment.sh
-
.gitlab/deployment_scripts/cleanup_tags_revision.sh
# For some reason an empty image tag gets created for this. We need to delete it until we find out why that is
-
'
curl
--fail
--silent
-X
DELETE
-H
"JOB-TOKEN:
$CI_JOB_TOKEN"
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/registry/repositories/$FPM_REPOSITORY_ID/tags/$DOCKER_IMAGE_TAG_PREFIX"'
-
'
curl
--fail
--silent
-X
DELETE
-H
"JOB-TOKEN:
$CI_JOB_TOKEN"
"$CI_API_V4_URL/projects/$CI_PROJECT_ID/registry/repositories/$NGINX_REPOSITORY_ID/tags/$DOCKER_IMAGE_TAG_PREFIX"'
-
echo "Stopping Deployment..."
-
kubectl -n $KUBE_NAMESPACE delete secret $CI_COMMIT_REF_SLUG
-
helm -n $KUBE_NAMESPACE delete $DEPLOYMENT_CHART_NAME
when
:
manual
when
:
manual
rules
:
rules
:
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
-
if
:
'
$CI_COMMIT_BRANCH
==
"master"
||
$CI_COMMIT_BRANCH
==
"development"'
when
:
never
when
:
never
-
if
:
'
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH'
-
if
:
"
$CI_COMMIT_TAG
||
$CI_COMMIT_BRANCH"
\ No newline at end of file
This diff is collapsed.
Click to expand it.
.gitlab/deployment_scripts/delete_deployment.sh
0 → 100755
+
13
−
0
View file @
eee6348e
#!/bin/bash
HELM_RELEASE_NAME
=
${
HELM_RELEASE_NAME
:0:53
}
HELM_RELEASE_NAME
=
${
HELM_RELEASE_NAME
%%*(-)
}
echo
"Removing Image Tags..."
.gitlab/deployment_scripts/cleanup_tags_revision.sh
# For some reason an empty image tag gets created for this. We need to delete it until we find out why that is
'curl --fail --silent -X DELETE -H "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/registry/repositories/$FPM_REPOSITORY_ID/tags/$DOCKER_IMAGE_TAG_PREFIX"'
'curl --fail --silent -X DELETE -H "JOB-TOKEN: $CI_JOB_TOKEN" "$CI_API_V4_URL/projects/$CI_PROJECT_ID/registry/repositories/$NGINX_REPOSITORY_ID/tags/$DOCKER_IMAGE_TAG_PREFIX"'
echo
"Stopping Deployment..."
kubectl
-n
$KUBE_NAMESPACE
delete secret
$HELM_RELEASE_NAME
helm
-n
$KUBE_NAMESPACE
delete
$HELM_RELEASE_NAME
\ No newline at end of file
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