Skip to content
This repository has been archived by the owner on Mar 12, 2024. It is now read-only.

Commit

Permalink
wip
Browse files Browse the repository at this point in the history
  • Loading branch information
jdmulloy committed Sep 20, 2023
1 parent a85b6c0 commit 25ca12c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions scripts/configure_gocd_elastic_agents.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}")

Expand All @@ -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)
Expand All @@ -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}")
Expand Down

0 comments on commit 25ca12c

Please sign in to comment.