Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04-update into ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:edge

Proposed by Sergio Durigan Junior
Status: Merged
Merge reported by: Sergio Durigan Junior
Merged at revision: 04d201f49fa30842568d5718822c1d68c2e8c830
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04-update
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:edge
Diff against target: 126 lines (+35/-70)
2 files modified
Dockerfile (+35/-27)
dev/null (+0/-43)
Reviewer Review Type Date Requested Status
Bryce Harrington Approve
Lucas Kanashiro Pending
Canonical Server Pending
Review via email: mp+398912@code.launchpad.net

Description of the change

Update the telegraf OCI image to hirsute, convert it to deb-based, and generate the manifest.

To post a comment you must log in.
Revision history for this message
Bryce Harrington (bryce) wrote :

Looks good.

There's a git checkout of the utils module that I'm curious if that's supposed to be there. But other than that the rest looks good.

review: Approve
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thansk Bryce. Yeah, the utils repository is where the golang-manifest-builder script lives, so we have to check it out first. Arguably I could use a wget directly instead, but I opted for the easier way.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
diff --git a/Dockerfile b/Dockerfile
index 97b39b7..2f858b1 100644
--- a/Dockerfile
+++ b/Dockerfile
@@ -1,37 +1,45 @@
1FROM ubuntu:focal AS builder1FROM ubuntu:hirsute AS manifest-builder
2
3COPY . .
42
5WORKDIR /src/telegraf3WORKDIR /src/telegraf
64
7RUN apt-get update \5RUN set -eux; \
8 && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \6 grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/' >> /etc/apt/sources.list; \
9 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git dpkg-dev ca-certificates pristine-tar \7 DEBIAN_FRONTEND=noninteractive apt-get update; \
10 && git clone https://git.launchpad.net/~ubuntu-server/ubuntu/+source/telegraf \8 DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
11 && cd telegraf \9 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
12 && git branch pristine-tar origin/pristine-tar \10 dpkg-dev golang-go git python3 python3-lxml python3-requests; \
13 && git checkout focal \11 apt-get source telegraf; \
14 && cp -a /adjust-telegraf-conf.patch debian/patches \12 git clone https://git.launchpad.net/~canonical-server/ubuntu-docker-images/+git/utils; \
15 && echo "adjust-telegraf-conf.patch" >> debian/patches/series \13 cd telegraf*/vendor; \
16 && sed -i 's@^EXCLUDE_TESTS.*@EXCLUDE_TESTS = github.com/influxdata/telegraf/plugins/inputs/http_response \14# We have to use -mod=mod because "go list -m all" (from hirsute)
17github.com/influxdata/telegraf/plugins/inputs/zipkin \15# doesn't work with vendorized deps.
18github.com/influxdata/telegraf/plugins/outputs/prometheus_client \\@' debian/rules \16#
19 && pristine-tar checkout ../telegraf_$(dpkg-parsechangelog -SVersion | sed 's/\(.*\)-.ubuntu.*/\1/').orig.tar.xz \17# https://github.com/golang/go/issues/35224
20 && DEBIAN_FRONTEND=noninteractive apt-get build-dep . -y \18# https://bugs.launchpad.net/docker.io/+bug/1916296
21 && dpkg-buildpackage -us -uc19 go list -mod=mod -m all | tail -n +2 > /src/telegraf/telegraf-mods.txt; \
2220 /src/telegraf/utils/golang-manifest-builder.py /src/telegraf/telegraf-mods.txt | tee /src/telegraf/manifest-upstream.txt
23FROM ubuntu:focal21
22FROM ubuntu:hirsute
2423
25ENV TZ UTC24ENV TZ UTC
2625
27COPY --from=builder /src/telegraf/telegraf*.deb /pkg/26RUN set -eux; \
2827 apt-get update; \
29RUN apt-get update \28 DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
30 && DEBIAN_FRONTEND=noninteractive apt-get upgrade -y \29 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
31 && DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends /pkg/telegraf*.deb tzdata \30 telegraf tzdata; \
32# We don't need to keep the .deb packages around31# We don't need to keep the .deb packages around
33 && rm -rf /pkg \32 rm -rf /pkg; \
34 && rm -rf /var/lib/apt/lists/*33 rm -rf /var/lib/apt/lists/*; \
34# smoke test
35 telegraf --version; \
36# create manifest
37 mkdir -p /usr/share/rocks; \
38 (echo "# os-release" && cat /etc/os-release && echo "# dpkg-query" && dpkg-query -f '${db:Status-Abbrev},${binary:Package},${Version},${source:Package},${Source:Version}\n' -W) > /usr/share/rocks/dpkg.query
39
40# telegraf is "special" because we have a dpkg.query for it, but also
41# the list of Golang modules needed to build the .deb.
42COPY --from=manifest-builder /src/telegraf/manifest-upstream.txt /usr/share/rocks/upstream
3543
36EXPOSE 927344EXPOSE 9273
37ENTRYPOINT [ "/usr/bin/telegraf" ]45ENTRYPOINT [ "/usr/bin/telegraf" ]
diff --git a/adjust-telegraf-conf.patch b/adjust-telegraf-conf.patch
38deleted file mode 10064446deleted file mode 100644
index d081fb2..0000000
--- a/adjust-telegraf-conf.patch
+++ /dev/null
@@ -1,43 +0,0 @@
1Author: Sergio Durigan Junior <sergio.durigan@canonical.com>
2
3A few adjustments needed to:
4
5 - Disable outputs.influxdb, which, if enabled, will pollute the logs
6 if influxdb is not installed.
7 - Enable outputs.prometheus_client.
8
9diff --git a/etc/telegraf.conf b/etc/telegraf.conf
10index 62bc616..6439457 100644
11--- a/etc/telegraf.conf
12+++ b/etc/telegraf.conf
13@@ -102,7 +102,7 @@
14
15
16 # Configuration for sending metrics to InfluxDB
17-[[outputs.influxdb]]
18+#[[outputs.influxdb]]
19 ## The full HTTP or UDP URL for your InfluxDB instance.
20 ##
21 ## Multiple URLs can be specified for a single cluster, only ONE of the
22@@ -1118,17 +1119,17 @@
23
24
25 # # Configuration for the Prometheus client to spawn
26-# [[outputs.prometheus_client]]
27+[[outputs.prometheus_client]]
28 # ## Address to listen on
29-# listen = ":9273"
30-#
31+ listen = "127.0.0.1:9273"
32+
33 # ## Metric version controls the mapping from Telegraf metrics into
34 # ## Prometheus format. When using the prometheus input, use the same value in
35 # ## both plugins to ensure metrics are round-tripped without modification.
36 # ##
37 # ## example: metric_version = 1; deprecated in 1.13
38 # ## metric_version = 2; recommended version
39-# # metric_version = 1
40+ metric_version = 2
41 #
42 # ## Use HTTP Basic Authentication.
43 # # basic_username = "Foo"

Subscribers

People subscribed via source and target branches

to all changes: