aboutsummaryrefslogtreecommitdiffstatshomepage
diff options
context:
space:
mode:
authorEgor Tensin <Egor.Tensin@gmail.com>2020-01-09 14:27:22 +0300
committerEgor Tensin <Egor.Tensin@gmail.com>2020-01-09 19:53:31 +0300
commitb74f0554b7a40f2481db8baf3c986516f522f127 (patch)
treee7cdf33851fa82b3e00d5804cd993943c4a0d3e5
parentadd Travis tests (diff)
downloadcgitize-b74f0554b7a40f2481db8baf3c986516f522f127.tar.gz
cgitize-b74f0554b7a40f2481db8baf3c986516f522f127.zip
Travis: add docker tests
-rw-r--r--.dockerignore8
-rw-r--r--.travis.yml5
-rw-r--r--.travis/.gitattributes1
-rw-r--r--.travis/docker/client/etc/my_repos.py6
-rw-r--r--.travis/docker/client/var/output/.gitignore1
-rw-r--r--.travis/docker/docker-compose.yml16
-rw-r--r--.travis/docker/server/Dockerfile22
-rwxr-xr-x.travis/docker/server/setup_repo.sh24
-rw-r--r--.travis/docker/ssh/client_key54
-rw-r--r--.travis/docker/ssh/client_key.pub1
-rw-r--r--.travis/docker/ssh/server_key51
-rw-r--r--.travis/docker/ssh/server_key.pub1
-rwxr-xr-x.travis/docker/test.sh107
-rwxr-xr-x.travis/local/test.sh6
14 files changed, 300 insertions, 3 deletions
diff --git a/.dockerignore b/.dockerignore
new file mode 100644
index 0000000..b09db2c
--- /dev/null
+++ b/.dockerignore
@@ -0,0 +1,8 @@
+**/.git
+**/.gitattributes
+**/.gitignore
+
+.dockerignore
+**/Dockerfile
+
+.travis
diff --git a/.travis.yml b/.travis.yml
index ac4d7fc..635c87c 100644
--- a/.travis.yml
+++ b/.travis.yml
@@ -6,3 +6,8 @@ jobs:
language: python
python: '3.6'
script: ./.travis/local/test.sh
+ - name: Test in Docker
+ language: minimal
+ services:
+ - docker
+ script: ./.travis/docker/test.sh
diff --git a/.travis/.gitattributes b/.travis/.gitattributes
new file mode 100644
index 0000000..dfdb8b7
--- /dev/null
+++ b/.travis/.gitattributes
@@ -0,0 +1 @@
+*.sh text eol=lf
diff --git a/.travis/docker/client/etc/my_repos.py b/.travis/docker/client/etc/my_repos.py
new file mode 100644
index 0000000..2e1bc8b
--- /dev/null
+++ b/.travis/docker/client/etc/my_repos.py
@@ -0,0 +1,6 @@
+from pull.repo import Repo
+
+
+MY_REPOS = (
+ Repo('test_repo', clone_url='root@server:~/test_repo'),
+)
diff --git a/.travis/docker/client/var/output/.gitignore b/.travis/docker/client/var/output/.gitignore
new file mode 100644
index 0000000..355164c
--- /dev/null
+++ b/.travis/docker/client/var/output/.gitignore
@@ -0,0 +1 @@
+*/
diff --git a/.travis/docker/docker-compose.yml b/.travis/docker/docker-compose.yml
new file mode 100644
index 0000000..2b27bdd
--- /dev/null
+++ b/.travis/docker/docker-compose.yml
@@ -0,0 +1,16 @@
+version: '3'
+services:
+ server:
+ build:
+ context: .
+ dockerfile: server/Dockerfile
+ image: server
+ client:
+ build:
+ context: ../..
+ dockerfile: Dockerfile
+ image: client
+ volumes:
+ - ./client/etc/:/etc/cgit-repos:ro
+ - "$SSH_AUTH_SOCK:/var/run/cgit-repos/ssh-agent.sock"
+ - ./client/var/output:/var/tmp/cgit-repos/output
diff --git a/.travis/docker/server/Dockerfile b/.travis/docker/server/Dockerfile
new file mode 100644
index 0000000..035d871
--- /dev/null
+++ b/.travis/docker/server/Dockerfile
@@ -0,0 +1,22 @@
+FROM alpine:3.11
+
+RUN apk --no-cache add bash git openssh-server && \
+ echo 'root:root' | chpasswd && \
+ git config --global user.name 'Travis CI User' && \
+ git config --global user.email 'travis@example.org' && \
+ sed -ri 's/^#?PermitRootLogin\s+.*/PermitRootLogin yes/' /etc/ssh/sshd_config
+
+WORKDIR /root
+
+COPY ["ssh/server_key", "/etc/ssh/ssh_host_rsa_key"]
+COPY ["ssh/server_key.pub", "/etc/ssh/ssh_host_rsa_key.pub"]
+COPY ["ssh/client_key.pub", "./.ssh/authorized_keys"]
+
+RUN chmod 0600 -- /etc/ssh/ssh_host_rsa_key && \
+ chmod 0700 -- ./.ssh/ && \
+ chmod 0600 -- ./.ssh/authorized_keys
+
+COPY ["server/setup_repo.sh", "./"]
+RUN ./setup_repo.sh
+
+CMD ["/usr/sbin/sshd", "-D"]
diff --git a/.travis/docker/server/setup_repo.sh b/.travis/docker/server/setup_repo.sh
new file mode 100755
index 0000000..3d5b899
--- /dev/null
+++ b/.travis/docker/server/setup_repo.sh
@@ -0,0 +1,24 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+readonly local_repo_path="$HOME/test_repo"
+
+setup_local_repo() {
+ mkdir -p -- "$local_repo_path"
+ pushd -- "$local_repo_path" > /dev/null
+ git init
+ echo '1' > 1.txt
+ git add .
+ git commit -m 'first commit'
+ echo '2' > 2.txt
+ git add .
+ git commit -m 'second commit'
+ popd > /dev/null
+}
+
+main() {
+ setup_local_repo
+}
+
+main
diff --git a/.travis/docker/ssh/client_key b/.travis/docker/ssh/client_key
new file mode 100644
index 0000000..3e15c7e
--- /dev/null
+++ b/.travis/docker/ssh/client_key
@@ -0,0 +1,54 @@
+-----BEGIN RSA PRIVATE KEY-----
+Proc-Type: 4,ENCRYPTED
+DEK-Info: AES-128-CBC,EFA2E15B12D68FC649086F06E013568D
+
+YHB3av+cDZz7vlQDZuZkCsAXjoM8Ms6nrTHUV7s4Vck58qEFB9Zbk1yD86cJVPFr
+/p2fbdG3m7ZBC8QU3SvE1Saqzp1Pmi/6/QwvwlqMcEwXLMCdRuI52yO6F824/3Re
+uRlCzCw1JItJO2c7v/KUbIdJuKsYLJ8SE64Mh7/9QMqmlPxc2Hu7iBiS7XYOzsIT
+vIf7wPjWyKj73/MtMQoiBHoyvF0xc8wYFYS12m4F5F5n2oMp+S+37XLwOj8oIqE4
+Axn81m8Rz2ykfJgMKfsyJ70b7PDvrQkMtdkLxbWMwJcLhMAP6WgGuS+WGwZkUCBZ
+cEataf7nzGEYK1IcFFod9YCJu2fuY+wwWLh17YpCgbeE9UIg/jnolbpEmAkCOLni
+/1XCynHMlSnIWWGJsTtvYpVjbkm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4mjhPoCZSD9qqaqyb0EWAp3LKu
+0Y4GM8ZhXlhFBOOsf1QT7ucmDmHKioLPYaF3pvQ8C5XiJsgMU9LTLw5c+TdTgiB9
+kGrEcSZ23p9BBZXAMxABs89CB02e8fDc+LJ6pBuS/yDraj73BSt6MP6IZvfaJA4q
+Gh7db6zRNGoZeAe6M4scrKERYn/8zMs2kEylA0kVL9dQzcVCV/o1y0b7wwhhy12D
+qbojvp0lryk3mB23KIiL6x7BYh7SiJ7mOideJ9Y7SzLLZhSOdRDhmPo1x8NvX16N
+EOIzdGw0f4Ot4i9Kjifmc4cB0uPIyMJkO2feZ7HSg6Igi8QttV9ju0vjIsTBcer/
+6rouf6APpnmrWn3KwnqpQZpF9TJIAzL6eTn6e0muYVJhLVLkR8P+1nuLd5L4Mfxc
+vLuvVOcyOkXb+Az+UUFd754Bxl6R7xQXmHS4+ETGQcgSSNKWA8rOi5w7E6Okaigh
+E17U2OiF1QDqH89s816stMTkF0A+boTodl0RHp307oQsUASNVfZUIJVTqqjOzFAY
+7UYsxeBBHkD4HLzEPcHlxZ38Nj4VprmnKTeAfZJmB0KxLDK1jbE48XYkvcaE3qa+
+B+dORi8sM1ccNgIbUn5mYKh8Yg3orwMGR0kV18KDLHjSka7D8LkXXqlscd0f29fo
+-----END RSA PRIVATE KEY-----
diff --git a/.travis/docker/ssh/client_key.pub b/.travis/docker/ssh/client_key.pub
new file mode 100644
index 0000000..35dbd54
--- /dev/null
+++ b/.travis/docker/ssh/client_key.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQCju682tFYvigNZquMd9k89Z00YgSRl48Q9TevkweTKXmgp0P58rV+i1YypT7e2WWI7lOXs0QHxdXaU+aMplJqs4ek1SxzL7ySTYWDzUqPlbDKnd2zDEG0xF941w2t+DBTia+L5Bkc75z2ClYBDt49bXNFSixQhVM+HjZX/gHTknFtOSZGAwCQh/jw+Zdj+SBKaE2CVtKtLYtroKRNJH8K8EOQNpWY7e5/7r7I1bwtpCL6NWKNq38KmvacQqF4kfJ2oFW7HGj/k0DgQYcawh/WrV53IFzs6Ig2k7dPrGqFOFWcQZiFKYT7ndN6SNiu3yqIwjfHh5FLnFv+kOaCNHOy3f2Xebeb6ErwCMEbEK4k3KsWCceP8t0q8tzahw13tUgXplt3Z9rWWKDijeoS2HrmK4EwKBJinjRJqQrR/l8dKBi/0B00nq7SKgZ37Na+5/Q/tWGUU1V9ZbJPjZy2MYEWaf419mDCMpi7UUVz+8uGnB28ZxEYHiVnrJQm3MxytFGvdbGju5WwRw2zvin0BDtn/B+uFxYY0u2M2cOebSRDxGmQGqQfUIt4cnkc6HGwULa8UBI31Cjz0loW66QpDIL4MUm43+y6EnHzIZxWVUw6blgKy17jXAZgLZyjiOC5FNwOEuxNfui6BCIvTIerbtaUFfKcr6krBPNc+byU3yL96oQ== travis@example.org
diff --git a/.travis/docker/ssh/server_key b/.travis/docker/ssh/server_key
new file mode 100644
index 0000000..ae28564
--- /dev/null
+++ b/.travis/docker/ssh/server_key
@@ -0,0 +1,51 @@
+-----BEGIN RSA PRIVATE KEY-----
+MIIJKQIBAAKCAgEAt3NZMSCzeyccuAlUrWGvaOaJQnAjzdv9sZDn2km6Lu5Nnc18
+IlcY8F/DjlBh8PICFM5X6penzet69pVazhF8BF9u0fd3+/wv6ZOSifJ9Uk2fOtIF
+r2yjn9WW2SHMs7xA78Dgk+UVGcd6E5v00pKRNWqrilB8Zj/P4y+9jWHSd85AWpGk
+Nrx9izMbyYEqu/vZFL6bPEEW+xxLtJcPseiRVp56TGhLNSJE741Hv3dyEwp7qKqg
+lc/bqCPLMV4lmqdIQAqyd4BKPyJfQj/kxWK4E1L59zmJegOJI8itP13aEYY3GdEF
+8Ka4cTqqp8B212QQ5x2F8rPDvCMUv7A8B+Zc3F+sqlHVLZU1sU356oZT+2MXnFcu
+EdfUxCNslUeGAfgzUT8anJvLH6FhrajUBnXfxI0duxSYfGJzFS8dnHZvzrQmVt0s
+VeSSQgS89j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gswtD8JPk2y/ez5wvIGEvvREptA9R5lcFUmQ2ZCuAsNjJ
+dejJCQkOnh+/lpaoXNOSs4zaogk+NZnxFWShKWpDHaX4a6kOyyxpOq2VOHPSJZQL
+RwgldkU49K2gNFJXZ/RHZOtJ2ZuShIdW0hf5plEiNmkGcc5g9SkleT8DWDO9deeC
+8OniOVK3VjL7VnOizN03/XqYvv76Qx0T4yTpmFioTFg5hlfGzYl4cCIpt1SaO+Bj
+kaQPfDOlU29v5d6TgH4X2hlXjDaEj0dA7QKCAQBeORjaNa+gd0yyrLQnC8w0M1Sr
+vCbUs4yzFkFWVz1CojnxxmjPJc+lnN1jOMlk9TZqN4QcZ2VZnlBIDWHXinOq6suf
+ul3KYvmtx1/QQ44fKJk7haJpaAl7fbuxeOKwTQG3ClPBia0Da3955IriYeReWdur
+JkaDJ1tV5QBJULOcijgL0WGgSTzcsBaO1hqhrcHqyZI4NtGvXXDsfIznn+EtW2SK
+WtgnqUBvmHCncxFeysqQlDBf4tIBSJvF9j9RUJamJeoweRpnK5x4BiLrCsLRZ2oN
+yLMXQTEEGdcHsIjs9G9W7yeSloxG7PHjWu93p30hrdYgkCI/1ZuvhMIVd8UY
+-----END RSA PRIVATE KEY-----
diff --git a/.travis/docker/ssh/server_key.pub b/.travis/docker/ssh/server_key.pub
new file mode 100644
index 0000000..788daca
--- /dev/null
+++ b/.travis/docker/ssh/server_key.pub
@@ -0,0 +1 @@
+ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQC3c1kxILN7Jxy4CVStYa9o5olCcCPN2/2xkOfaSbou7k2dzXwiVxjwX8OOUGHw8gIUzlfql6fN63r2lVrOEXwEX27R93f7/C/pk5KJ8n1STZ860gWvbKOf1ZbZIcyzvEDvwOCT5RUZx3oTm/TSkpE1aquKUHxmP8/jL72NYdJ3zkBakaQ2vH2LMxvJgSq7+9kUvps8QRb7HEu0lw+x6JFWnnpMaEs1IkTvjUe/d3ITCnuoqqCVz9uoI8sxXiWap0hACrJ3gEo/Il9CP+TFYrgTUvn3OYl6A4kjyK0/XdoRhjcZ0QXwprhxOqqnwHbXZBDnHYXys8O8IxS/sDwH5lzcX6yqUdUtlTWxTfnqhlP7YxecVy4R19TEI2yVR4YB+DNRPxqcm8sfoWGtqNQGdd/EjR27FJh8YnMVLx2cdm/OtCZW3SxV5JJCBLz2NvzGXMbv5YFwEsyFfCE25/YW3a1ZN/iosNujuYxBcPgrKvtlCKbuSNG5nsiN2ktkzKwDOgd7G/ff6aQDt0/X9zI0erKfYACRTPQedGiC6aUf7y6YdS5VHwBGwXx2l4Zb8Jm1slD5ghhf6CXJurdXtXOQa7TE8VwluQlL5h+HfE34ZBNkBMxHWFEl5GmPJswU8H9kV7gPKXxJzRHll7TTPTzwn+DQhK+jTKbWoj/mfkjRhJeJrQ== travis@example.org
diff --git a/.travis/docker/test.sh b/.travis/docker/test.sh
new file mode 100755
index 0000000..4e33828
--- /dev/null
+++ b/.travis/docker/test.sh
@@ -0,0 +1,107 @@
+#!/usr/bin/env bash
+
+set -o errexit -o nounset -o pipefail
+
+script_dir="$( dirname -- "${BASH_SOURCE[0]}" )"
+script_dir="$( cd -- "$script_dir" && pwd )"
+readonly script_dir
+script_name="$( basename -- "${BASH_SOURCE[0]}" )"
+readonly script_name
+
+dump() {
+ local prefix="${FUNCNAME[0]}"
+ [ "${#FUNCNAME[@]}" -gt 1 ] && prefix="${FUNCNAME[1]}"
+
+ local msg
+ for msg; do
+ echo "$script_name: $prefix: $msg"
+ done
+}
+
+kill_ssh_agent() {
+ [ -n "${SSH_AGENT_PID:+x}" ] || return 0
+ dump "killing ssh-agent with PID $SSH_AGENT_PID"
+ kill "$SSH_AGENT_PID"
+}
+
+spawn_ssh_agent() {
+ [ -n "${SSH_AGENT_PID:+x}" ] && return 0
+ if ! command -v ssh-agent > /dev/null 2>&1; then
+ dump "could not find ssh-agent" >&2
+ return 1
+ fi
+ local output
+ output="$( ssh-agent -s )"
+ eval "$output"
+ if [ -z "${SSH_AGENT_PID:+x}" ]; then
+ dump "could not start ssh-agent" >&2
+ return 1
+ fi
+ trap kill_ssh_agent EXIT
+}
+
+setup_ssh_agent() {
+ spawn_ssh_agent
+
+ local key='ssh/client_key'
+ chmod 0600 -- "$key"
+ local password='password'
+
+ local askpass_path
+ askpass_path="$( mktemp --tmpdir="$script_dir" )"
+
+ local askpass_rm
+ askpass_rm="$( printf -- 'rm -- %q; trap - RETURN' "$askpass_path" )"
+ trap "$askpass_rm" RETURN
+
+ chmod 0700 -- "$askpass_path"
+
+ local echo_password
+ echo_password="$( printf -- 'echo %q' "$password" )"
+ echo "$echo_password" > "$askpass_path"
+
+ SSH_ASKPASS="$askpass_path" DISPLAY= ssh-add "$key" > /dev/null 2>&1 < /dev/null
+}
+
+docker_build() {
+ docker-compose build
+}
+
+setup() {
+ setup_ssh_agent
+ docker_build
+}
+
+run_server() {
+ docker-compose up -d server
+}
+
+run_client() {
+ if [ -z "${SSH_AUTH_SOCK:+x}" ]; then
+ dump 'SSH_AUTH_SOCK is not defined' >&2
+ return 1
+ fi
+ dump "SSH_AUTH_SOCK: $SSH_AUTH_SOCK"
+ docker-compose run --rm client
+}
+
+run() {
+ run_server
+ run_client
+}
+
+verify() {
+ pushd -- "$script_dir/client/var/output/test_repo" > /dev/null
+ git log --oneline
+ popd > /dev/null
+}
+
+main() {
+ pushd -- "$script_dir" > /dev/null
+ setup
+ run
+ verify
+ popd > /dev/null
+}
+
+main
diff --git a/.travis/local/test.sh b/.travis/local/test.sh
index 0f1166d..90c7cd2 100755
--- a/.travis/local/test.sh
+++ b/.travis/local/test.sh
@@ -8,8 +8,9 @@ readonly my_repos_path="$HOME/etc/cgit-repos/my_repos.py"
readonly output_path="$HOME/var/cgit-repos/output"
setup_local_repo() {
- mkdir -- "$local_repo_path"
+ mkdir -p -- "$local_repo_path"
pushd -- "$local_repo_path" > /dev/null
+
git init
echo '1' > 1.txt
git add .
@@ -17,6 +18,7 @@ setup_local_repo() {
echo '2' > 2.txt
git add .
git commit -m 'second commit'
+
popd > /dev/null
}
@@ -64,10 +66,8 @@ run() {
verify() {
pushd -- "$output_path" > /dev/null
-
cd -- test_repo
git log --oneline
-
popd > /dev/null
}