Skip to content

Commit

Permalink
Convert user creation to snippet and use UID instead of username.
Browse files Browse the repository at this point in the history
I skipped the rpm templates for now because they do more and don't have
this problem yet.
  • Loading branch information
nuclearsandwich committed Mar 10, 2024
1 parent 4403d1e commit d88abf0
Show file tree
Hide file tree
Showing 25 changed files with 120 additions and 47 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -40,7 +43,7 @@ RUN echo "@today_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python3-catkin-pkg-modules python3-empy python3-pip python3-rosdistro-modules python3-yaml
RUN pip3 install jenkinsapi

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/ci/ci_create_tasks.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -49,7 +52,7 @@ RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python
RUN echo "@now_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update

USER buildfarm
USER @uid

@[for repos_file in repos_file_names]@
COPY @repos_file /tmp/@repos_file
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/ci/create_workspace.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -88,7 +91,7 @@ RUN python3 -u /tmp/wrapper_scripts/apt.py update
COPY @repos_file /tmp/@repos_file
@[end for]@

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
install_paths = [os.path.join(root, 'install_isolated') for root in workspace_root[0:-1]]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -40,7 +43,7 @@ RUN echo "@today_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python3-catkin-pkg-modules python3-empy python3-pip python3-rosdistro-modules python3-yaml
RUN pip3 install jenkinsapi

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@[if require_gpu_support]@
@(TEMPLATE(
Expand Down Expand Up @@ -62,7 +65,7 @@ ENV ROSDISTRO_INDEX_URL @rosdistro_index_url
custom_rosdep_urls=custom_rosdep_urls,
))@

USER buildfarm
USER @uid

ENTRYPOINT ["sh", "-c"]
@{
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/devel/devel_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/setup_nvidia_docker2.Dockerfile.em'
Expand Down Expand Up @@ -113,7 +116,7 @@ RUN pip3 install -U auto_abi_checker
# TODO(nuclearsandwich) add link to Debian bug report when one is opened.
RUN which update-ccache-symlinks >/dev/null 2>&1 && update-ccache-symlinks

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -40,7 +43,7 @@ RUN echo "@today_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python3-catkin-pkg-modules python3-empy python3-pip python3-rosdistro-modules python3-yaml
RUN pip3 install jenkinsapi

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/doc/doc_create_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -49,7 +52,7 @@ ENV ROSDISTRO_INDEX_URL @rosdistro_index_url
custom_rosdep_urls=custom_rosdep_urls,
))@

USER buildfarm
USER @uid

ENTRYPOINT ["sh", "-c"]
@{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -45,7 +48,7 @@ RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y @(' '.join
RUN pip3 install -U @(' '.join(install_pip_packages))
@[end if]@

USER buildfarm
USER @uid

ENTRYPOINT ["sh", "-c"]
@{
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/doc/doc_metadata_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand All @@ -39,7 +42,7 @@ RUN echo "@today_str"

RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y python3-catkin-pkg-modules python3-rosdistro-modules python3-yaml

USER buildfarm
USER @uid

ENTRYPOINT ["sh", "-c"]
@{
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/doc/doc_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/set_environment_variables.Dockerfile.em',
Expand Down Expand Up @@ -86,7 +89,7 @@ RUN dpkg -i /tmp/doxygen_1.7.6.1-2ubuntu1_amd64.deb
RUN doxygen --version
@[end if]@

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
# empy fails using rosdoc_config_files in a list comprehension
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/doc/rosdoc2_create_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -42,7 +45,7 @@ RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python
RUN echo "@now_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update

USER buildfarm
USER @uid

ENTRYPOINT ["sh", "-c"]
@{
Expand Down
7 changes: 5 additions & 2 deletions ros_buildfarm/templates/doc/rosdoc2_task.Dockerfile.em
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand All @@ -43,7 +46,7 @@ RUN echo "@today_str"

RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y -o Debug::pkgProblemResolver=yes build-essential python3-catkin-pkg-modules doxygen graphviz openssh-client python3 python3-yaml python3-pip rsync

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = 'PYTHONPATH=/tmp/ros_buildfarm:$PYTHONPATH python3 -u' + \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand All @@ -39,7 +42,7 @@ RUN echo "@today_str"

RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python3-catkin-pkg-modules python3-rosdistro python3-yaml

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmds = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ ENV DEBIAN_FRONTEND noninteractive
))@


RUN test getent passwd @uid || useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -88,7 +91,7 @@ RUN . /etc/os-release && test "$VERSION_ID" = "20.04" && test "$(uname -m)" = "a
install_lists=install_lists,
))@

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -56,7 +59,7 @@ RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y debhelper
RUN sed -i '/ main_tree = repo.tree_drop_dirs(upstream_tree, options.subtarballs)/c\ main_tree = repo.tree_drop_dirs(upstream_tree, options.subtarballs) if options.subtarballs else upstream_tree' /usr/lib/python2.7/dist-packages/gbp/scripts/buildpackage.py
@[end if]@

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmds = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand All @@ -39,7 +42,7 @@ RUN echo "@today_str"

RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y python3-rosdistro-modules python3-yaml

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,10 @@ ENV DEBIAN_FRONTEND noninteractive
timezone=timezone,
))@

RUN useradd -u @uid -l -m buildfarm
@(TEMPLATE(
'snippet/ensure_user_exists.Dockerfile.em',
uid=uid,
))@

@(TEMPLATE(
'snippet/add_distribution_repositories.Dockerfile.em',
Expand Down Expand Up @@ -40,7 +43,7 @@ RUN echo "@today_str"
RUN python3 -u /tmp/wrapper_scripts/apt.py update-install-clean -q -y git python3-catkin-pkg-modules python3-empy python3-pip python3-rosdistro-modules python3-yaml
RUN pip3 install jenkinsapi

USER buildfarm
USER @uid
ENTRYPOINT ["sh", "-c"]
@{
cmd = \
Expand Down
Loading

0 comments on commit d88abf0

Please sign in to comment.