Skip to content
Snippets Groups Projects
Commit 03785960 authored by Sergio Gonzalez Diaz's avatar Sergio Gonzalez Diaz
Browse files

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!54Release 2.0.0
...@@ -2,13 +2,15 @@ ...@@ -2,13 +2,15 @@
import argparse import argparse
import os.path import os.path
# Parse the arguments
parser = argparse.ArgumentParser(description='Generate .gitlab-cy.yml template for a TeraFlow microservice.') 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("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) parser.add_argument("-t", "--tag", help="tag of the microservice Docker container", type=str, default='latest', required=False)
args = parser.parse_args() args = parser.parse_args()
# Check if the file and the path already exists
path="./{microservice}".format(microservice = args.microservice) path="./{microservice}".format(microservice = args.microservice)
file="{path}/.gitlab-ci.yml".format(path = path) file="{path}/.gitlab-ci.yml".format(path = path)
if(os.path.isfile(file)): if(os.path.isfile(file)):
if input("File already exists, do you want to overwrite? (y/n) ") != "y": if input("File already exists, do you want to overwrite? (y/n) ") != "y":
exit() exit()
...@@ -20,6 +22,7 @@ if(os.path.lexists(path)!= True): ...@@ -20,6 +22,7 @@ if(os.path.lexists(path)!= True):
else: else:
print ("Successfully created the directory %s " % path) print ("Successfully created the directory %s " % path)
# Create the gitlab-ci.yml template file
f=open(file,"w+") f=open(file,"w+")
yml_template = """ yml_template = """
# build, tag and push the Docker image to the gitlab registry # build, tag and push the Docker image to the gitlab registry
...@@ -129,7 +132,5 @@ deploy {microservice} development: ...@@ -129,7 +132,5 @@ deploy {microservice} development:
- kubectl get all - kubectl get all
when: manual when: manual
""" """
#print(yml_text.format(microservice = args.microservice, tag=args.tag))
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))
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment