From 273a970349532391b9bc03c177c0da3a5a355b79 Mon Sep 17 00:00:00 2001
From: Chase Qi <chase.qi@linaro.org>
Date: Thu, 2 Jun 2022 10:32:42 +0800
Subject: [PATCH] .oniro-ci/containers/bitbake-builder: add support for runqemu

Part of gcc oeself-test is client/server based. It uses qemu vm for
native tests via ssh. The vm is launched by runqemu command which
requires the following changes in the docker image.

* passwordless sudo permission
* package iptables pre-installed

Signed-off-by: Chase Qi <chase.qi@linaro.org>
---
 .oniro-ci/containers/bitbake-builder/Dockerfile | 7 +++++--
 1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/.oniro-ci/containers/bitbake-builder/Dockerfile b/.oniro-ci/containers/bitbake-builder/Dockerfile
index 0d88a2bf..df3e95d1 100644
--- a/.oniro-ci/containers/bitbake-builder/Dockerfile
+++ b/.oniro-ci/containers/bitbake-builder/Dockerfile
@@ -26,7 +26,7 @@ RUN apt-get update -qq \
 	bash git-repo git-lfs apt-utils build-essential chrpath cpio diffstat \
 	gawk git sudo wget language-pack-en-base time locales python-is-python3 \
 	python3-distutils python3-pip libssl-dev iproute2 iputils-ping curl jq \
-	lz4 zstd \
+	lz4 zstd iptables\
  && eatmydata apt-get install -qq -y 'ca-certificates=20210119~20.04.2' \
  && eatmydata apt-get clean && rm -rf /var/lib/apt/lists/*
 RUN locale-gen
@@ -36,7 +36,10 @@ RUN pip3 install anybadge
 RUN echo "dash dash/sh boolean false" | debconf-set-selections \
  && DEBIAN_FRONTEND=noninteractive dpkg-reconfigure dash
 
-RUN useradd --create-home --uid 1000 --shell /usr/bin/bash builder
+RUN useradd --create-home --uid 1000 --shell /usr/bin/bash builder \
+ && usermod -aG sudo builder\
+ && echo "builder ALL=(ALL) NOPASSWD: ALL" >> /etc/sudoers
+
 COPY --chown=builder:builder .gitconfig /home/builder/.gitconfig
 USER builder
 WORKDIR /home/builder
-- 
GitLab