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 #489

Merged
merged 3 commits into from
May 24, 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
16 changes: 16 additions & 0 deletions infra/spawn_data_pipeline.py
Original file line number Diff line number Diff line change
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,20 @@ def main():

payload["dependencies"] = new_dependencies

# Override the Docker image tag if needed
if docker_tag:
base_image = payload["payload"]["image"]
splitted_image = base_image.rsplit(":", 1)

if len(splitted_image) > 1:
err_msg = "Docker tag should be None or 'latest', not {!r}"
assert splitted_image[1] == "latest", err_msg.format(splitted_image[1])

tagless_image = splitted_image[0]

new_image = "{}:{}".format(tagless_image, docker_tag)
payload["payload"]["image"] = new_image

tasks.append((task_id, payload))

# Now sends them
Expand Down