From 25ca12cb0f8467638be238881e433b0cb170b5ef Mon Sep 17 00:00:00 2001 From: Joseph Mulloy Date: Wed, 20 Sep 2023 10:19:40 -0400 Subject: [PATCH] wip --- scripts/configure_gocd_elastic_agents.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/scripts/configure_gocd_elastic_agents.py b/scripts/configure_gocd_elastic_agents.py index 5221d771..a1f15070 100755 --- a/scripts/configure_gocd_elastic_agents.py +++ b/scripts/configure_gocd_elastic_agents.py @@ -58,6 +58,8 @@ def update_image_in_elastic_profile(host, token, profile_id, new_pod_config, app pod_configuration = elastic_profile['properties'][pod_configuration_index] pod_configuration_value = pod_configuration['value'] + logging.info("New pod configuration for {profile_id}") + print("new_pod_config") logging.info("Diff of old and new pod configuration") print_diff(pod_configuration_value, new_pod_config, f"existing_pod_configuration {profile_id}", f"new_pod_configuration {profile_id}") @@ -73,8 +75,9 @@ def update_image_in_elastic_profile(host, token, profile_id, new_pod_config, app @click.command() @click.option('--host', help='gocd hostname without protocol eg gocd.tools.edx.org', required=True) @click.option('--token', help='gocd auth token', required=True) -@click.option('--agent-tag', help='new tag of the image to replace', required=True) -@click.option('--profile-id', help='new tag of the image to replace', required=True, multiple=True) +@click.option('--agent-tag', help='docker image tag of the newly built image to deploy', required=True) +@click.option('--profile-id', required=True, multiple=True, + help='elastic agent profile to update, mutliple can be specified') @click.option('--image-name', help='Container image name', default='go-agent') @click.option('--namespace', help='Kubernetes namespace of the gocd server', default='gocd') @click.option('--templates-dir', help='Directory holding Jinja2 template files for pod configuration', required=True) @@ -90,7 +93,6 @@ def configure_gocd_agents(token, host, agent_tag, profile_id, namespace, image_n loader=jinja2.FileSystemLoader(templates_dir) ) j2_template = j2_environment.get_template(f"{profile_id}.yaml.j2") - #print(j2_template.render(image=image, tag=tag)) new_pod_config = j2_template.render(agent_tag=agent_tag, namespace=namespace, image_name=image_name) try: logging.info(f"Updating agent profile {profile_id} with agent image tag {agent_tag}")