Open scriptnull opened 4 years ago
No, not at present. However, we have command line arguments for things like the commit message. We are considering to add support for custom flags in starlark, but this is still in motion.
Cheers, H
On Sat, Oct 24, 2020, 4:40 PM Vishnu Bharathi notifications@github.com wrote:
Let us say that we have some information (like the commit header) in a environment variable of the system in which copybara runs (say COMMIT_MESSAGE_ENV)
Is it possible to refer to that environment variable in the metadata transformations.
core.workflow( name = "default", origin = git.github_pr_origin( .... ),
destination = git.github_pr_destination( .... ),
....
transformations = [ metadata.add_header("COMMIT_MESSAGE_ENV should be present here"), ],
)
Currently, we are able to refer only the implicit labels like GITHUB_PR_NUMBER. But I wonder if there is a way to reference just the environment variables inside the copy.bara.sky file.
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/google/copybara/issues/142, or unsubscribe https://github.com/notifications/unsubscribe-auth/AFKR2H6ITABZWZE7OAVKROTSMM3TBANCNFSM4S52PTPQ .
@hsudhof Is there any other more general way to parameterize the workflows? Whether by environment variables, CLI arguments, or even input files.
Currently we dynamically generate copy.bara.sky files - is this the current recommended approach?
No, we don't recommend to dynamically generate copybara files. Instead you should write a parameterized library and then create as many instances of workflows as needed. e.g.
copy.bara.sky:
def my_workflow(name, url, ...):
core.workflow(
name = name,
url = url,
...
)
my_workflow("foo1", "https://github.com/aaa/foo1")
my_workflow("foo2", "https://github.com/aaa/foo2")
my_workflow("foo3", "https://github.com/aaa/foo3")
my_workflow("foo4", "https://github.com/aaa/foo4")
my_workflow("foo5", "https://github.com/aaa/foo5")
Let us say that we have some information (like the commit header) in a environment variable of the system in which copybara runs (say
COMMIT_MESSAGE_ENV
)Is it possible to refer to that environment variable in the metadata transformations.
Currently, we are able to refer only the implicit labels like
GITHUB_PR_NUMBER
. But I wonder if there is a way to reference just the environment variables inside the copy.bara.sky file.