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
03785960
Commit
03785960
authored
3 years ago
by
Sergio Gonzalez Diaz
Browse files
Options
Downloads
Patches
Plain Diff
Update the gitlab-ci.yml_generator.py file
Update the gitlab-ci.yml_generator.py file
parent
b9fdbf13
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
+4
-3
4 additions, 3 deletions
src/gitlab-ci.yml_generator.py
with
4 additions
and
3 deletions
src/gitlab-ci.yml_generator.py
100644 → 100755
+
4
−
3
View file @
03785960
...
...
@@ -2,13 +2,15 @@
import
argparse
import
os.path
# Parse the arguments
parser
=
argparse
.
ArgumentParser
(
description
=
'
Generate .gitlab-cy.yml template for a TeraFlow microservice.
'
)
parser
.
add_argument
(
"
microservice
"
,
help
=
"
name of your microservice
"
,
type
=
str
)
parser
.
add_argument
(
"
-t
"
,
"
--tag
"
,
help
=
"
tag of the microservice Docker container
"
,
type
=
str
,
default
=
'
latest
'
,
required
=
False
)
args
=
parser
.
parse_args
()
# Check if the file and the path already exists
path
=
"
./{microservice}
"
.
format
(
microservice
=
args
.
microservice
)
file
=
"
{path}/.gitlab-ci.yml
"
.
format
(
path
=
path
)
if
(
os
.
path
.
isfile
(
file
)):
if
input
(
"
File already exists, do you want to overwrite? (y/n)
"
)
!=
"
y
"
:
exit
()
...
...
@@ -20,6 +22,7 @@ if(os.path.lexists(path)!= True):
else
:
print
(
"
Successfully created the directory %s
"
%
path
)
# Create the gitlab-ci.yml template file
f
=
open
(
file
,
"
w+
"
)
yml_template
=
"""
# build, tag and push the Docker image to the gitlab registry
...
...
@@ -129,7 +132,5 @@ deploy {microservice} development:
- kubectl get all
when: manual
"""
#print(yml_text.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
))
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