Skip to content

Commit 65aeaf9

Browse files
authored
Move cmd, internal, and pkg into a new Go module (#35)
This lets us depend on `github.com/DataDog/rules_oci/go` in other projects without Gazelle getting confused by depending on the Go module `github.com/DataDog/rules_oci`, which Gazelle's update-repos turns into the label `@com_github_datadog_rules_oci`, and depending on the Bazel rules from this repo, which is named `@com_github_datadog_rules_oci`. The `go.work` is just a way to have a `--from_file` for `gazelle --update-repos` that pulls in both `./go.mod` and `./go/go.mod`. This way, we can have just one `gazelle --update-repos` call that pulls in every Go dependency for both modules properly. Signed-off-by: Andrew Bayer <[email protected]>
1 parent 0365f6f commit 65aeaf9

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

67 files changed

+805
-2450
lines changed

.github/workflows/main.yaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
- run: chmod +x ~/.local/bin/docker-credential-ghcr
2323

2424
# Setup local toolchain
25-
- run: bazel build --config=ci //cmd/ocitool:ocitool && cp bazel-bin/cmd/ocitool/ocitool_/ocitool bin/ocitool-linux-amd64
25+
- run: bazel build --config=ci //go/cmd/ocitool:ocitool && cp bazel-bin/go/cmd/ocitool/ocitool_/ocitool bin/ocitool-linux-amd64
2626

2727
# Run all tests
2828
- run: bazel test --config=ci //...

BUILD.bazel

+1-1
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ gazelle_binary(
3232
gazelle(
3333
name = "gazelle-update-repos",
3434
args = [
35-
"-from_file=go.mod",
35+
"-from_file=go.work",
3636
"-to_macro=repositories.bzl%go_repositories",
3737
"-prune=true",
3838
"-build_file_proto_mode=disable",

LICENSE-3rdparty.csv

+9-9
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
Component,Origin,License,Copyright
2-
github.com/DataDog/rules_oci/cmd/ocitool,,,
3-
github.com/DataDog/rules_oci/internal/flagutil,,,
4-
github.com/DataDog/rules_oci/internal/set,,,
5-
github.com/DataDog/rules_oci/internal/tarutil,,,
6-
github.com/DataDog/rules_oci/pkg/blob,,,
7-
github.com/DataDog/rules_oci/pkg/credhelper,,,
8-
github.com/DataDog/rules_oci/pkg/deb2layer,,,
9-
github.com/DataDog/rules_oci/pkg/layer,,,
10-
github.com/DataDog/rules_oci/pkg/ociutil,,,
2+
github.com/DataDog/rules_oci/go/cmd/ocitool,,,
3+
github.com/DataDog/rules_oci/go/internal/flagutil,,,
4+
github.com/DataDog/rules_oci/go/internal/set,,,
5+
github.com/DataDog/rules_oci/go/internal/tarutil,,,
6+
github.com/DataDog/rules_oci/go/pkg/blob,,,
7+
github.com/DataDog/rules_oci/go/pkg/credhelper,,,
8+
github.com/DataDog/rules_oci/go/pkg/deb2layer,,,
9+
github.com/DataDog/rules_oci/go/pkg/layer,,,
10+
github.com/DataDog/rules_oci/go/pkg/ociutil,,,
1111
github.com/DataDog/rules_oci/release,,,
1212
github.com/DataDog/rules_oci/tests/go-multiarch-image,,,
1313
github.com/bazelbuild/bazel-gazelle,https://github.com/bazelbuild/bazel-gazelle,Apache-2.0,

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ manifests, image indexes (multi-arch images) and custom artifacts
1212
* **Multi-arch images**, compiling and building multi-arch images with a single Bazel invocation
1313

1414
In addition to Bazel rules, we offer many helpers for interacting with OCI
15-
artifacts under the `pkg` directory and a CLI tool for creating new OCI
16-
artifacts.
15+
artifacts under the `go/pkg` directory and a CLI tool for creating new OCI
16+
artifacts. You can add the Go library as a dependency by running `go get github.com/DataDog/rules_oci/go@latest`.
1717

1818
`rules_oci` makes an effort to support Docker media types, but there is no
1919
guarantee of long-term support. Most CRI support the OCI types or there are

WORKSPACE

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ http_archive(
1313

1414
http_archive(
1515
name = "bazel_gazelle",
16-
sha256 = "5982e5463f171da99e3bdaeff8c0f48283a7a5f396ec5282910b9e8a49c0dd7e",
16+
sha256 = "501deb3d5695ab658e82f6f6f549ba681ea3ca2a5fb7911154b5aa45596183fa",
1717
urls = [
18-
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
19-
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.25.0/bazel-gazelle-v0.25.0.tar.gz",
18+
"https://mirror.bazel.build/github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
19+
"https://github.com/bazelbuild/bazel-gazelle/releases/download/v0.26.0/bazel-gazelle-v0.26.0.tar.gz",
2020
],
2121
)
2222

go.mod

-71
Original file line numberDiff line numberDiff line change
@@ -1,74 +1,3 @@
11
module github.com/DataDog/rules_oci
22

33
go 1.18
4-
5-
require (
6-
github.com/bazelbuild/bazel-gazelle v0.24.0
7-
github.com/bazelbuild/buildtools v0.0.0-20211007154642-8dd79e56e98e
8-
github.com/blakesmith/ar v0.0.0-20190502131153-809d4375e1fb
9-
github.com/containerd/containerd v1.6.4
10-
github.com/docker/docker-credential-helpers v0.6.4
11-
github.com/mitchellh/go-homedir v1.1.0
12-
github.com/opencontainers/go-digest v1.0.0
13-
github.com/opencontainers/image-spec v1.1.0-rc2
14-
github.com/sirupsen/logrus v1.8.1
15-
github.com/stretchr/testify v1.7.0
16-
github.com/urfave/cli/v2 v2.3.0
17-
golang.org/x/sync v0.0.0-20210220032951-036812b2e83c
18-
oras.land/oras-go v1.1.0
19-
)
20-
21-
require (
22-
github.com/Azure/go-ansiterm v0.0.0-20170929234023-d6e3b3328b78 // indirect
23-
github.com/Microsoft/go-winio v0.5.1 // indirect
24-
github.com/Microsoft/hcsshim v0.9.2 // indirect
25-
github.com/beorn7/perks v1.0.1 // indirect
26-
github.com/cespare/xxhash/v2 v2.1.2 // indirect
27-
github.com/containerd/cgroups v1.0.3 // indirect
28-
github.com/containerd/continuity v0.2.2 // indirect
29-
github.com/containerd/fifo v1.0.0 // indirect
30-
github.com/containerd/ttrpc v1.1.0 // indirect
31-
github.com/containerd/typeurl v1.0.2 // indirect
32-
github.com/cpuguy83/go-md2man/v2 v2.0.0 // indirect
33-
github.com/davecgh/go-spew v1.1.1 // indirect
34-
github.com/docker/cli v20.10.11+incompatible // indirect
35-
github.com/docker/distribution v2.8.1+incompatible // indirect
36-
github.com/docker/docker v20.10.11+incompatible // indirect
37-
github.com/docker/go-connections v0.4.0 // indirect
38-
github.com/docker/go-events v0.0.0-20190806004212-e31b211e4f1c // indirect
39-
github.com/docker/go-metrics v0.0.1 // indirect
40-
github.com/docker/go-units v0.4.0 // indirect
41-
github.com/gogo/googleapis v1.4.0 // indirect
42-
github.com/gogo/protobuf v1.3.2 // indirect
43-
github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect
44-
github.com/golang/protobuf v1.5.2 // indirect
45-
github.com/google/uuid v1.2.0 // indirect
46-
github.com/gorilla/mux v1.8.0 // indirect
47-
github.com/klauspost/compress v1.13.6 // indirect
48-
github.com/matttproud/golang_protobuf_extensions v1.0.2-0.20181231171920-c182affec369 // indirect
49-
github.com/moby/locker v1.0.1 // indirect
50-
github.com/moby/sys/mountinfo v0.5.0 // indirect
51-
github.com/moby/sys/signal v0.6.0 // indirect
52-
github.com/moby/term v0.0.0-20200312100748-672ec06f55cd // indirect
53-
github.com/morikuni/aec v1.0.0 // indirect
54-
github.com/opencontainers/runc v1.1.1 // indirect
55-
github.com/opencontainers/runtime-spec v1.0.3-0.20210326190908-1c3f411f0417 // indirect
56-
github.com/opencontainers/selinux v1.10.1 // indirect
57-
github.com/pkg/errors v0.9.1 // indirect
58-
github.com/pmezard/go-difflib v1.0.0 // indirect
59-
github.com/prometheus/client_golang v1.11.1 // indirect
60-
github.com/prometheus/client_model v0.2.0 // indirect
61-
github.com/prometheus/common v0.30.0 // indirect
62-
github.com/prometheus/procfs v0.7.3 // indirect
63-
github.com/russross/blackfriday/v2 v2.0.1 // indirect
64-
github.com/shurcooL/sanitized_anchor_name v1.0.0 // indirect
65-
go.opencensus.io v0.23.0 // indirect
66-
golang.org/x/net v0.0.0-20220107192237-5cfca573fb4d // indirect
67-
golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e // indirect
68-
golang.org/x/text v0.3.7 // indirect
69-
golang.org/x/tools v0.1.7 // indirect
70-
google.golang.org/genproto v0.0.0-20220107163113-42d7afdf6368 // indirect
71-
google.golang.org/grpc v1.43.0 // indirect
72-
google.golang.org/protobuf v1.27.1 // indirect
73-
gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
74-
)

0 commit comments

Comments
 (0)