diff --git a/src/gitlab-ci.yml_generator.py b/src/gitlab-ci.yml_generator.py old mode 100644 new mode 100755 index 6a78959cf25f974b94019adbb0410870e03b8a57..9a66695860de1caf4b1197c9a31471b3e7dfd41e --- a/src/gitlab-ci.yml_generator.py +++ b/src/gitlab-ci.yml_generator.py @@ -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))