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
Loading
Loading
Loading
Loading

src/gitlab-ci.yml_generator.py

100644 → 100755
+4 −3
Original line number Diff line number Diff line
@@ -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))