mirror of
https://github.com/sourcebot-dev/sourcebot.git
synced 2025-12-11 20:05:25 +00:00
Add gitlab support
This commit is contained in:
parent
c0ecdccf41
commit
ac3e8313b3
5 changed files with 65 additions and 8 deletions
|
|
@ -4,6 +4,10 @@
|
|||
{
|
||||
"Type": "github",
|
||||
"GitHubUser": "TaqlaAI"
|
||||
},
|
||||
{
|
||||
"Type": "gitlab",
|
||||
"GitLabURL": "https://gitlab.com/api/v4/"
|
||||
}
|
||||
]
|
||||
}
|
||||
|
|
@ -13,6 +13,7 @@ services:
|
|||
dockerfile: Dockerfile.zoekt-indexserver
|
||||
environment:
|
||||
- GITHUB_TOKEN=${GITHUB_TOKEN}
|
||||
- GITLAB_TOKEN=${GITLAB_TOKEN}
|
||||
- CONFIG_PATH=/app/configs/config.json
|
||||
- ZOEKT_DATA_CACHE_DIR=/zoekt-data/
|
||||
volumes:
|
||||
|
|
|
|||
|
|
@ -13,4 +13,12 @@ else
|
|||
echo -e "\e[33mWarning: Private GitHub repositories will not be indexed since GITHUB_TOKEN was not set. If you are not using GitHub, disregard.\e[0m"
|
||||
fi
|
||||
|
||||
# Check if GITLAB_TOKEN is set
|
||||
if [ -n "$GITLAB_TOKEN" ]; then
|
||||
echo "$GITLAB_TOKEN" > "$HOME/.gitlab-token"
|
||||
chmod 600 "$HOME/.gitlab-token"
|
||||
else
|
||||
echo -e "\e[33mWarning: GitLab repositories will not be indexed since GITLAB_TOKEN was not set. If you are not using GitLab, disregard.\e[0m"
|
||||
fi
|
||||
|
||||
exec "zoekt-indexserver" "-data_dir" "${ZOEKT_DATA_CACHE_DIR}" "-mirror_config" "${CONFIG_PATH}"
|
||||
|
|
|
|||
|
|
@ -2,10 +2,23 @@
|
|||
"$schema": "http://json-schema.org/draft-07/schema#",
|
||||
"type": "object",
|
||||
"definitions": {
|
||||
"RepoNameRegexIncludeFilter": {
|
||||
"type": "string",
|
||||
"description": "Only clone repos whose name matches the given regexp.",
|
||||
"format": "regexp"
|
||||
},
|
||||
"RepoNameRegexExcludeFilter": {
|
||||
"type": "string",
|
||||
"description": "Don't mirror repos whose names match this regexp.",
|
||||
"format": "regexp"
|
||||
},
|
||||
"ZoektConfig": {
|
||||
"anyOf": [
|
||||
{
|
||||
"$ref": "#/definitions/GitHubConfig"
|
||||
},
|
||||
{
|
||||
"$ref": "#/definitions/GitLabConfig"
|
||||
}
|
||||
]
|
||||
},
|
||||
|
|
@ -28,18 +41,15 @@
|
|||
"description": "The GitHub organization to mirror"
|
||||
},
|
||||
"Name": {
|
||||
"type": "string",
|
||||
"description": "Only clone repos whose name matches the given regexp.",
|
||||
"format": "regexp"
|
||||
"$ref": "#/definitions/RepoNameRegexIncludeFilter"
|
||||
},
|
||||
"Exclude": {
|
||||
"type": "string",
|
||||
"description": "Don't mirror repos whose names match this regexp.",
|
||||
"format": "regexp"
|
||||
"$ref": "#/definitions/RepoNameRegexExcludeFilter"
|
||||
},
|
||||
"CredentialPath": {
|
||||
"type": "string",
|
||||
"description": "Path to a file containing a GitHub access token."
|
||||
"description": "Path to a file containing a GitHub access token.",
|
||||
"default": "~/.github-token"
|
||||
},
|
||||
"Topics": {
|
||||
"type": "array",
|
||||
|
|
@ -70,6 +80,40 @@
|
|||
"Type"
|
||||
],
|
||||
"additionalProperties": false
|
||||
},
|
||||
"GitLabConfig": {
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"Type": {
|
||||
"const": "gitlab"
|
||||
},
|
||||
"GitLabURL": {
|
||||
"type": "string",
|
||||
"description": "The GitLab API url.",
|
||||
"default": "https://gitlab.com/api/v4/"
|
||||
},
|
||||
"Name": {
|
||||
"$ref": "#/definitions/RepoNameRegexIncludeFilter"
|
||||
},
|
||||
"Exclude": {
|
||||
"$ref": "#/definitions/RepoNameRegexExcludeFilter"
|
||||
},
|
||||
"OnlyPublic": {
|
||||
"type": "boolean",
|
||||
"description": "Only mirror public repos",
|
||||
"default": false
|
||||
},
|
||||
"CredentialPath": {
|
||||
"type": "string",
|
||||
"description": "Path to a file containing a GitLab access token.",
|
||||
"default": "~/.gitlab-token"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"Type",
|
||||
"GitLabURL"
|
||||
],
|
||||
"additionalProperties": false
|
||||
}
|
||||
},
|
||||
"properties": {
|
||||
|
|
|
|||
2
vendor/zoekt
vendored
2
vendor/zoekt
vendored
|
|
@ -1 +1 @@
|
|||
Subproject commit cab022245653c711f31d1fb0993a7741b11c648a
|
||||
Subproject commit 3780e68cdb537d5a7ed2c84d9b3784f80c7c5d04
|
||||
Loading…
Reference in a new issue