From 037859602feda1682c48af6694e62b23945d031d Mon Sep 17 00:00:00 2001 From: Sergio <sergio.gonzalez.diaz@atos.net> Date: Thu, 19 Aug 2021 15:03:38 +0200 Subject: [PATCH] Update the gitlab-ci.yml_generator.py file Update the gitlab-ci.yml_generator.py file --- src/gitlab-ci.yml_generator.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) mode change 100644 => 100755 src/gitlab-ci.yml_generator.py diff --git a/src/gitlab-ci.yml_generator.py b/src/gitlab-ci.yml_generator.py old mode 100644 new mode 100755 index 6a78959cf..9a6669586 --- 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)) -- GitLab