Skip to content

Commit

Permalink
Merge pull request #900 from snyk/feat/add-support-for-separate-scm-g…
Browse files Browse the repository at this point in the history
…it-endpoint

feat: add local override for separate bitbucket-server git endpt
  • Loading branch information
aarlaud authored Jan 17, 2025
2 parents fb70022 + e21ee79 commit 93d25ed
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 12 deletions.
3 changes: 3 additions & 0 deletions client-templates/bitbucket-server/.env.sample
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,9 @@ BITBUCKET=bitbucket.yourdomain.com
# changed to "bitbucket.yourdomain.com/rest/api/1.0"
BITBUCKET_API=$BITBUCKET/rest/api/1.0

# GIT Endpoint to override if necessary
BITBUCKET_GIT=$BITBUCKET

# the url of your broker client (including scheme and port)
# BROKER_CLIENT_URL=

Expand Down
1 change: 1 addition & 0 deletions config.default.json
Original file line number Diff line number Diff line change
Expand Up @@ -154,6 +154,7 @@
}
],
"default": {
"BITBUCKET_GIT": "$BITBUCKET",
"BITBUCKET_API": "$BITBUCKET/rest/api/1.0",
"BROKER_CLIENT_VALIDATION_URL": "https://$BITBUCKET/rest/api/1.0/projects",
"BROKER_CLIENT_VALIDATION_BASIC_AUTH": "$BITBUCKET_USERNAME:$BITBUCKET_PASSWORD",
Expand Down
2 changes: 2 additions & 0 deletions lib/common/filter/filter-rules-loading.ts
Original file line number Diff line number Diff line change
Expand Up @@ -219,6 +219,8 @@ function injectRulesAtRuntime(
templateGETForSnippets.path =
'/projects/:project/repos/:repo/browse*/:file';
templatePOST.path = '*/git-upload-pack';
templateGET.origin = 'https://${BITBUCKET_GIT}';
templatePOST.origin = 'https://${BITBUCKET_GIT}';
break;
default:
logger.error(
Expand Down
24 changes: 12 additions & 12 deletions test/unit/__snapshots__/runtime-rules-hotloading.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -25948,7 +25948,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -25959,7 +25959,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down Expand Up @@ -27080,7 +27080,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -27090,7 +27090,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down Expand Up @@ -34019,7 +34019,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -34030,7 +34030,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down Expand Up @@ -35171,7 +35171,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -35181,7 +35181,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down Expand Up @@ -42120,7 +42120,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -42131,7 +42131,7 @@ Object {
"username": "\${BITBUCKET_USERNAME}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down Expand Up @@ -43252,7 +43252,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "GET",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/info/refs*",
},
Object {
Expand All @@ -43262,7 +43262,7 @@ Object {
"token": "\${BITBUCKET_PAT}",
},
"method": "POST",
"origin": "https://\${BITBUCKET}",
"origin": "https://\${BITBUCKET_GIT}",
"path": "*/git-upload-pack",
},
Object {
Expand Down

0 comments on commit 93d25ed

Please sign in to comment.