| # Copyright 2024 The Chromium Authors |
| # Use of this source code is governed by a BSD-style license that can be |
| # found in the LICENSE file. |
| |
| FROM gcr.io/dockerized-tradefed/tradefed:latest |
| |
| ARG ARTIFACT_DIR="tf_artifact" |
| |
| USER root |
| |
| # Automatically set the answer for the wireshark-common package in tshark to "Yes" |
| RUN echo "wireshark-common wireshark-common/install-setuid boolean true" | sudo debconf-set-selections |
| |
| RUN export DEBIAN_FRONTEND=noninteractive && apt-get update \ |
| && apt-get install -y \ |
| attr \ |
| ca-certificates \ |
| iproute2 \ |
| python-pip \ |
| # sox is a test dependency for audio tests.\ |
| sox \ |
| xxd \ |
| acpica-tools \ |
| tshark \ |
| gnupg \ |
| && dpkg-reconfigure wireshark-common |
| |
| # grab gsutil |
| RUN echo \ |
| "deb [signed-by=/usr/share/keyrings/cloud.google.gpg] \ |
| http://packages.cloud.google.com/apt cloud-sdk main" | \ |
| tee /etc/apt/sources.list.d/google-cloud-sdk.list && \ |
| curl https://packages.cloud.google.com/apt/doc/apt-key.gpg | \ |
| gpg --dearmor -o /usr/share/keyrings/cloud.google.gpg && \ |
| apt-get update -y && apt-get install -y google-cloud-cli=548.0.0-0 && \ |
| rm -rf /usr/lib/google-cloud-sdk/bin/anthoscli \ |
| /usr/lib/google-cloud-sdk/bin/kuberun |
| |
| # Point /usr/bin/python3 to usr/local/bin/python3. See b/191884161 |
| RUN sudo rm /usr/bin/python3*; exit 0 |
| RUN sudo ln -s /usr/local/bin/python3 /usr/bin/python3 |
| |
| # Config the user |
| # dialout added for b/273797484 |
| # wireshark group used by tshark added for b/434113371 |
| RUN useradd -m chromeos-test -G dialout,wireshark |
| RUN echo 'chromeos-test ALL=NOPASSWD:ALL' > /etc/sudoers.d/chromeos-test |
| |
| # Cros-test binary is static across boards. |
| COPY --chown=chromeos-test:chromeos-test cros-test /usr/bin/ |
| |
| RUN getent group nobody || groupadd nobody |
| |
| # Install the GRTE binary |
| COPY --chown=chromeos-test:chromeos-test ${ARTIFACT_DIR}/grte*.deb /tmp/ |
| RUN dpkg -i /tmp/grte*.deb && rm /tmp/grte*.deb |
| # ############################################################################### |
| # Everything above this point should not be changing often (ie not every build) |
| # Everything below this point is possible/likely to change per build |
| # ############################################################################### |
| |
| RUN mkdir -p /tmp/test/logs |
| |
| COPY --chown=chromeos-test:chromeos-test tradefed_runner.sh /tradefed |
| |
| # Do a final chmod and chown |
| RUN chmod 755 /usr/bin/cros-test |
| RUN chown -R chromeos-test:chromeos-test /tmp/test/ |
| RUN chmod -R a+rwx /tradefed |
| RUN chown -R chromeos-test:chromeos-test /tradefed |
| |
| # Create mobly directory |
| ARG MOBLY_DIR="/usr/local/mobly" |
| RUN mkdir -p ${MOBLY_DIR} |
| RUN chown -R chromeos-test:chromeos-test ${MOBLY_DIR} |
| RUN chmod -R 755 ${MOBLY_DIR} |
| |
| USER chromeos-test |
| |
| # Configure testing_rsa keys |
| COPY --chown=chromeos-test:chromeos-test wellknown_ssh_key wellknown_ssh_key |
| RUN mkdir -p ~/.ssh/ |
| RUN cp wellknown_ssh_key ~/.ssh/testing_rsa |
| RUN chmod 400 ~/.ssh/testing_rsa |
| |
| # Configure ssh config for chromeos-test |
| RUN echo '\n\ |
| Host android* brillo* chromeos1* chromeos2* chromeos3* chromeos4* chromeos5* chromeos6* chromeos7* chromeos9* autotest*.vrlab* jetstream* satlab* cros-* \n\ |
| GSSAPIKeyExchange no \n\ |
| GSSAPITrustDns no \n\ |
| GSSAPIDelegateCredentials no \n\ |
| GSSAPIAuthentication no \n\ |
| GSSAPIKeyExchange no \n\ |
| GSSAPIClientIdentity no \n\ |
| GSSAPIRenewalForcesRekey no \n\ |
| ForwardAgent no \n\ |
| ForwardX11 no \n\ |
| PreferredAuthentications publickey \n\ |
| StrictHostKeyChecking no \n\ |
| User root \n\ |
| IdentityFile %d/.ssh/testing_rsa \n\ |
| \n\ |
| Host * \n\ |
| StrictHostKeyChecking=no \n\ |
| IdentityFile %d/.ssh/testing_rsa \n\ |
| UserKnownHostsFile=/dev/null \n\ |
| '> ~/.ssh/config |
| |
| # Configure TradeFed environment. |
| ENV APE_API_KEY=/tmp/test/gts-arc.json |
| ENV TZ=Etc/UTC |
| ENV USE_HOST_ADB=true |
| ENV TF_GLOBAL_CONFIG=configs/cluster/al-ate/al-lab-host-config.xml |
| ENV TF_GLOBAL_CONFIG_SERVER_CONFIG=google/atp/gcs-lab-config-server-config |
| ENV GLOBAL_LOG_PATH=/tmp/test/logs |
| |
| ENV PATH=/tradefed:$PATH |
| |
| ENTRYPOINT [] |