2024-11-11 16:30:41 -05:00
|
|
|
FROM ubuntu:24.10
|
2017-01-05 17:03:47 -05:00
|
|
|
|
2020-12-29 08:42:58 -05:00
|
|
|
# Shellcheck and esh versions
|
2024-11-11 16:30:41 -05:00
|
|
|
ARG SC_VER=0.10.0
|
2023-07-08 15:25:26 -04:00
|
|
|
ARG ESH_VER=0.3.2
|
2020-12-21 16:30:28 -05:00
|
|
|
|
2020-12-29 08:42:58 -05:00
|
|
|
# Install prerequisites and configure UTF-8 locale
|
2019-02-28 23:28:32 -05:00
|
|
|
RUN \
|
2020-12-29 08:42:58 -05:00
|
|
|
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen \
|
|
|
|
&& apt-get update \
|
|
|
|
&& DEBIAN_FRONTEND=noninteractive \
|
|
|
|
apt-get install -y --no-install-recommends \
|
2019-02-28 23:28:32 -05:00
|
|
|
expect \
|
|
|
|
git \
|
2019-11-30 21:15:46 -05:00
|
|
|
gnupg \
|
2024-11-11 16:30:41 -05:00
|
|
|
j2cli \
|
2020-12-29 08:42:58 -05:00
|
|
|
locales \
|
2019-02-28 23:28:32 -05:00
|
|
|
lsb-release \
|
|
|
|
make \
|
2020-01-20 09:21:57 -05:00
|
|
|
man \
|
2019-02-28 23:28:32 -05:00
|
|
|
python3-pip \
|
2020-12-29 08:42:58 -05:00
|
|
|
vim-tiny \
|
|
|
|
xz-utils \
|
|
|
|
&& rm -rf /var/lib/apt/lists/* \
|
|
|
|
&& update-locale LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
|
2020-12-21 16:30:28 -05:00
|
|
|
|
2020-12-29 08:42:58 -05:00
|
|
|
ENV LANG='en_US.UTF-8' LANGUAGE='en_US:en' LC_ALL='en_US.UTF-8'
|
|
|
|
|
|
|
|
# Convenience settings for the testbed's root account
|
|
|
|
RUN echo 'set -o vi' >> /root/.bashrc
|
2020-12-21 16:30:28 -05:00
|
|
|
|
2020-12-29 08:42:58 -05:00
|
|
|
# Create a flag to identify when running inside the yadm testbed
|
|
|
|
RUN touch /.yadmtestbed
|
|
|
|
|
|
|
|
# Install shellcheck
|
|
|
|
ADD https://github.com/koalaman/shellcheck/releases/download/v$SC_VER/shellcheck-v$SC_VER.linux.x86_64.tar.xz /opt
|
|
|
|
RUN cd /opt \
|
|
|
|
&& tar xf shellcheck-v$SC_VER.linux.x86_64.tar.xz \
|
|
|
|
&& rm -f shellcheck-v$SC_VER.linux.x86_64.tar.xz \
|
|
|
|
&& ln -s /opt/shellcheck-v$SC_VER/shellcheck /usr/local/bin
|
|
|
|
|
2024-11-11 16:30:41 -05:00
|
|
|
# Install requirements
|
2020-12-21 16:30:28 -05:00
|
|
|
COPY test/requirements.txt /tmp/requirements.txt
|
2024-11-11 16:30:41 -05:00
|
|
|
RUN python3 -m pip install --break-system-packages -r /tmp/requirements.txt \
|
2020-12-29 08:42:58 -05:00
|
|
|
&& rm -f /tmp/requirements
|
2017-01-05 17:03:47 -05:00
|
|
|
|
2020-12-29 08:42:58 -05:00
|
|
|
# Install esh
|
|
|
|
ADD https://raw.githubusercontent.com/jirutka/esh/v$ESH_VER/esh /usr/local/bin
|
|
|
|
RUN chmod +x /usr/local/bin/esh
|
|
|
|
|
|
|
|
# Create workdir and dummy Makefile to be used if no /yadm volume is mounted
|
|
|
|
RUN mkdir /yadm \
|
|
|
|
&& echo "test:" > /yadm/Makefile \
|
|
|
|
&& echo "\t@echo 'The yadm project must be mounted at /yadm'" >> /yadm/Makefile \
|
|
|
|
&& echo "\t@echo 'Try using a docker parameter like -v \"\$\$PWD:/yadm:ro\"'" >> /yadm/Makefile \
|
|
|
|
&& echo "\t@false" >> /yadm/Makefile
|
2020-05-19 22:27:14 -04:00
|
|
|
|
2020-12-29 13:49:41 -05:00
|
|
|
# Include released versions of yadm to test upgrades
|
2024-10-30 18:18:49 -04:00
|
|
|
ADD https://raw.githubusercontent.com/yadm-dev/yadm/1.12.0/yadm /usr/local/bin/yadm-1.12.0
|
|
|
|
ADD https://raw.githubusercontent.com/yadm-dev/yadm/2.5.0/yadm /usr/local/bin/yadm-2.5.0
|
2020-12-29 13:49:41 -05:00
|
|
|
RUN chmod +x /usr/local/bin/yadm-*
|
|
|
|
|
2020-12-29 13:51:55 -05:00
|
|
|
# Configure git to make it easier to test yadm manually
|
|
|
|
RUN git config --system user.email "test@yadm.io" \
|
|
|
|
&& git config --system user.name "Yadm Test"
|
|
|
|
|
2017-01-05 17:03:47 -05:00
|
|
|
# /yadm will be the work directory for all tests
|
|
|
|
# docker commands should mount the local yadm project as /yadm
|
|
|
|
WORKDIR /yadm
|
|
|
|
|
|
|
|
# By default, run all tests defined
|
|
|
|
CMD make test
|