Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
controller
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Code review analytics
Issue analytics
Insights
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
TFS
controller
Commits
ec6a0998
Commit
ec6a0998
authored
3 years ago
by
Sergio Gonzalez Diaz
Browse files
Options
Downloads
Patches
Plain Diff
Update gitlab-ci.yml_generator.py
parent
2fc71559
No related branches found
No related tags found
1 merge request
!54
Release 2.0.0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/gitlab-ci.yml_generator.py
+46
-8
46 additions, 8 deletions
src/gitlab-ci.yml_generator.py
with
46 additions
and
8 deletions
src/gitlab-ci.yml_generator.py
+
46
−
8
View file @
ec6a0998
...
@@ -116,7 +116,7 @@ test {microservice} pytest:
...
@@ -116,7 +116,7 @@ test {microservice} pytest:
reports:
reports:
junit: src/$IMAGE_NAME/tests/report.xml
junit: src/$IMAGE_NAME/tests/report.xml
# Deployment of the {microservice} service in Kubernetes Cluster
# Deployment of the {microservice} service in
development
Kubernetes Cluster
deploy {microservice} development:
deploy {microservice} development:
variables:
variables:
IMAGE_NAME:
'
{microservice}
'
# name of the microservice
IMAGE_NAME:
'
{microservice}
'
# name of the microservice
...
@@ -126,19 +126,57 @@ deploy {microservice} development:
...
@@ -126,19 +126,57 @@ deploy {microservice} development:
- build {microservice}
- build {microservice}
- test {microservice} run
- test {microservice} run
script:
script:
-
'
sed -i
"
s/image: .*/image: $CI_REGISTRY\/$CI_PROJECT_NAMESPACE\/$CI_PROJECT_NAME\/$IMAGE_NAME:$IMAGE_TAG/
"
manifests/$IMAGE_NAME.yaml
'
- kubectl version
- kubectl version
- kubectl get all
- kubectl get all
- kubectl apply -f
"
manifests/$IMAGE_NAME.yaml
"
- kubectl apply -f
"
manifests/$IMAGE_NAME.yaml
"
- kubectl get all
- kubectl get all
# environment:
# name: development
# url: https://example.com
# kubernetes:
# namespace: development
rules:
rules:
- changes:
- if:
'
$CI_PIPELINE_SOURCE ==
"
merge_request_event
"
&& $CI_MERGE_REQUEST_TARGET_BRANCH_NAME ==
"
develop
"'
- src/$IMAGE_NAME/*.{py,in,yml}
when: manual
- src/$IMAGE_NAME/Dockerfile
changes:
- src/$IMAGE_NAME/tests/*.py
- src/$IMAGE_NAME/*.{{py,in,yml}}
- src/$IMAGE_NAME/tests/Dockerfile
- src/$IMAGE_NAME/Dockerfile
- manifests/$IMAGE_NAME.yaml
- src/$IMAGE_NAME/tests/*.py
- .gitlab-ci.yml
- src/$IMAGE_NAME/tests/Dockerfile
- manifests/$IMAGE_NAME.yaml
- .gitlab-ci.yml
# Deployment of the {microservice} service in production Kubernetes Cluster
deploy {microservice} development:
variables:
IMAGE_NAME:
'
{microservice}
'
# name of the microservice
IMAGE_TAG:
'
{tag}
'
# tag of the container image (production, development, etc)
stage: deploy
needs:
- build {microservice}
- test {microservice} run
script:
-
'
sed -i
"
s/image: .*/image: $CI_REGISTRY\/$CI_PROJECT_NAMESPACE\/$CI_PROJECT_NAME\/$IMAGE_NAME:$IMAGE_TAG/
"
manifests/$IMAGE_NAME.yaml
'
- kubectl version
- kubectl get all
- kubectl apply -f
"
manifests/$IMAGE_NAME.yaml
"
- kubectl get all
# environment:
# name: production
# url: https://example.com
# kubernetes:
# namespace: production
rules:
- if:
'
$CI_PIPELINE_SOURCE ==
"
merge_request_event
"
&& $CI_MERGE_REQUEST_TARGET_BRANCH_NAME == $CI_DEFAULT_BRANCH
'
when: manual
when: manual
changes:
- src/$IMAGE_NAME/*.{{py,in,yml}}
- src/$IMAGE_NAME/Dockerfile
- src/$IMAGE_NAME/tests/*.py
- src/$IMAGE_NAME/tests/Dockerfile
- manifests/$IMAGE_NAME.yaml
- .gitlab-ci.yml
"""
"""
f
.
write
(
yml_template
.
format
(
microservice
=
args
.
microservice
,
tag
=
args
.
tag
))
f
.
write
(
yml_template
.
format
(
microservice
=
args
.
microservice
,
tag
=
args
.
tag
))
print
(
"
File created in the following path: {file}
"
.
format
(
file
=
file
))
print
(
"
File created in the following path: {file}
"
.
format
(
file
=
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