argo-cd/test/remote/Dockerfile
jannfis 9afa8333b4
chore: Make e2e tests runnable against remote cluster (#5895)
* chore: Make e2e tests runnable against remote cluster

Signed-off-by: jannfis <jann@mistrust.net>

* Fix linter complaint

Signed-off-by: jannfis <jann@mistrust.net>

* Revert

Signed-off-by: jannfis <jann@mistrust.net>

* Address reviewer comments

Signed-off-by: jannfis <jann@mistrust.net>

* Compat with Mac

Signed-off-by: jannfis <jann@mistrust.net>

* Revert test setting

Signed-off-by: jannfis <jann@mistrust.net>
2021-04-07 14:49:17 +02:00

86 lines
3.2 KiB
Docker

FROM golang:1.16.2 AS go
RUN go get github.com/mattn/goreman && \
go get github.com/kisielk/godepgraph
FROM ubuntu:20.10
ENV DEBIAN_FRONTEND=noninteractive
RUN apt-get update && apt-get install -y \
ca-certificates \
curl \
openssh-server \
nginx \
fcgiwrap \
git \
git-lfs \
gpg \
make \
wget \
gcc \
sudo \
zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
RUN mkdir -p /etc/certs
# These are required for running end-to-end tests
COPY ./test/fixture/testrepos/id_rsa.pub /root/.ssh/authorized_keys
COPY ./test/fixture/testrepos/nginx.conf /etc/nginx/nginx.conf
COPY ./test/fixture/testrepos/.htpasswd /etc/nginx/.htpasswd
COPY ./test/fixture/testrepos/sudoers.conf /etc/sudoers
COPY ./test/fixture/testrepos/ssh_host_*_key* /etc/ssh/
COPY ./test/fixture/certs/argocd-e2e-server.crt /etc/certs/argocd-test-server.crt
COPY ./test/fixture/certs/argocd-e2e-server.key /etc/certs/argocd-test-server.key
COPY ./test/fixture/certs/argocd-test-ca.crt /etc/certs/argocd-test-ca.crt
# Entrypoint is required for container's user management
COPY ./test/remote/uid_entrypoint.sh /usr/local/bin
COPY ./test/remote/Procfile /Procfile
# We need goreman
COPY --from=go /go/bin/goreman /usr/local/bin/goreman
COPY ./test/e2e/testdata/ /app/config/testdata/
# Prepare user configuration & build environments
RUN useradd -l -u 1000 -d /home/user -s /bin/bash user && \
echo "user ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/user && \
mkdir -p /home/user && \
HOME=/home/user git config --global user.name "ArgoCD Test User" && \
HOME=/home/user git config --global user.email "noreply@example.com" && \
mkdir -p /var/run/sshd && \
mkdir -p /root/.ssh && \
chown -R user /home/user && \
chgrp -R user /home/user && \
chown root /etc/ssh/ssh_host_*_key* && \
chmod 0600 /etc/ssh/ssh_host_*_key && \
mkdir -p /tmp/argo-e2e/testdata.git && \
cd /tmp/argo-e2e/testdata.git && \
HOME=/home/user git init --bare && \
cd /app/config/testdata && \
HOME=/home/user git init && \
HOME=/home/user git add . && \
HOME=/home/user git commit -a -m "Initial commit" && \
HOME=/home/user git remote add origin file:///tmp/argo-e2e/testdata.git && \
HOME=/home/user git push origin master && \
mkdir -p /tmp/argo-e2e/submodule.git && \
cd /tmp/argo-e2e/submodule.git && \
HOME=/home/user git init --bare && \
mkdir -p /tmp/argo-e2e/submoduleParent.git && \
cd /tmp/argo-e2e/submoduleParent.git && \
HOME=/home/user git init --bare && \
chown -R user /tmp/argo-e2e/testdata.git && \
chown -R user /tmp/argo-e2e/submodule.git && \
chown -R user /tmp/argo-e2e/submoduleParent.git && \
ln -s /usr/libexec/git-core /usr/lib/git-core
RUN echo "[http]" >> /tmp/argo-e2e/testdata.git/config && \
echo " receivepack = true" >> /tmp/argo-e2e/testdata.git/config
RUN echo "[http]" >> /tmp/argo-e2e/submodule.git/config && \
echo " receivepack = true" >> /tmp/argo-e2e/submodule.git/config
RUN echo "[http]" >> /tmp/argo-e2e/submoduleParent.git/config && \
echo " receivepack = true" >> /tmp/argo-e2e/submoduleParent.git/config
ENTRYPOINT ["/usr/local/bin/uid_entrypoint.sh"]