From 41c5d30bfcb2a56aacb501619fd67c7d3ce7d5a8 Mon Sep 17 00:00:00 2001 From: Bensong Liu <bensl@microsoft.com> Date: Tue, 20 Apr 2021 14:21:55 +0800 Subject: [PATCH] done.log done --- Dockerfile | 14 ++++++++++++++ README.md | 8 ++++++++ gitlab2github_daemon.fish | 8 ++++++++ gitlab2github_sync.fish | 6 +++++- 4 files changed, 35 insertions(+), 1 deletion(-) create mode 100644 Dockerfile create mode 100755 gitlab2github_daemon.fish mode change 100644 => 100755 gitlab2github_sync.fish diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..048ffb1 --- /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 f1a134c..5dc6158 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 0000000..6db878c --- /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 b463db4..83655ca --- 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 -- GitLab