File tree Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Expand file tree Collapse file tree 4 files changed +60
-0
lines changed Original file line number Diff line number Diff line change
1
+ FROM alpine:3.8
2
+
3
+ ENV PATH /google-cloud-sdk/bin:$PATH
4
+ ENV CLOUD_SDK_VERSION 198.0.0
5
+
6
+ RUN apk --no-cache add libc6-compat gcc g++ python make \
7
+ curl \
8
+ py-crcmod \
9
+ bash \
10
+ libc6-compat \
11
+ openssh-client \
12
+ git \
13
+ && curl -O https://dl.google.com/dl/cloudsdk/channels/rapid/downloads/google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
14
+ tar xzf google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
15
+ rm google-cloud-sdk-${CLOUD_SDK_VERSION}-linux-x86_64.tar.gz && \
16
+ ln -s /lib /lib64 && \
17
+ gcloud config set core/disable_usage_reporting true && \
18
+ gcloud config set component_manager/disable_update_check true && \
19
+ gcloud config set metrics/environment github_docker_image
20
+
21
+ RUN mkdir /bridge
22
+
23
+ WORKDIR /bridge
24
+
25
+ COPY . .
26
+
27
+ CMD [ "./bridge.sh" ]
Original file line number Diff line number Diff line change
1
+ #! /bin/sh
2
+
3
+ curl -s -X GET $PROGRESS_URL
4
+
5
+ # gcloud auth
6
+ gcloud auth activate-service-account --key-file=$( pwd) /key.json
7
+ git config --global credential.' https://source.developers.google.com' .helper gcloud.sh
8
+
9
+ # clone repo
10
+ git clone --mirror $SOURCE_URL clone && cd clone
11
+ echo " Cloning complete. Pushing to GSR"
12
+ # change remote origin url
13
+ git push --mirror $GSR_REPO
14
+
15
+ curl -s -X GET $SUCCESS_URL
16
+
17
+ cd ..
18
+ rm -Rf clone
Original file line number Diff line number Diff line change
1
+ {}
Original file line number Diff line number Diff line change
1
+ # Google Source Repository Mirror
2
+ > Mirror from Github Gitlab and Bitbucket to Google GSR
3
+
4
+ ## Requirements
5
+
6
+ ### Credentials
7
+ - key.json is the GSR service account with push permissions
8
+
9
+ ### Environment Variables
10
+
11
+ - PROGRESS_URL - webhook callback to set the mirror syncing status
12
+ - SOURCE_URL - git url embedded with basic auth
13
+ - GSR_REPO - remote origin url
14
+ - SUCCESS_URL - webhook callback to set the mirror sync success status status
You can’t perform that action at this time.
0 commit comments