Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
W
webservice
Manage
Activity
Members
Labels
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Package registry
Container Registry
Model registry
Operate
Terraform modules
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
ludo8147
webservice
Commits
2b0cc86b
Commit
2b0cc86b
authored
7 months ago
by
ludo8147
Browse files
Options
Downloads
Patches
Plain Diff
local
parent
cd0a17a8
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.gitlab-ci.yml
+11
-23
11 additions, 23 deletions
.gitlab-ci.yml
deployment.yaml
+1
-0
1 addition, 0 deletions
deployment.yaml
with
12 additions
and
23 deletions
.gitlab-ci.yml
+
11
−
23
View file @
2b0cc86b
...
...
@@ -81,9 +81,14 @@ job_upload:
.deploy_template
:
&deploy_definition
stage
:
deploy
image
:
name
:
bitnami/kubectl:latest
entrypoint
:
[
"
"
]
image
:
bitnami/kubectl:latest
before_script
:
-
mkdir -p $HOME/.kube
-
cp $KUBECONFIG $HOME/.kube/config
-
chmod 400 $HOME/.kube/config
-
minikube status || minikube start
-
eval $(minikube docker-env)
-
docker build -t ${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA} .
script
:
-
|
echo "Validating Kubernetes manifests..."
...
...
@@ -98,9 +103,9 @@ job_upload:
-e "s/\${CI_REGISTRY_IMAGE}/$CI_REGISTRY_IMAGE/g" \
-e "s/\${CI_COMMIT_SHA}/$CI_COMMIT_SHA/g" \
-e "s/\${DB_PASSWORD}/$DB_PASSWORD/g" \
$file | kubectl apply
--dry-run=client
-f - -n $KUBE_NAMESPACE
$file | kubectl apply -f - -n $KUBE_NAMESPACE
done
echo "
All manifests are valid
."
echo "
Deployment complete
."
deploy_to_staging
:
<<
:
*deploy_definition
...
...
@@ -129,21 +134,4 @@ deploy_to_production:
INGRESS_HOST
:
"
webservice.example.com"
only
:
-
main
when
:
manual
rollback
:
stage
:
deploy
image
:
name
:
bitnami/kubectl:latest
entrypoint
:
[
"
"
]
script
:
-
|
echo "Simulating rollback..."
echo "In a real environment, we would run:"
echo "kubectl rollout undo deployment/webservice -n $KUBE_NAMESPACE"
echo "Rollback simulation complete."
when
:
manual
environment
:
name
:
staging
variables
:
KUBE_NAMESPACE
:
${CI_ENVIRONMENT_SLUG}
\ No newline at end of file
when
:
manual
\ No newline at end of file
This diff is collapsed.
Click to expand it.
deployment.yaml
+
1
−
0
View file @
2b0cc86b
...
...
@@ -40,6 +40,7 @@ spec:
containers
:
-
name
:
webservice
image
:
${CI_REGISTRY_IMAGE}:${CI_COMMIT_SHA}
imagePullPolicy
:
Never
ports
:
-
containerPort
:
8080
env
:
...
...
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