Skip to content

Commit 7fcb47e

Browse files
[EEESUPPORT-11240] Add logging and retries to pull_cmd (#62)
* 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
1 parent b1d616f commit 7fcb47e

File tree

11 files changed

+328
-29
lines changed

11 files changed

+328
-29
lines changed

MODULE.bazel

+23-2
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ module(
66
bazel_dep(name = "aspect_bazel_lib", version = "2.7.3")
77
bazel_dep(name = "bazel_skylib", version = "1.6.1")
88
bazel_dep(name = "bazel_skylib_gazelle_plugin", dev_dependency = True, version = "1.6.1")
9-
bazel_dep(name = "gazelle", version = "0.36.0")
9+
bazel_dep(name = "gazelle", version = "0.38.0")
1010
bazel_dep(name = "rules_go", version = "0.47.1")
1111
bazel_dep(name = "rules_pkg", version = "0.10.1")
1212
bazel_dep(name = "stardoc", version = "0.6.2")
@@ -23,18 +23,39 @@ go_deps.from_file(go_mod = "//:go.mod")
2323

2424
use_repo(
2525
go_deps,
26-
#"com_github_bazelbuild_bazel_gazelle",
2726
"com_github_blakesmith_ar",
2827
"com_github_containerd_containerd",
28+
"com_github_containerd_containerd_api",
29+
"com_github_containerd_continuity",
30+
"com_github_containerd_errdefs",
31+
"com_github_containerd_fifo",
32+
"com_github_containerd_log",
33+
"com_github_containerd_platforms",
34+
"com_github_containerd_typeurl_v2",
2935
"com_github_docker_docker_credential_helpers",
36+
"com_github_klauspost_compress",
37+
"com_github_microsoft_go_winio",
38+
"com_github_microsoft_hcsshim",
3039
"com_github_mitchellh_go_homedir",
40+
"com_github_moby_sys_sequential",
3141
"com_github_opencontainers_go_digest",
3242
"com_github_opencontainers_image_spec",
43+
"com_github_opencontainers_runtime_spec",
3344
"com_github_sirupsen_logrus",
3445
"com_github_stretchr_testify",
3546
"com_github_urfave_cli_v2",
3647
"land_oras_oras_go",
48+
"org_golang_google_grpc",
3749
"org_golang_x_sync",
50+
"org_golang_x_sys",
51+
)
52+
53+
go_deps.module_override(
54+
patch_strip = 1,
55+
patches = [
56+
"//third_party/com_github_containerd_containerd:EEESUPPORT-11240-logging-and-retries-for-oci-pull.patch",
57+
],
58+
path = "github.com/containerd/containerd",
3859
)
3960

4061
oci_pull = use_repo_rule("//oci:defs.bzl", "oci_pull")

MODULE.bazel.lock

+3-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

docs/docs.md

+2-1
Original file line numberDiff line numberDiff line change
@@ -102,7 +102,7 @@ Pushes a manifest or a list of manifests to an OCI registry.
102102
## oci_pull
103103

104104
<pre>
105-
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>)
105+
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>)
106106
</pre>
107107

