Merge ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04-fix-missing-manifest into ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04

Proposed by Athos Ribeiro
Status: Merged
Merge reported by: Athos Ribeiro
Merged at revision: e1678ab3d83b66e79c880fb24caf6b0f39c3854d
Proposed branch: ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04-fix-missing-manifest
Merge into: ~ubuntu-docker-images/ubuntu-docker-images/+git/telegraf:1.17-21.04
Diff against target: 26 lines (+6/-3)
1 file modified
Dockerfile (+6/-3)
Reviewer Review Type Date Requested Status
Sergio Durigan Junior Approve
Ubuntu Docker Images Pending
Review via email: mp+406563@code.launchpad.net

Description of the change

Do not use pipes in RUN commands

Using pipes without properly handling the earlier commands may conceal errors even when "set -e" is used.

Since setting the pipefail option may not be an alternative (we are using dash), we should refactor commands using pipes to avoid concealing errors.

This should avoid releasing images with missing bits.

To post a comment you must log in.
Revision history for this message
Sergio Durigan Junior (sergiodj) wrote :

Thank you for the MP and for catching this problem, Athos. Needless to say, I totally agree with the rationale here. It crossed my mind that we'd be creating new files under /tmp, but since we're doing this in the first stage (build), that's alright.

On a side note: as I told you during standup, I think we can do better in our unit tests and make sure that the generated manifest is not empty. I will submit a PR shortly to address this.

BTW, we will need to update the 20.04 Dockerfile as well.

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

Sorry, I've just noticed that you filed an MP for the 20.04 image. Please ignore the last sentence.

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1diff --git a/Dockerfile b/Dockerfile
2index 2f858b1..3bcd73f 100644
3--- a/Dockerfile
4+++ b/Dockerfile
5@@ -3,7 +3,8 @@ FROM ubuntu:hirsute AS manifest-builder
6 WORKDIR /src/telegraf
7
8 RUN set -eux; \
9- grep '^deb ' /etc/apt/sources.list | sed 's/^deb/deb-src/' >> /etc/apt/sources.list; \
10+ grep '^deb ' /etc/apt/sources.list > /tmp/bin-repos-sources.list; \
11+ sed 's/^deb/deb-src/' /tmp/bin-repos-sources.list >> /etc/apt/sources.list; \
12 DEBIAN_FRONTEND=noninteractive apt-get update; \
13 DEBIAN_FRONTEND=noninteractive apt-get full-upgrade -y; \
14 DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends \
15@@ -16,8 +17,10 @@ RUN set -eux; \
16 #
17 # https://github.com/golang/go/issues/35224
18 # https://bugs.launchpad.net/docker.io/+bug/1916296
19- go list -mod=mod -m all | tail -n +2 > /src/telegraf/telegraf-mods.txt; \
20- /src/telegraf/utils/golang-manifest-builder.py /src/telegraf/telegraf-mods.txt | tee /src/telegraf/manifest-upstream.txt
21+ go list -mod=mod -m all > /tmp/telegraf-go-list.output; \
22+ tail -n +2 /tmp/telegraf-go-list.output > /src/telegraf/telegraf-mods.txt; \
23+ /src/telegraf/utils/golang-manifest-builder.py /src/telegraf/telegraf-mods.txt > /src/telegraf/manifest-upstream.txt; \
24+ cat /src/telegraf/manifest-upstream.txt
25
26 FROM ubuntu:hirsute
27

Subscribers

People subscribed via source and target branches

to all changes: