Skip to content

Commit

Permalink
[EEESUPPORT-11240] Add logging and retries to pull_cmd (#62)
Browse files Browse the repository at this point in the history
* Add debugging to pull_cmd; in particular, inject logger into context for use further down the stack
* Bump gazelle module to 0.38.0 in bazel and go
* Add patch to support logging and retries for pull_cmd manifests
  • Loading branch information
guyboltonking authored Aug 26, 2024
1 parent b1d616f commit 7fcb47e
Show file tree
Hide file tree
Showing 11 changed files with 328 additions and 29 deletions.
25 changes: 23 additions & 2 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ module(
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3")
bazel_dep(name = "bazel_skylib", version = "1.6.1")
bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.6.1")
bazel_dep(name = "gazelle", version = "0.36.0")
bazel_dep(name = "gazelle", version = "0.38.0")
bazel_dep(name = "rules_go", version = "0.47.1")
bazel_dep(name = "rules_pkg", version = "0.10.1")
bazel_dep(name = "stardoc", version = "0.6.2")
Expand All @@ -23,18 +23,39 @@ go_deps.from_file(go_mod = "//:go.mod")

use_repo(
go_deps,
#"com_github_bazelbuild_bazel_gazelle",
"com_github_blakesmith_ar",
"com_github_containerd_containerd",
"com_github_containerd_containerd_api",
"com_github_containerd_continuity",
"com_github_containerd_errdefs",
"com_github_containerd_fifo",
"com_github_containerd_log",
"com_github_containerd_platforms",
"com_github_containerd_typeurl_v2",
"com_github_docker_docker_credential_helpers",
"com_github_klauspost_compress",
"com_github_microsoft_go_winio",
"com_github_microsoft_hcsshim",
"com_github_mitchellh_go_homedir",
"com_github_moby_sys_sequential",
"com_github_opencontainers_go_digest",
"com_github_opencontainers_image_spec",
"com_github_opencontainers_runtime_spec",
"com_github_sirupsen_logrus",
"com_github_stretchr_testify",
"com_github_urfave_cli_v2",
"land_oras_oras_go",
"org_golang_google_grpc",
"org_golang_x_sync",
"org_golang_x_sys",
)

go_deps.module_override(
patch_strip = 1,
patches = [
"//third_party/com_github_containerd_containerd:EEESUPPORT-11240-logging-and-retries-for-oci-pull.patch",
],
path = "github.com/containerd/containerd",
)

oci_pull = use_repo_rule("//oci:defs.bzl", "oci_pull")
Expand Down
4 changes: 3 additions & 1 deletion MODULE.bazel.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 2 additions & 1 deletion docs/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ Pushes a manifest or a list of manifests to an OCI registry.
## oci_pull

<pre>
oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-digest">digest</a>, <a href="#oci_pull-registry">registry</a>, <a href="#oci_pull-repo_mapping">repo_mapping</a>, <a href="#oci_pull-repository">repository</a>, <a href="#oci_pull-shallow">shallow</a>)
oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-debug">debug</a>, <a href="#oci_pull-digest">digest</a>, <a href="#oci_pull-registry">registry</a>, <a href="#oci_pull-repo_mapping">repo_mapping</a>, <a href="#oci_pull-repository">repository</a>, <a href="#oci_pull-shallow">shallow</a>)
</pre>

**ATTRIBUTES**
Expand All @@ -111,6 +111,7 @@ oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-digest">digest</a
| Name | Description | Type | Mandatory | Default |
| :------------- | :------------- | :------------- | :------------- | :------------- |
| <a id="oci_pull-name"></a>name | A unique name for this repository. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
| <a id="oci_pull-debug"></a>debug | Enable ocitool debug output | Boolean | optional | `False` |
| <a id="oci_pull-digest"></a>digest | - | String | required | |
| <a id="oci_pull-registry"></a>registry | - | String | required | |
| <a id="oci_pull-repo_mapping"></a>repo_mapping | In `WORKSPACE` context only: a dictionary from local repository name to global repository name. This allows controls over workspace dependency resolution for dependencies of this repository.<br><br>For example, an entry `"@foo": "@bar"` declares that, for any time this repository depends on `@foo` (such as a dependency on `@foo//some:target`, it should actually resolve that dependency within globally-declared `@bar` (`@bar//some:target`).<br><br>This attribute is _not_ supported in `MODULE.bazel` context (when invoking a repository rule inside a module extension's implementation function). | <a href="https://bazel.build/rules/lib/dict">Dictionary: String -> String</a> | optional | |
Expand Down
35 changes: 27 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,44 +3,61 @@ module github.com/DataDog/rules_oci
go 1.22.5

require (
github.com/bazelbuild/bazel-gazelle v0.36.0
github.com/Microsoft/go-winio v0.6.2
github.com/Microsoft/hcsshim v0.12.3
github.com/bazelbuild/bazel-gazelle v0.38.0
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
github.com/containerd/containerd v1.7.20
github.com/containerd/containerd/api v1.7.19
github.com/containerd/continuity v0.4.2
github.com/containerd/errdefs v0.1.0
github.com/containerd/fifo v1.1.0
github.com/containerd/log v0.1.0
github.com/containerd/platforms v0.2.1
github.com/containerd/typeurl/v2 v2.1.1
github.com/docker/docker-credential-helpers v0.8.1
github.com/klauspost/compress v1.17.8
github.com/mitchellh/go-homedir v1.1.0
github.com/moby/sys/sequential v0.5.0
github.com/opencontainers/go-digest v1.0.0
github.com/opencontainers/image-spec v1.1.0
github.com/opencontainers/runtime-spec v1.1.0
github.com/sirupsen/logrus v1.9.3
github.com/stretchr/testify v1.9.0
github.com/urfave/cli/v2 v2.27.2
golang.org/x/sync v0.7.0
golang.org/x/sys v0.22.0
google.golang.org/grpc v1.63.2
oras.land/oras-go v1.2.6
)

require (
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
github.com/Microsoft/hcsshim v0.12.3 // indirect
github.com/bazelbuild/buildtools v0.0.0-20240422193413-1429e15ae755 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash/v2 v2.3.0 // indirect
github.com/containerd/errdefs v0.1.0 // indirect
github.com/containerd/log v0.1.0 // indirect
github.com/containerd/platforms v0.2.1 // indirect
github.com/containerd/cgroups/v3 v3.0.2 // indirect
github.com/containerd/ttrpc v1.2.5 // indirect
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/distribution/reference v0.6.0 // indirect
github.com/docker/cli v27.1.0+incompatible // indirect
github.com/docker/distribution v2.8.3+incompatible // indirect
github.com/docker/docker v27.1.1+incompatible // indirect
github.com/docker/go-connections v0.5.0 // indirect
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
github.com/docker/go-metrics v0.0.1 // indirect
github.com/felixge/httpsnoop v1.0.4 // indirect
github.com/go-logr/logr v1.4.1 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
github.com/google/go-cmp v0.6.0 // indirect
github.com/google/uuid v1.6.0 // indirect
github.com/gorilla/mux v1.8.1 // indirect
github.com/klauspost/compress v1.17.8 // indirect
github.com/kr/text v0.2.0 // indirect
github.com/moby/locker v1.0.1 // indirect
github.com/moby/sys/mountinfo v0.6.2 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/prometheus/client_golang v1.19.1 // indirect
Expand All @@ -49,13 +66,15 @@ require (
github.com/prometheus/procfs v0.14.0 // indirect
github.com/russross/blackfriday/v2 v2.1.0 // indirect
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
go.opencensus.io v0.24.0 // indirect
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect
go.opentelemetry.io/otel v1.26.0 // indirect
go.opentelemetry.io/otel/metric v1.26.0 // indirect
go.opentelemetry.io/otel/trace v1.26.0 // indirect
golang.org/x/sys v0.22.0 // indirect
golang.org/x/net v0.26.0 // indirect
golang.org/x/text v0.16.0 // indirect
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
google.golang.org/grpc v1.63.2 // indirect
google.golang.org/protobuf v1.34.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
Loading

0 comments on commit 7fcb47e

Please sign in to comment.