diff --git a/dev-tools/mage/pkgdeps.go b/dev-tools/mage/pkgdeps.go index 626cd833c92..1e07ec36efc 100644 --- a/dev-tools/mage/pkgdeps.go +++ b/dev-tools/mage/pkgdeps.go @@ -117,19 +117,23 @@ func installDependencies(arch string, pkgs ...string) error { } } - if err := sh.Run("apt-get", "update"); err != nil { + // TODO: This is only for debian 7 and should be removed when move to a newer OS. This flag is + // going to be used unnecessary when building using non-debian7 images + // (like when making the linux/arm binaries) and we should remove it soonish. + // See https://github.com/elastic/beats/v7/issues/11750 for more details. + if err := sh.Run("apt-get", "update", "-o", "Acquire::Check-Valid-Until=false"); err != nil { return err } - params := append([]string{"install", "-y", "--force-yes", - "--no-install-recommends", - - // Journalbeat is built with old versions of Debian that don't update - // their repositories, so they have expired keys. + params := append([]string{ + // Due to the expired GPG keys in the old Debian version we must use `--force-yes` additionally to `-y`. + "install", "-y", "--force-yes", // Allow unauthenticated packages. // This was not enough: "-o", "Acquire::Check-Valid-Until=false", "--allow-unauthenticated", + "--no-install-recommends", }, pkgs...) + return sh.Run("apt-get", params...) }