Skip to content

Commit

Permalink
chore: Fix some annoyances when running locally (argoproj#6576)
Browse files Browse the repository at this point in the history
Signed-off-by: jannfis <[email protected]>
  • Loading branch information
jannfis authored Jun 28, 2021
1 parent 46418f7 commit e5d9c39
Show file tree
Hide file tree
Showing 5 changed files with 32 additions and 3 deletions.
4 changes: 3 additions & 1 deletion test/container/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ RUN apt-get update && apt-get install --fix-missing -y \
wget \
gcc \
sudo \
tini \
zip && \
apt-get clean && \
rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/*
Expand Down Expand Up @@ -100,6 +101,7 @@ RUN useradd -l -u ${UID} -d /home/user -s /bin/bash user && \
ln -s /usr/local/lib/node_modules/npm/bin/npm-cli.js /usr/local/bin/npm && \
ln -s /usr/local/lib/node_modules/npm/bin/npx-cli.js /usr/local/bin/npx && \
ln -s /opt/yarn-v1.22.4/bin/yarn /usr/local/bin/yarn && \
ln -s /opt/yarn-v1.22.4/bin/yarnpkg /usr/local/bin/yarnpkg
ln -s /opt/yarn-v1.22.4/bin/yarnpkg /usr/local/bin/yarnpkg && \
mkdir -p /var/lib/registry && chmod -R 777 /var/lib/registry

ENTRYPOINT ["/usr/local/bin/uid_entrypoint.sh"]
1 change: 1 addition & 0 deletions test/container/Procfile
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ dex: sh -c "test $ARGOCD_IN_CI = true && exit 0; ARGOCD_BINARY_NAME=argocd-dex g
redis: sh -c "/usr/local/bin/redis-server --save "" --appendonly no --port ${ARGOCD_E2E_REDIS_PORT:-6379}"
repo-server: sh -c "FORCE_LOG_COLORS=1 ARGOCD_FAKE_IN_CLUSTER=true ARGOCD_GNUPGHOME=${ARGOCD_GNUPGHOME:-/tmp/argocd-local/gpg/keys} ARGOCD_GPG_DATA_PATH=${ARGOCD_GPG_DATA_PATH:-/tmp/argocd-local/gpg/source} ARGOCD_BINARY_NAME=argocd-repo-server go run ./cmd/main.go --loglevel debug --port ${ARGOCD_E2E_REPOSERVER_PORT:-8081} --redis localhost:${ARGOCD_E2E_REDIS_PORT:-6379}"
ui: sh -c "test $ARGOCD_IN_CI = true && exit 0; cd ui && ARGOCD_E2E_YARN_HOST=0.0.0.0 ${ARGOCD_E2E_YARN_CMD:-yarn} start"
reaper: ./test/container/reaper.sh
sshd: sudo sh -c "test $ARGOCD_E2E_TEST = true && /usr/sbin/sshd -p 2222 -D -e"
fcgiwrap: sudo sh -c "test $ARGOCD_E2E_TEST = true && (fcgiwrap -s unix:/var/run/fcgiwrap.socket & sleep 1 && chmod 777 /var/run/fcgiwrap.socket && wait)"
nginx: sudo sh -c "test $ARGOCD_E2E_TEST = true && nginx -g 'daemon off;' -c $(pwd)/test/fixture/testrepos/nginx.conf"
Expand Down
22 changes: 22 additions & 0 deletions test/container/reaper.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# Simple helper script to kill all running processes in the container that
# have belong to the root user.

# DO NOT RUN OUTSIDE THE DOCKER CONTAINER EXECUTING ARGO CD TESTS.
# YOU HAVE BEEN WARNED.

somefunc() {
echo "Killing all processes"
sudo pkill -u root
}

echo "Running as $0 ($PWD)"
if test "${PWD}" != "/go/src/github.com/argoproj/argo-cd"; then
echo "ERROR: We don't seem to be in Docker container. Exit." >&2
exit 1
fi
trap somefunc 2 15
while :; do
sleep 1
done
6 changes: 5 additions & 1 deletion test/container/uid_entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,8 @@ fi
export PATH=$PATH:/usr/local/go/bin:/go/bin
export GOROOT=/usr/local/go

"$@"
if test "$$" = "1"; then
exec tini -- "$@"
else
exec "$@"
fi
2 changes: 1 addition & 1 deletion test/fixture/testrepos/start-helm-registry.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env bash
export HELM_EXPERIMENTAL_OCI=1
docker run -p 5000:5000 --restart=always --name registry registry
docker run -p 5000:5000 --rm --name registry registry

0 comments on commit e5d9c39

Please sign in to comment.