github.com/influxdata/telegraf@v1.30.3/docs/developers/PACKAGING.md (about) 1 # Packaging 2 3 Building the packages for Telegraf is automated using [Make](https://en.wikipedia.org/wiki/Make_(software)). Just running `make` will build a Telegraf binary for the operating system and architecture you are using (if it is supported). If you need to build a different package then you can run `make package` which will build all the supported packages. You will most likely only want a subset, you can define a subset of packages to be built by overriding the `include_packages` variable like so `make package include_packages="amd64.deb"`. You can also build all packages for a specific architecture like so `make package include_packages="$(make amd64)"`. 4 5 The packaging steps require certain tools to be setup before hand to work. These dependencies are listed in the ci.docker file which you can find in the scripts directory. Therefore it is recommended to use Docker to build the artifacts, see more details below. 6 7 ## Go Version 8 9 Telegraf will be built using the latest version of Go whenever possible. 10 11 ### Update CI image 12 13 Incrementing the version is maintained by the core Telegraf team because it requires access to an internal docker repository that hosts the docker CI images. When a new version is released, the following process is followed: 14 15 1. Within the `Makefile`, `.circleci\config.yml`, and `scripts/ci.docker` files 16 update the Go versions to the new version number 17 2. Run `make ci`, this requires quay.io internal permissions 18 3. The files `scripts\installgo_linux.sh`, `scripts\installgo_mac.sh`, and 19 `scripts\installgo_windows.sh` need to be updated as well with the new Go 20 version and SHA 21 4. Create a pull request with these new changes, and verify the CI passes and 22 uses the new docker image 23 24 See the [previous PRs](https://github.com/influxdata/telegraf/search?q=chore+update+go&type=commits) as examples. 25 26 ### Access to quay.io 27 28 A member of the team needs to invite you to the quay.io organization. 29 To push new images, the user needs to do the following: 30 31 1. Create a password if the user logged in using Google authentication 32 2. Download an encrypted username/password from the quay.io user page 33 3. Run `docker login quay.io` and enter in the encrypted username and password 34 from the previous step 35 36 ## Package using Docker 37 38 This packaging method uses the CI images, and is very similar to how the 39 official packages are created on release. This is the recommended method for 40 building the rpm/deb as it is less system dependent. 41 42 Pull the CI images from quay, the version corresponds to the version of Go 43 that is used to build the binary: 44 45 ```shell 46 docker pull quay.io/influxdb/telegraf-ci:1.9.7 47 ``` 48 49 Start a shell in the container: 50 51 ```shell 52 docker run -ti quay.io/influxdb/telegraf-ci:1.9.7 /bin/bash 53 ``` 54 55 From within the container: 56 57 1. `go get -d github.com/influxdata/telegraf` 58 2. `cd /go/src/github.com/influxdata/telegraf` 59 3. `git checkout release-1.10` 60 * Replace tag `release-1.10` with the version of Telegraf you would like to build 61 4. `git reset --hard 1.10.2` 62 5. `make deps` 63 6. `make package include_packages="amd64.deb"` 64 * Change `include_packages` to change what package you want, run `make help` to see possible values 65 66 From the host system, copy the build artifacts out of the container: 67 68 ```shell 69 docker cp romantic_ptolemy:/go/src/github.com/influxdata/telegraf/build/telegraf-1.10.2-1.x86_64.rpm . 70 ```