Last active
March 23, 2020 19:04
-
-
Save ipcrm/3d40fbb64ecd6ff69217dd4a58736089 to your computer and use it in GitHub Desktop.
Custom RepoRefResolver
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export const configuration = configure<{}>(async sdm => { | |
// SDM Stuff | |
}, { | |
preProcessors: [ | |
async cfg => { | |
cfg.sdm.repoRefResolver = new CustomBitBucketRepoRefResolver(); | |
return cfg; | |
}, | |
], | |
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
export class CustomBitBucketRepoRefResolver extends DefaultRepoRefResolver { | |
public toBitBucketServerRepoRef(params: { | |
providerUrl: string, | |
owner: string, | |
name: string, | |
sha: string, | |
branch?: string, | |
}): BitBucketServerRepoRef { | |
const url = params.providerUrl.replace("hostname", "hostname.my.domain.com"); | |
const id = new BitBucketServerRepoRef( | |
url, | |
params.owner, | |
params.name, | |
true, | |
params.sha, | |
); | |
id.branch = params.branch; | |
return id; | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment