From 5e92690873fe4e7f5af84b439bf431eca9416066 Mon Sep 17 00:00:00 2001 From: Robert Fratto Date: Mon, 25 Mar 2024 17:20:50 -0400 Subject: [PATCH] misc: move cmd/alloy to root of repository (#77) Following the Go documentation on how to [Organize a Go module][modules-layout], a single-command repository should have its main package at the root of the repository rather than in a cmd/ folder. As all internal tooling is now in internal/cmd, and there's only one non-internal binary, that binary has been moved to the root of the repository to align with best practices. [modules-layout]: https://go.dev/doc/modules/layout --- .drone/drone.yml | 6 +++--- .drone/pipelines/check_containers.jsonnet | 4 ++-- cmd/alloy/Dockerfile => Dockerfile | 2 +- cmd/alloy/Dockerfile.windows => Dockerfile.windows | 2 +- Makefile | 6 +++--- docs/developer/contributing.md | 6 +++--- cmd/alloy/example-config.river => example-config.river | 0 cmd/alloy/main.go => main.go | 0 tools/ci/docker-containers | 2 +- tools/ci/docker-containers-windows | 2 +- 10 files changed, 15 insertions(+), 15 deletions(-) rename cmd/alloy/Dockerfile => Dockerfile (96%) rename cmd/alloy/Dockerfile.windows => Dockerfile.windows (93%) rename cmd/alloy/example-config.river => example-config.river (100%) rename cmd/alloy/main.go => main.go (100%) diff --git a/.drone/drone.yml b/.drone/drone.yml index 3f631aca9d..d3f195be56 100644 --- a/.drone/drone.yml +++ b/.drone/drone.yml @@ -83,7 +83,7 @@ steps: path: /var/run/docker.sock trigger: paths: - - cmd/alloy/Dockerfile + - Dockerfile - tools/ci/docker-containers ref: - refs/heads/main @@ -109,7 +109,7 @@ steps: path: //./pipe/docker_engine/ trigger: paths: - - cmd/alloy/Dockerfile.windows + - Dockerfile.windows - tools/ci/docker-containers-windows ref: - refs/heads/main @@ -401,6 +401,6 @@ kind: secret name: updater_private_key --- kind: signature -hmac: 1a44f5bcd0f52805d4b7d1f11433f993832627118bbae3956fe5aa49b68d5a31 +hmac: 1c75c3c155d1dba9707728f7b6a5fed9399518900e86c7fba55e52a253bdb26b ... diff --git a/.drone/pipelines/check_containers.jsonnet b/.drone/pipelines/check_containers.jsonnet index 5c5f2e5284..29ee6e957b 100644 --- a/.drone/pipelines/check_containers.jsonnet +++ b/.drone/pipelines/check_containers.jsonnet @@ -2,11 +2,11 @@ local build_image = import '../util/build_image.jsonnet'; local pipelines = import '../util/pipelines.jsonnet'; local linux_containers = [ - { name: 'grafana/alloy', make: 'make alloy-image', path: 'cmd/alloy/Dockerfile' }, + { name: 'grafana/alloy', make: 'make alloy-image', path: 'Dockerfile' }, ]; local windows_containers = [ - { name: 'grafana/alloy', argument: 'alloy', path: 'cmd/alloy/Dockerfile.windows' }, + { name: 'grafana/alloy', argument: 'alloy', path: 'Dockerfile.windows' }, ]; ( diff --git a/cmd/alloy/Dockerfile b/Dockerfile similarity index 96% rename from cmd/alloy/Dockerfile rename to Dockerfile index 7b15b82548..72dd8d6409 100644 --- a/cmd/alloy/Dockerfile +++ b/Dockerfile @@ -46,7 +46,7 @@ RUN < # For testing: @@ -62,7 +62,7 @@ To build Grafana Agent from source code, please install the following tools: You can directly use the go tool to download and install the agent binary into your GOPATH: - $ GO111MODULE=on go install github.com/grafana/alloy/cmd/alloy + $ GO111MODULE=on go install github.com/grafana/alloy $ alloy run your_config.river An example of the above configuration file can be found [here][example-config]. @@ -205,5 +205,5 @@ a hard fork (i.e., creating a new Go module with the same source). [CLA]: https://cla-assistant.io/grafana/alloy [good-first-issue]: https://github.com/grafana/alloy/issues?q=is%3Aopen+is%3Aissue+label%3A%22good+first+issue%22 [community-slack]: https://slack.grafana.com/ -[example-config]: ../../cmd/alloy/example-config.river +[example-config]: ../../example-config.river [go-modules]: https://golang.org/cmd/go/#hdr-Modules__module_versions__and_more diff --git a/cmd/alloy/example-config.river b/example-config.river similarity index 100% rename from cmd/alloy/example-config.river rename to example-config.river diff --git a/cmd/alloy/main.go b/main.go similarity index 100% rename from cmd/alloy/main.go rename to main.go diff --git a/tools/ci/docker-containers b/tools/ci/docker-containers index cbd9d7430e..05c2a1c1be 100755 --- a/tools/ci/docker-containers +++ b/tools/ci/docker-containers @@ -69,7 +69,7 @@ case "$TARGET_CONTAINER" in --build-arg VERSION="$VERSION" \ -t "$ALLOY_IMAGE:$TAG_VERSION" \ -t "$ALLOY_IMAGE:$BRANCH_TAG" \ - -f cmd/alloy/Dockerfile \ + -f Dockerfile \ . ;; diff --git a/tools/ci/docker-containers-windows b/tools/ci/docker-containers-windows index dd55324ec9..abbad1a501 100644 --- a/tools/ci/docker-containers-windows +++ b/tools/ci/docker-containers-windows @@ -58,7 +58,7 @@ case "$TARGET_CONTAINER" in -t "$ALLOY_IMAGE:$BRANCH_TAG" \ --build-arg VERSION="$VERSION" \ --build-arg RELEASE_BUILD=1 \ - -f ./cmd/alloy/Dockerfile.windows \ + -f ./Dockerfile.windows \ . ;;