From within a macro is there a way to get the rela...
# general
g
From within a macro is there a way to get the relative path of the BUILD file that's using the macro?
1
For more context, I want to make the
root_output_directory
argument dynamic
Copy code
def pulumi_plugin(plugin_name: str, plugin_version: str, **kwargs):
    adhoc_tool(
        name=f"pulumi_plugin_{plugin_name}",
        runnable=":pulumi",
        args=["plugin", "install", "resource", plugin_name, plugin_version],
        extra_env_vars=["PULUMI_HOME=pulumi"],
        output_directories=["pulumi/"],
        root_output_directory="/path/to/dir/with/BUILD",
    )

    archive(
        name=f"pulumi_plugin_archive_{plugin_name}",
        format="tar.gz",
        files=[f":pulumi_plugin_{plugin_name}"],
    )
build_file_dir()
?
👍 1
This worked
Copy code
def pulumi_plugin(plugin_name: str, plugin_version: str, **kwargs):
    adhoc_tool(
        name=f"pulumi_plugin_{plugin_name}",
        runnable=":pulumi",
        args=["plugin", "install", "resource", plugin_name, plugin_version],
        extra_env_vars=["PULUMI_HOME=pulumi"],
        output_directories=["pulumi/"],
        root_output_directory=f"/{build_file_dir()}",
    )

    archive(
        name=f"pulumi_plugin_archive_{plugin_name}",
        format="tar.gz",
        files=[f":pulumi_plugin_{plugin_name}"],
    )