Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 10 additions & 9 deletions docker/base/Dockerfile.j2
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,6 @@ COPY curlrc /root/.curlrc
ENV LANG en_US.UTF-8
{% endblock %}

{# NOTE(SamYaple): Avoid uid/gid conflicts by creating each user/group up front. #}
{# Specifics required such as homedir or shell are configured within the service specific image #}
{%- for name, user in users | dictsort() %}
{% if loop.first -%}RUN {% else %} && {% endif -%}
groupadd --gid {{ user.gid }} {{ user.group }} \
&& useradd -l -M --shell /usr/sbin/nologin --uid {{ user.uid }} --gid {{ user.gid }} {{ name }}
{%- if not loop.last %} \{% endif -%}
{%- endfor %}

LABEL kolla_version="{{ kolla_version }}"

{% import "macros.j2" as macros with context %}
Expand Down Expand Up @@ -223,6 +214,7 @@ RUN {{ macros.install_packages(base_centos_yum_repo_packages | customizable("cen
'socat',
'sudo',
'tar',
'util-linux',
'util-linux-user',
'which'
] %}
Expand Down Expand Up @@ -358,6 +350,15 @@ RUN apt-get update \
{# endif base_package_type deb #}
{% endif %}

{# NOTE(SamYaple): Avoid uid/gid conflicts by creating each user/group up front. #}
{# Specifics required such as homedir or shell are configured within the service specific image #}
{%- for name, user in users | dictsort() %}
{% if loop.first -%}RUN {% else %} && {% endif -%}
groupadd --gid {{ user.gid }} {{ user.group }} \
&& useradd -l -M --shell /usr/sbin/nologin --uid {{ user.uid }} --gid {{ user.gid }} {{ name }}
{%- if not loop.last %} \{% endif -%}
{%- endfor %}

{% if base_distro == 'centos' %}
RUN sed -ri '/-session(\s+)optional(\s+)pam_systemd.so/d' /etc/pam.d/system-auth \
&& sed -ri '/^[^#]/ s/systemd//g' /etc/nsswitch.conf
Expand Down
6 changes: 6 additions & 0 deletions tests/playbooks/pre.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,12 @@
apt_repository:
repo: "deb {{ nodepool_docker_proxy }}/{{ ansible_distribution | lower }} {{ ansible_distribution_release }} stable"
state: present

- name: Ensure AppArmor is installed
package:
name: apparmor
state: present

when: ansible_os_family == "Debian"
become: true

Expand Down
4 changes: 3 additions & 1 deletion tests/playbooks/run.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
DEFAULT:
debug: true
logs_dir: "{{ kolla_build_logs_dir }}"
work_dir: "{{ kolla_logs_dir }}/work_dir"
quiet: true
base: "{{ base_distro }}"
install_type: "{{ install_type }}"
Expand Down Expand Up @@ -43,5 +42,8 @@
src: "{{ zuul.executor.work_root }}/{{ zuul.project.src_dir }}/tests/templates/template_overrides.j2"
dest: /etc/kolla/template_overrides.j2

- name: Run kolla-build to template out dockerfiles
command: "{{ virtualenv_path }}/bin/kolla-build --template-only --work-dir {{ kolla_build_logs_dir }}/work_dir"

- name: Run kolla-build
command: "{{ virtualenv_path }}/bin/kolla-build"