From 3de2590d7a05d1eb65ce8417c06f1d1d37652e43 Mon Sep 17 00:00:00 2001 From: "John L. Peterson (Jack)" Date: Sat, 28 Sep 2024 12:00:09 -0400 Subject: [PATCH] update cmd/builder documentation for docker image (#11234) #### Description Adding documentation for corresponding [PR #671 in opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases/pull/671) #### Link to tracking issue Closes #5712 #### Testing Github Actions and releases in personal fork, github.com/jackgopack4/opentelemetry-collector-releases #### Documentation updates to cmd/builder/README.md for OCB instructions and docs/release.md for an automation that I also added in the releases PR --------- Co-authored-by: Andrzej Stencel Co-authored-by: Yang Song --- .../jackgopack4_add-ocb-docker-images.yaml | 25 ++++++++++++++++ cmd/builder/README.md | 29 +++++++++++++++++-- docs/release.md | 20 +++++++++---- 3 files changed, 66 insertions(+), 8 deletions(-) create mode 100644 .chloggen/jackgopack4_add-ocb-docker-images.yaml diff --git a/.chloggen/jackgopack4_add-ocb-docker-images.yaml b/.chloggen/jackgopack4_add-ocb-docker-images.yaml new file mode 100644 index 00000000000..ccd8c12fa82 --- /dev/null +++ b/.chloggen/jackgopack4_add-ocb-docker-images.yaml @@ -0,0 +1,25 @@ +# Use this changelog template to create an entry for release notes. + +# One of 'breaking', 'deprecation', 'new_component', 'enhancement', 'bug_fix' +change_type: enhancement + +# The name of the component, or a single word describing the area of concern, (e.g. otlpreceiver) +component: ocb + +# A brief description of the change. Surround your text with quotes ("") if it needs to start with a backtick (`). +note: create docker images for OCB, per https://github.com/open-telemetry/opentelemetry-collector-releases/pull/671 + +# One or more tracking issues or pull requests related to the change +issues: [ 5712 ] + +# (Optional) One or more lines of additional information to render under the primary note. +# These lines will be padded with 2 spaces and then inserted directly into the document. +# Use pipe (|) for multiline entries. +subtext: Adds standard Docker images for OCB to Dockerhub and GitHub, see hub.docker.com/r/otel/opentelemetry-collector-builder + +# Optional: The change log or logs in which this entry should be included. +# e.g. '[user]' or '[user, api]' +# Include 'user' if the change is relevant to end users. +# Include 'api' if there is a change to a library API. +# Default: '[user]' +change_logs: [ user ] diff --git a/cmd/builder/README.md b/cmd/builder/README.md index 159ac167ae7..8d26c3b5816 100644 --- a/cmd/builder/README.md +++ b/cmd/builder/README.md @@ -57,11 +57,34 @@ $ /tmp/dist/otelcol-custom --config=/tmp/otelcol.yaml ## Installation -There are two supported ways to install the builder: via the official releases (recommended) and through `go install`. +There are three supported ways to install the builder: +1. Via official release Docker images (recommended) +2. Via official release binaries (recommended) +3. Through `go install` (not recommended) -### Official releases +### Official release Docker image -This is the recommended installation method. Download the binary for your respective platform from the ["Releases"](https://github.com/open-telemetry/opentelemetry-collector-releases/releases?q=cmd/builder) page. +You will find the official docker images at [DockerHub](https://hub.docker.com/r/otel/opentelemetry-collector-builder). + +Pull the image via tagged version number (e.g. v0.110.0) or 'latest'. You may also specify platform, although Docker will handle this automatically as it is a multi-platform build. + +``` +docker pull otel/opentelemetry-collector-builder:latest +``` + +The included builder configuration file/manifest should be replaced by mounting a file from your local filesystem to the docker container; the default location is `/build/builder-config.yaml`. If you mount a file at a different location inside the container, your `builder.config.yaml` must be specified as a command line argument to ocb. Additionally, the output folder must also be mounted from your local system to the docker container. This output directory must be specified in your `builder-config.yaml` file as it cannot be set via the command-line arguments. + +Assuming you are running this image in your working directory, have a `builder-config.yaml` file located in this folder, the `dist.output_path` item inside your `builder-config.yaml` is set to `./otelcol-dev`, and you wish to output the binary/go module files to a folder named `output`, the command would look as follows: + +``` +docker run -v "$(pwd)/builder-config.yaml:/build/builder-config.yaml" -v "$(pwd)/output:/build/otelcol-dev" otel/opentelemetry-collector-builder:latest +``` + +Additional arguments may be passed to ocb on the command line as specified below, but if you wish to do this, you must make sure to pass the `--config` argument, as this is specified as an additional `CMD`, not an entrypoint. + +### Official release binaries + +This is the recommended installation method for the binary. Download the binary for your respective platform from the ["Releases"](https://github.com/open-telemetry/opentelemetry-collector-releases/releases?q=cmd/builder) page. ### `go install` diff --git a/docs/release.md b/docs/release.md index 81a54154754..1b138c04c6b 100644 --- a/docs/release.md +++ b/docs/release.md @@ -74,16 +74,24 @@ It is possible that a core approver isn't a contrib approver. In that case, the ## Producing the artifacts The last step of the release process creates artifacts for the new version of the collector and publishes images to Dockerhub. The steps in this portion of the release are done in the [opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases) repo. -1. Update the `./distributions/**/manifest.yaml` files to include the new release version. +**NOTE: Step 1 of this section is updated!** -2. Update the builder version in `OTELCOL_BUILDER_VERSION` to the new release in the `Makefile`. While this might not be strictly necessary for every release, this is a good practice. +1. Run the "Update Version" workflow under [opentelemetry-collector-releases](https://github.com/open-telemetry/opentelemetry-collector-releases) repo. Make sure to enter the previous (current) and the new (updated) version numbers, including the leading 'v'. This will automate the following steps: + + 1. Update the `./distributions/**/manifest.yaml` files to include the new release version. + + 2. Update the default `./cmd/builder/builder-config.yaml` used for ocb Docker image build to include the new release version + + 3. Update the builder version in `OTELCOL_BUILDER_VERSION` to the new release in the `Makefile`. While this might not be strictly necessary for every release, this is a good practice. -3. Create a pull request with the change and ensure the build completes successfully. See [example](https://github.com/open-telemetry/opentelemetry-collector-releases/pull/71). + 4. Create a pull request with these changes + +2. Review the automatic pull request that is created and ensure the build completes successfully. See [example](https://github.com/open-telemetry/opentelemetry-collector-releases/pull/71). - 🛑 **Do not move forward until this PR is merged.** 🛑 -4. Check out the commit created by merging the PR and tag with the new release version by running the `make push-tags TAG=v0.85.0` command. If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector-releases.git` in each command. Wait for the new tag build to pass successfully. +3. Check out the commit created by merging the PR and tag with the new release version by running the `make push-tags TAG=v0.85.0` command. If you set your remote using `https` you need to include `REMOTE=https://github.com/open-telemetry/opentelemetry-collector-releases.git` in each command. Wait for the new tag build to pass successfully. -5. Ensure the "Release Core", "Release Contrib", "Release k8s", and "Builder - Release" actions pass, this will +4. Ensure the "Release Core", "Release Contrib", "Release k8s", and "Builder - Release" actions pass, this will 1. push new container images to `https://hub.docker.com/repository/docker/otel/opentelemetry-collector`, `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-contrib` and `https://hub.docker.com/repository/docker/otel/opentelemetry-collector-k8s` @@ -91,6 +99,8 @@ The last step of the release process creates artifacts for the new version of th 3. build and release ocb binaries under a separate tagged Github release, e.g. `cmd/builder/v0.85.0` + 4. build and push ocb Docker images to `https://hub.docker.com/r/otel/opentelemetry-collector-builder` and the GitHub Container Registry within the releases repository + ## Troubleshooting 1. `unknown revision internal/coreinternal/v0.85.0` -- This is typically an indication that there's a dependency on a new module. You can fix it by adding a new `replaces` entry to the `go.mod` for the affected module.