Skip to content

Commit

Permalink
refactor
Browse files Browse the repository at this point in the history
docs

fix toolchain

implement containers/auth.json

implement anonymous auth
  • Loading branch information
thesayyn committed Mar 24, 2023
1 parent f1f81e3 commit 3c933c4
Show file tree
Hide file tree
Showing 7 changed files with 285 additions and 203 deletions.
4 changes: 2 additions & 2 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -116,9 +116,9 @@ new_local_repository(

oci_pull(
name = "thesayyn_debian",
image = "index.docker.io/thesayyn/debian",
image = "index.docker.io/library/debian",
platforms = ["linux/arm64"],
# Don't make a distroless_python_unpinned repo and print a warning about the tag
reproducible = False,
tag = "oci",
tag = "latest",
)
35 changes: 11 additions & 24 deletions docs/pull.md
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,8 @@ oci_image(
## oci_alias

<pre>
oci_alias(<a href="#oci_alias-name">name</a>, <a href="#oci_alias-platforms">platforms</a>, <a href="#oci_alias-repo_mapping">repo_mapping</a>)
oci_alias(<a href="#oci_alias-name">name</a>, <a href="#oci_alias-identifier">identifier</a>, <a href="#oci_alias-image">image</a>, <a href="#oci_alias-platforms">platforms</a>, <a href="#oci_alias-repo_mapping">repo_mapping</a>, <a href="#oci_alias-reproducible">reproducible</a>, <a href="#oci_alias-single_platform">single_platform</a>,
<a href="#oci_alias-toolchain_name">toolchain_name</a>)
</pre>


Expand All @@ -54,16 +55,21 @@ oci_alias(<a href="#oci_alias-name">name</a>, <a href="#oci_alias-platforms">pla
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="oci_alias-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="oci_alias-identifier"></a>identifier | - | String | optional | "" |
| <a id="oci_alias-image"></a>image | The name of the image we are fetching, e.g. gcr.io/distroless/static | String | required | |
| <a id="oci_alias-platforms"></a>platforms | - | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: Label -> String</a> | optional | {} |
| <a id="oci_alias-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
| <a id="oci_alias-reproducible"></a>reproducible | Set to False to silence the warning about reproducibility when using <code>tag</code> | Boolean | optional | True |
| <a id="oci_alias-single_platform"></a>single_platform | - | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
| <a id="oci_alias-toolchain_name"></a>toolchain_name | Value of name attribute to the oci_register_toolchains call in the workspace. | String | optional | "oci" |


<a id="#oci_pull_rule"></a>

## oci_pull_rule

<pre>
oci_pull_rule(<a href="#oci_pull_rule-name">name</a>, <a href="#oci_pull_rule-identifier">identifier</a>, <a href="#oci_pull_rule-image">image</a>, <a href="#oci_pull_rule-platform">platform</a>, <a href="#oci_pull_rule-repo_mapping">repo_mapping</a>)
oci_pull_rule(<a href="#oci_pull_rule-name">name</a>, <a href="#oci_pull_rule-identifier">identifier</a>, <a href="#oci_pull_rule-image">image</a>, <a href="#oci_pull_rule-platform">platform</a>, <a href="#oci_pull_rule-repo_mapping">repo_mapping</a>, <a href="#oci_pull_rule-toolchain_name">toolchain_name</a>)
</pre>


Expand All @@ -78,35 +84,15 @@ oci_pull_rule(<a href="#oci_pull_rule-name">name</a>, <a href="#oci_pull_rule-id
| <a id="oci_pull_rule-image"></a>image | The name of the image we are fetching, e.g. gcr.io/distroless/static | String | required | |
| <a id="oci_pull_rule-platform"></a>platform | platform in <code>os/arch</code> format, for multi-arch images | String | optional | "" |
| <a id="oci_pull_rule-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |


<a id="#pin_tag"></a>

## pin_tag

<pre>
pin_tag(<a href="#pin_tag-name">name</a>, <a href="#pin_tag-image">image</a>, <a href="#pin_tag-repo_mapping">repo_mapping</a>, <a href="#pin_tag-tag">tag</a>)
</pre>



**ATTRIBUTES**


| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="pin_tag-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
| <a id="pin_tag-image"></a>image | The name of the image we are fetching, e.g. <code>gcr.io/distroless/static</code> | String | required | |
| <a id="pin_tag-repo_mapping"></a>repo_mapping | A dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.&lt;p&gt;For example, an entry <code>"@foo": "@bar"</code> declares that, for any time this repository depends on <code>@foo</code> (such as a dependency on <code>@foo//some:target</code>, it should actually resolve that dependency within globally-declared <code>@bar</code> (<code>@bar//some:target</code>). | <a href="https://bazel.build/docs/skylark/lib/dict.html">Dictionary: String -> String</a> | required | |
| <a id="pin_tag-tag"></a>tag | The tag being used, e.g. <code>latest</code> | String | required | |
| <a id="oci_pull_rule-toolchain_name"></a>toolchain_name | Value of name attribute to the oci_register_toolchains call in the workspace. | String | optional | "oci" |


<a id="#oci_pull"></a>

## oci_pull

<pre>
oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-image">image</a>, <a href="#oci_pull-platforms">platforms</a>, <a href="#oci_pull-digest">digest</a>, <a href="#oci_pull-tag">tag</a>, <a href="#oci_pull-reproducible">reproducible</a>)
oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-image">image</a>, <a href="#oci_pull-platforms">platforms</a>, <a href="#oci_pull-digest">digest</a>, <a href="#oci_pull-tag">tag</a>, <a href="#oci_pull-reproducible">reproducible</a>, <a href="#oci_pull-toolchain_name">toolchain_name</a>)
</pre>

Repository macro to fetch image manifest data from a remote docker registry.
Expand All @@ -122,5 +108,6 @@ Repository macro to fetch image manifest data from a remote docker registry.
| <a id="oci_pull-digest"></a>digest | the digest string, starting with "sha256:", "sha512:", etc. If omitted, instructions for pinning are provided. | <code>None</code> |
| <a id="oci_pull-tag"></a>tag | a tag to choose an image from the registry. Exactly one of <code>tag</code> and <code>digest</code> must be set. Since tags are mutable, this is not reproducible, so a warning is printed. | <code>None</code> |
| <a id="oci_pull-reproducible"></a>reproducible | Set to False to silence the warning about reproducibility when using <code>tag</code>. | <code>True</code> |
| <a id="oci_pull-toolchain_name"></a>toolchain_name | Value of name attribute to the oci_register_toolchains call in the workspace. | <code>"oci"</code> |


5 changes: 4 additions & 1 deletion oci/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,10 @@ bzl_library(
name = "pull",
srcs = ["pull.bzl"],
visibility = ["//visibility:public"],
deps = ["@aspect_bazel_lib//lib:paths"],
deps = [
"@aspect_bazel_lib//lib:base64",
"@aspect_bazel_lib//lib:repo_utils",
],
)

bzl_library(
Expand Down
6 changes: 3 additions & 3 deletions oci/private/toolchains_repo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ with only the toolchain attribute pointing into the platform-specific repositori
# Add more platforms as needed to mirror all the binaries
# published by the upstream project.
PLATFORMS = {
"darwin_x86_64": struct(
"darwin_amd64": struct(
compatible_with = [
"@platforms//os:macos",
"@platforms//cpu:x86_64",
Expand Down Expand Up @@ -56,7 +56,7 @@ PLATFORMS = {
"@platforms//cpu:s390x",
],
),
"linux_x86_64": struct(
"linux_amd64": struct(
compatible_with = [
"@platforms//os:linux",
"@platforms//cpu:x86_64",
Expand All @@ -68,7 +68,7 @@ PLATFORMS = {
"@platforms//cpu:arm64",
],
),
"windows_x86_64": struct(
"windows_amd64": struct(
compatible_with = [
"@platforms//os:windows",
"@platforms//cpu:x86_64",
Expand Down
Loading

0 comments on commit 3c933c4

Please sign in to comment.