Skip to content

Commit fd1b076

Browse files
committed
initial commit
0 parents  commit fd1b076

File tree

4 files changed

+60
-0
lines changed

4 files changed

+60
-0
lines changed

gsr-mirror/Dockerfile

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
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" ]

gsr-mirror/mirror.sh

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
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

key.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
{}

readme.md

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
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

0 commit comments

Comments
 (0)