Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for specific Docker tag in spawn_data_pipeline.py #553

Merged
merged 3 commits into from Jun 6, 2019
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
26 changes: 26 additions & 0 deletions infra/spawn_data_pipeline.py
Expand Up @@ -69,6 +69,8 @@ def main():

id_mapping = {}

docker_tag = os.getenv("TAG", None)

# First pass, do the template rendering and dependencies resolution
tasks = []

Expand Down Expand Up @@ -105,6 +107,30 @@ def main():

payload["dependencies"] = new_dependencies

# Override the Docker image tag if needed
if docker_tag:
base_image = payload["payload"]["image"]

if base_image.startswith("mozilla/bugbug"):
splitted_image = base_image.rsplit(":", 1)

# If we have already a Docker tag
if len(splitted_image) > 1:
docker_tag = splitted_image

if docker_tag != "latest":
msg = (
"Don't update image {} for task {} as it already has a tag"
)
print(msg.format(base_image, task_internal_id))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: you could use a f-string here...


tagless_image = splitted_image[0]

new_image = "{}:{}".format(tagless_image, docker_tag)
msg = "Updating image for task {} to {}"
print(msg.format(task_internal_id, new_image))
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

...and here.

payload["payload"]["image"] = new_image

tasks.append((task_id, payload))

# Now sends them
Expand Down