108108
**ATTRIBUTES**
@@ -111,6 +111,7 @@ oci_pull(<a href="#oci_pull-name">name</a>, <a href="#oci_pull-digest">digest</a
111111
| Name | Description | Type | Mandatory | Default |
112112
| :------------- | :------------- | :------------- | :------------- | :------------- |
113113
| <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 | |
114+
| <a id="oci_pull-debug"></a>debug | Enable ocitool debug output | Boolean | optional | `False` |
114115
| <a id="oci_pull-digest"></a>digest | - | String | required | |
115116
| <a id="oci_pull-registry"></a>registry | - | String | required | |
116117
| <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 | |

go.mod

+27-8
Original file line numberDiff line numberDiff line change
@@ -3,44 +3,61 @@ module github.com/DataDog/rules_oci
33
go 1.22.5
44

55
require (
6-
github.com/bazelbuild/bazel-gazelle v0.36.0
6+
github.com/Microsoft/go-winio v0.6.2
7+
github.com/Microsoft/hcsshim v0.12.3
8+
github.com/bazelbuild/bazel-gazelle v0.38.0
79
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
810
github.com/containerd/containerd v1.7.20
11+
github.com/containerd/containerd/api v1.7.19
12+
github.com/containerd/continuity v0.4.2
13+
github.com/containerd/errdefs v0.1.0
14+
github.com/containerd/fifo v1.1.0
15+
github.com/containerd/log v0.1.0
16+
github.com/containerd/platforms v0.2.1
17+
github.com/containerd/typeurl/v2 v2.1.1
918
github.com/docker/docker-credential-helpers v0.8.1
19+
github.com/klauspost/compress v1.17.8
1020
github.com/mitchellh/go-homedir v1.1.0
21+
github.com/moby/sys/sequential v0.5.0
1122
github.com/opencontainers/go-digest v1.0.0
1223
github.com/opencontainers/image-spec v1.1.0
24+
github.com/opencontainers/runtime-spec v1.1.0
1325
github.com/sirupsen/logrus v1.9.3
1426
github.com/stretchr/testify v1.9.0
1527
github.com/urfave/cli/v2 v2.27.2
1628
golang.org/x/sync v0.7.0
29+
golang.org/x/sys v0.22.0
30+
google.golang.org/grpc v1.63.2
1731
oras.land/oras-go v1.2.6
1832
)
1933

2034
require (
2135
github.com/AdaLogics/go-fuzz-headers v0.0.0-20230811130428-ced1acdcaa24 // indirect
22-
github.com/Microsoft/hcsshim v0.12.3 // indirect
2336
github.com/bazelbuild/buildtools v0.0.0-20240422193413-1429e15ae755 // indirect
2437
github.com/beorn7/perks v1.0.1 // indirect
2538
github.com/cespare/xxhash/v2 v2.3.0 // indirect
26-
github.com/containerd/errdefs v0.1.0 // indirect
27-
github.com/containerd/log v0.1.0 // indirect
28-
github.com/containerd/platforms v0.2.1 // indirect
39+
github.com/containerd/cgroups/v3 v3.0.2 // indirect
40+
github.com/containerd/ttrpc v1.2.5 // indirect
2941
github.com/cpuguy83/go-md2man/v2 v2.0.4 // indirect
3042
github.com/davecgh/go-spew v1.1.1 // indirect
3143
github.com/distribution/reference v0.6.0 // indirect
3244
github.com/docker/cli v27.1.0+incompatible // indirect
3345
github.com/docker/distribution v2.8.3+incompatible // indirect
3446
github.com/docker/docker v27.1.1+incompatible // indirect
3547
github.com/docker/go-connections v0.5.0 // indirect
48+
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
3649
github.com/docker/go-metrics v0.0.1 // indirect
3750
github.com/felixge/httpsnoop v1.0.4 // indirect
3851
github.com/go-logr/logr v1.4.1 // indirect
3952
github.com/go-logr/stdr v1.2.2 // indirect
53+
github.com/gogo/protobuf v1.3.2 // indirect
54+
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
55+
github.com/google/go-cmp v0.6.0 // indirect
56+
github.com/google/uuid v1.6.0 // indirect
4057
github.com/gorilla/mux v1.8.1 // indirect
41-
github.com/klauspost/compress v1.17.8 // indirect
4258
github.com/kr/text v0.2.0 // indirect
4359
github.com/moby/locker v1.0.1 // indirect
60+
github.com/moby/sys/mountinfo v0.6.2 // indirect
4461
github.com/pkg/errors v0.9.1 // indirect
4562
github.com/pmezard/go-difflib v1.0.0 // indirect
4663
github.com/prometheus/client_golang v1.19.1 // indirect
@@ -49,13 +66,15 @@ require (
4966
github.com/prometheus/procfs v0.14.0 // indirect
5067
github.com/russross/blackfriday/v2 v2.1.0 // indirect
5168
github.com/xrash/smetrics v0.0.0-20240312152122-5f08fbb34913 // indirect
69+
go.opencensus.io v0.24.0 // indirect
5270
go.opentelemetry.io/contrib/instrumentation/net/http/otelhttp v0.51.0 // indirect
5371
go.opentelemetry.io/otel v1.26.0 // indirect
5472
go.opentelemetry.io/otel/metric v1.26.0 // indirect
5573
go.opentelemetry.io/otel/trace v1.26.0 // indirect
56-
golang.org/x/sys v0.22.0 // indirect
74+
golang.org/x/net v0.26.0 // indirect
75+
golang.org/x/text v0.16.0 // indirect
76+
google.golang.org/genproto v0.0.0-20240227224415-6ceb2ff114de // indirect
5777
google.golang.org/genproto/googleapis/rpc v0.0.0-20240509183442-62759503f434 // indirect
58-
google.golang.org/grpc v1.63.2 // indirect
5978
google.golang.org/protobuf v1.34.1 // indirect
6079
gopkg.in/yaml.v3 v3.0.1 // indirect
6180
)

0 commit comments

Comments
 (0)