Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 33 additions & 6 deletions multimod/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,15 +22,42 @@ When creating a or editing a `versions.yaml` file...
An example versioning file is given in [the versions-example.yaml
file](./docs/versions-example.yaml).

## Creating the app binary
## Acquiring the app binary

TODO: switch to automatically pulling newest version of `multimod` app binary.
There are several ways to acquire the `multimod` binary. We recommend using `go install` for most local development needs.

This section describes the current process used for building the Cobra app
binary, but the process will be updated soon to automatically fetch the most
recent version of the app.
### Using go run (One-off use)

To build the binary, simply use the following commands:
If you just want to run the tool once without installing it:

```sh
go run go.opentelemetry.io/build-tools/multimod@latest [command]
```

### Using go install (Recommended)

To install the binary to your `GOBIN` (defaults to `GOPATH/bin`):

```sh
go install go.opentelemetry.io/build-tools/multimod@latest
```

### Using the bootstrap script

For CI/CD or automated environments, you can use the provided bootstrap script:

```sh
./multimod/get-multimod.sh
```

The script supports custom installation paths and versions:
```sh
./multimod/get-multimod.sh -v latest -p /usr/local/bin
```

### Manual Build

If you are a developer working on `multimod` itself:

```sh
# from the opentelemetry-go-build-tools repo root
Expand Down
51 changes: 51 additions & 0 deletions multimod/get-multimod.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
#!/usr/bin/env bash

# Copyright The OpenTelemetry Authors
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -euo pipefail

# This script automates the installation of the multimod tool.
# It uses 'go install' to pull the latest version from the repository.

# Default values
INSTALL_PATH="${GOBIN:-$(go env GOPATH)/bin}"
PACKAGE="go.opentelemetry.io/build-tools/multimod"
VERSION="latest"

usage() {
echo "Usage: $0 [-v VERSION] [-p PATH]"
echo " -v: Version to install (default: latest)"
echo " -p: Path to install the binary to (default: $INSTALL_PATH)"
exit 1
}

while getopts "v:p:" opt; do
case "$opt" in
v) VERSION="$OPTARG" ;;
p) INSTALL_PATH="$OPTARG" ;;
*) usage ;;
esac
done

echo "Installing ${PACKAGE}@${VERSION} to ${INSTALL_PATH}..."

# Ensure the install path exists
mkdir -p "${INSTALL_PATH}"

# Install the tool
GO111MODULE=on go install "${PACKAGE}@${VERSION}"

echo "Successfully installed multimod to ${INSTALL_PATH}/multimod"
echo "Make sure ${INSTALL_PATH} is in your PATH."