diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000000000000000000000000000000000000..048ffb1bb2c0619018bf1aeb6b5b7b7b5951e576 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,14 @@ +from ubuntu:20.04 +maintainer root@recolic.net + +run apt update && apt install -y fish wget curl +run wget https://git.recolic.net/root/json2table/uploads/63b923b53a191968f0dc29cd988d7b4f/json2table-linux-static -O /usr/bin/json2table && chmod +x /usr/bin/json2table + +run mkdir -p /app +copy . /app +workdir /app + +cmd "./gitlab2github_daemon.fish" + + + diff --git a/README.md b/README.md index f1a134c828fa7102b2bb4284434cc43d17a497a0..5dc61583f403a78eaa959560e4f1a4faca4e39b2 100644 --- a/README.md +++ b/README.md @@ -8,3 +8,11 @@ Dependencies: fish, json2table, git This doesn't recursively resolve gitlab sub-group. Please specify every sub-group as a new namespace. +## Usage + +``` +sudo docker build -f Dockerfile -t recolic/gitlab2github . +sudo docker run -d --name rgitsync --env github_user_dst="rtestgithubapi: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" recolic/gitlab2github +``` + + diff --git a/gitlab2github_daemon.fish b/gitlab2github_daemon.fish new file mode 100755 index 0000000000000000000000000000000000000000..6db878cbb03da35ad63ba9078e3abc7a752ec56d --- /dev/null +++ b/gitlab2github_daemon.fish @@ -0,0 +1,8 @@ +#!/usr/bin/fish + +while true + fish ./gitlab2github_sync.fish + echo "Sleeping 3600s..." 1>&2 + sleep 3600 +end + diff --git a/gitlab2github_sync.fish b/gitlab2github_sync.fish old mode 100644 new mode 100755 index b463db49ea81b23c8b3309e77f78c07e1b48f591..83655cab117f0739ace2f7f03a4dc35f9d60dc5c --- a/gitlab2github_sync.fish +++ b/gitlab2github_sync.fish @@ -3,7 +3,11 @@ set gitlab_host https://git.recolic.net # set gitlab_namespace_src users/root groups/recolic-hust set gitlab_namespace_src users/root -set github_user_dst "rtestgithubapi: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" +if test "$github_user_dst" = "" + echo 'Error: please set environment variable github_user_dst' 1>&2 + echo 'Example: env github_user_dst="rtestgithubapi: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" ./gitlab2gitlab.fish' + exit 1 +end function echo2 echo $argv 1>&2