many-sunset-44245
03/21/2025, 7:31 AMgorgeous-winter-99296
03/21/2025, 9:03 PMmany-sunset-44245
03/21/2025, 10:53 PMgorgeous-winter-99296
03/22/2025, 10:51 AMmany-sunset-44245
03/22/2025, 10:53 AMgorgeous-winter-99296
03/22/2025, 10:57 AMvalues={"image": "my/docker:target"}? Would a viable solution be to just depend on the remote tag directly?gorgeous-winter-99296
03/22/2025, 10:57 AMmany-sunset-44245
03/22/2025, 10:58 AMmany-sunset-44245
03/23/2025, 12:43 PMgorgeous-winter-99296
03/23/2025, 5:54 PMenv to read values from the environment. I tend to wrap this up in a macro, f.ex.:
def tag_from_branch():
bk_branch = env("BUILDKITE_BRANCH")
if bk_branch in ["main", None]:
return "latest"
out = [None] * len(bk_branch)
for idx, c in enumerate(bk_branch):
if "a" <= c <= "z" or "A" <= c <= "Z" or "0" <= c <= "9":
out[idx] = c
else:
out[idx] = "-"
return "".join(out)
And then I use this macro in my build file, in this case on a tag field like so: tag=tag_from_branch(),.