Skip to content

Latest commit

 

History

History
133 lines (113 loc) · 2.77 KB

az_storage.md

File metadata and controls

133 lines (113 loc) · 2.77 KB

az_storage

az_storage(
    name,
    config,
    account_name,
    container_name,
    srcs
)

A rule for setting basic properties for other rules.

Attributes
name

Name, required

Unique name for this rule.

config

Label, required

Label of az_config target.

account_name

String, required

Storage account name.

This field supports stamp variables.

container_name

String, required

Container name to copy or remove sources.

This field supports stamp variables.

srcs

Label keyed String Dict, required

The list of targets that have a file to be copy or removed from a Container.

The path to the file in the storage account will be the target value defined in the dictionary.

Examples

load("@rules_microsoft_azure//az:defs.bzl", "az_config", "az_storage")

genrule(
    name = "generate",
    outs = [
        "generated1.txt",
        "generated2.txt",
    ],
    cmd = """
echo -e 'This is a file generated by a genrule rule and will be copied to a blobstorage.' > $(location generated1.txt);
echo -e 'This is a file generated by a genrule rule and will be copied to a blobstorage.' > $(location generated2.txt);
""",
    visibility = ["//visibility:public"],
)

az_config(
    name = "config",
    debug = True,
    subscription = "dev",
    verbose = True,
)

az_storage(
    name = "foo",
    srcs = {
        ":generate": "path/to/container/",
    },
    account_name = "bar",
    config = ":config",
    container_name = "baz",
)

Usage

The az_storage rules expose a collection of actions. We will follow the :foo target from the example above.

Resolve

Users can obtain information about the artifacts by running:

bazel run :foo

The data will be printed on STDOUT.

Copy

Users can copy objects to a container by running:

bazel run :foo.copy

Remove

Users can remove objects from a container by running:

bazel run :foo.remove