From 71f24e2bcaf4191fee021ddaaa1a15b9bf3cb2e4 Mon Sep 17 00:00:00 2001 From: Dan Duvall Date: Fri, 27 Apr 2018 15:10:08 -0700 Subject: Ensure non-interactive front-end for APT Summary: Ensure that `DEBIAN_FRONTEND=noninteractive` is set before injecting `apt-get install` instructions. Test Plan: Run unit tests. Reviewers: thcipriani, mmodell, hashar, demon, #release-engineering-team Reviewed By: thcipriani, #release-engineering-team Tags: #release-engineering-team Differential Revision: https://phabricator.wikimedia.org/D1032 --- config/apt.go | 3 +++ config/apt_test.go | 3 +++ 2 files changed, 6 insertions(+) diff --git a/config/apt.go b/config/apt.go index 01f914e..bafc06a 100644 --- a/config/apt.go +++ b/config/apt.go @@ -30,6 +30,9 @@ func (apt AptConfig) InstructionsForPhase(phase build.Phase) []build.Instruction switch phase { case build.PhasePrivileged: return []build.Instruction{ + build.Env{map[string]string{ + "DEBIAN_FRONTEND": "noninteractive", + }}, build.RunAll{[]build.Run{ {"apt-get update", []string{}}, {"apt-get install -y", apt.Packages}, diff --git a/config/apt_test.go b/config/apt_test.go index 751bfcd..df2480d 100644 --- a/config/apt_test.go +++ b/config/apt_test.go @@ -40,6 +40,9 @@ func TestAptConfigInstructions(t *testing.T) { t.Run("PhasePrivileged", func(t *testing.T) { assert.Equal(t, []build.Instruction{ + build.Env{map[string]string{ + "DEBIAN_FRONTEND": "noninteractive", + }}, build.RunAll{[]build.Run{ {"apt-get update", []string{}}, {"apt-get install -y", []string{"libfoo", "libbar"}}, -- cgit v1.2.1