Bug 1247168 - Introduce scripts for running action and decision tasks; r=dustin

When we switch to use robustcheckout for version control foo, we'll
also be taking the opportunity to have the decision and action tasks
execute as the "worker" user.

Since caches are mounted and owned by root and since tasks initially
run as root, this makes defining the container command in YAML a bit
difficult because we have to do some work as root then switch users
and continue executing. Rather than shoehorning all that complicated
logic into YAML, we introduce bash scripts that do it. These will
be plugged into the task YAML when we formally switch the tasks
to use the new Docker image.

We provide one script for running Gecko decision tasks. We provide
another for running action tasks. These are the two consumers of
the decision image we care about.

We also sneak in a change to add the executable bit to checkout-gecko.

MozReview-Commit-ID: CXlyHZJSHcP

--HG--
extra : rebase_source : 80621d4833a9d745eaff7da4641dfd4ace8ae1db
extra : histedit_source : e6ce7de5d14c8781d8dd94a8eff76c3227cd18b5
This commit is contained in:
Gregory Szorc 2016-07-21 11:44:55 -07:00
Родитель b56b243b81
Коммит a43ac5b4de
5 изменённых файлов: 40 добавлений и 2 удалений

Просмотреть файл

@ -9,7 +9,6 @@ ADD system-setup.sh tooltool.py /tmp/
RUN bash /tmp/system-setup.sh RUN bash /tmp/system-setup.sh
ADD bin /home/worker/bin ADD bin /home/worker/bin
RUN chmod +x /home/worker/bin/*
ENV PATH /home/worker/bin:$PATH ENV PATH /home/worker/bin:$PATH
ENV SHELL /bin/bash ENV SHELL /bin/bash

0
testing/docker/decision/bin/checkout-gecko Normal file → Executable file
Просмотреть файл

Просмотреть файл

@ -0,0 +1,19 @@
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -ex
# The script starts executing as root. We need to change ownership
# of the caches because they are initially owned by root:root.
if [ $(id -u) = 0 ]; then
chown worker:worker /home/worker/hg-shared /home/worker/workspace
exec sudo -E -u worker /home/worker/bin/run-action "${@}"
fi
/home/worker/bin/checkout-gecko /home/worker/workspace/gecko
cd /home/worker/workspace/gecko
ln -s /home/worker/artifacts artifacts &&
eval "./mach taskgraph action-task ${ACTION_ARGS}"

Просмотреть файл

@ -0,0 +1,19 @@
#!/bin/bash
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
set -ex
# The script starts executing as root. We need to change ownership
# of the caches because they are initially owned by root:root.
if [ $(id -u) = 0 ]; then
chown worker:worker /home/worker/hg-shared /home/worker/workspace
exec sudo -E -u worker /home/worker/bin/run-decision "${@}"
fi
/home/worker/bin/checkout-gecko /home/worker/workspace/gecko
cd /home/worker/workspace/gecko
ln -s /home/worker/artifacts artifacts
eval "./mach taskgraph decision ${DECISION_ARGS}"

Просмотреть файл

@ -9,7 +9,8 @@ apt-get install -y --force-yes --no-install-recommends \
ca-certificates \ ca-certificates \
curl \ curl \
jq \ jq \
python python \
sudo
BUILD=/root/build BUILD=/root/build
mkdir $BUILD mkdir $BUILD