Skip to content

Commit 9ae1e6e

Browse files
authored
Preparing the repo to share (#31)
1 parent 82d301d commit 9ae1e6e

File tree

6 files changed

+45
-49
lines changed

6 files changed

+45
-49
lines changed

.github/workflows/docker-image-build.yml

+4
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ name: Build and Push Docker Image to GitHub Container Registry
33
on:
44
workflow_dispatch: # Creates button in web UI to run the workflow manually, shouldn't be needed
55
push:
6+
tags:
7+
- '**'
8+
branches:
9+
- main
610
pull_request:
711
types:
812
- opened

.github/workflows/docker-image-cleanup.yml

+2-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Cleanup old Docker Images from GitHub Container Registry
33
on:
44
workflow_dispatch: # Creates button in web UI to run the workflow manually, shouldn't be needed
55
schedule:
6-
- cron: '0 0 * * *' # Run at 00:00 UTC every day
6+
- cron: '0 0 * * 0' # Run on Sundays at 00:00 UTC every week
77

88
jobs:
99
cleanup:
@@ -14,5 +14,5 @@ jobs:
1414
with:
1515
package-name: implementation-bridge-repo-converter
1616
package-type: container
17-
min-versions-to-keep: 10
17+
delete-only-untagged-versions: 'true'
1818
ignore-versions: '^v\d+\.\d+\.\d+$'

.github/workflows/docker-image-cleaup-old-packages.yml

-18
This file was deleted.

config/example-repos-to-convert.yaml

+8-25
Original file line numberDiff line numberDiff line change
@@ -1,25 +1,8 @@
1-
arbitrary_friendly_name_svn_1:
2-
type: SVN
3-
url: https://svn1.example.com
4-
username: super_secret_username
5-
password: super_secret_password
6-
repos:
7-
- repo1
8-
- repo2
9-
arbitrary_friendly_name_svn_2:
10-
type: svn
11-
url: https://svn2.example.com
12-
token: super_secret_access_token
13-
repo: repo1
14-
arbitrary_friendly_name_tfvc_1:
15-
type: TFVC
16-
url: https://dev.azure.com/org1
17-
token: super_secret_access_token
18-
repos:
19-
- $/project1
20-
- $/project1/project2
21-
arbitrary_friendly_name_tfvc_2:
22-
type: tfs
23-
url: https://dev.azure.com/org1
24-
token: super_secret_access_token
25-
repo: $/project1/project2
1+
xmlbeans:
2+
type: SVN
3+
svn-repo-code-root: https://svn.apache.org/repos/asf/xmlbeans
4+
code-host-name: svn.apache.org
5+
git-org-name: asf
6+
layout: standard
7+
username: super_secret_username
8+
password: super_secret_password

repo-converter/README.md

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
# Repo Converter
2+
3+
## Experimental - This is not a supported Sourcegraph product
4+
This repo was created for Sourcegraph Implementation Engineering deployments and Managed Services, and is not intended, designed, built, or supported for use in any other scenario. Feel free to open issues or PRs, but responses are best effort.
5+
6+
## Why
7+
Provides a framework to convert non-Git repos into Git format, and in combination with src serve-git, and optionally the Sourcegraph Cloud Private Connect Agent (for Sourcegraph Cloud customers), provide a code host endpoint for the customer's Sourcegraph instance to clone the repos from.
8+
9+
## Setup
10+
1. Clone this repo to a VM with network connectivity to the customer's code hosts
11+
2. Install Docker and Docker's Compose plugin
12+
3. Copy the `./config/example-repos-to-convert.yaml` file to `./config/repos-to-convert.yaml`
13+
4. Modify the contents of the `./config/repos-to-convert.yaml` file:
14+
- Refer to the contents of the `input_value_types_dict` [here](https://sourcegraph.com/search?q=repo:%5Egithub%5C.com/sourcegraph/implementation-bridges$+input_value_types_dict) for the config parameters available, and the required value types
15+
- Note that if your code host requires credentials, the current version of this requires the credentials to be stored in this file; it could be modified to read credentials via environment variables, so they could be loaded from a customer's secrets management system at container start time
16+
- Use extra caution when pasting the YAML files in Windows, as it may use Windows' line endings or extra spaces, which breaks YAML, as a whitespace-dependent format
17+
5. You / we may need to write a new `docker-compose.yaml` file if you need to expose the src serve-git port outside the host / Docker network, without using the Cloud Private Connect Agent
18+
- There are docker-compose.yaml and override files in a few different directories in this repo, separated by use case, so that each use case only needs to run `docker compose up -d` in one directory, and not fuss around with `-f` paths.
19+
- The only difference between the docker-compose-override.yaml files in host-ubuntu vs host-wsl is the src-serve-git container's name, which is how we get a separate `dnsName` for each.
20+
- The `LOG_LEVEL` environment variable should be left undefined to use the default `INFO` in most cases; `DEBUG` is mostly just for visibility on subprocesses getting forked and cleaned up
21+
6. Run `docker compose up -d`
22+
7. Add a Code Host config to the customer's Cloud instance
23+
- Type: src serve-git
24+
- `"url": "http://src-serve-git-ubuntu.local:443",`
25+
- matching the src serve-git container's Docker container name and listening port number from the `docker-compose.yaml`
26+
8. The repo-converter will output the converted repos in the `src-serve-root` directory, where src serve-git will serve them from

repo-converter/build/run.py

+5-4
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,11 @@
33

44
### TODO:
55

6-
# Definition of Done:
7-
# Git - Done enough for PoC
8-
# SVN - Done
9-
# TFVC - Need to sort out branches, and how to finish cloning
6+
# Add doc strings for each function?
7+
# https://www.dataquest.io/blog/documenting-in-python-with-docstrings
8+
9+
# Rewrite in Go?
10+
# Rewrite in object oriented fashion?
1011

1112
# TFVC
1213
# Convert tfs-to-git Bash script to Python and add it here

0 commit comments

Comments
 (0)