use of com.checkmarx.configprovider.readers.RepoReader in project cx-flow by checkmarx-ltd.
the class GitHubService method initConfigProviderOnPushEvent.
public void initConfigProviderOnPushEvent(String uid, PushEvent event) {
if (properties != null) {
try {
ConfigProvider configProvider = ConfigProvider.getInstance();
Repository repository = event.getRepository();
// According to GitHub the recommended way to extract the branch name
// is by using the 'ref' parameter which is in the following format: 'refs/heads/<branch>'
configProvider.init(uid, new RepoReader(properties.getApiUrl(), repository.getOwner().getName(), repository.getName(), ScanUtils.getBranchFromRef(event.getRef()), properties.getToken(), SourceProviderType.GITHUB));
} catch (ConfigurationException e) {
log.warn("Failed to init config provider with the following error: {}", e.getMessage());
}
}
}
use of com.checkmarx.configprovider.readers.RepoReader in project cx-flow by checkmarx-ltd.
the class GitHubService method initConfigProviderOnPullEvent.
public void initConfigProviderOnPullEvent(String uid, PullEvent event) {
if (properties != null) {
try {
ConfigProvider configProvider = ConfigProvider.getInstance();
Repository repository = event.getRepository();
String branch = event.getPullRequest().getHead().getRef();
configProvider.init(uid, new RepoReader(properties.getApiUrl(), repository.getOwner().getLogin(), repository.getName(), branch, properties.getToken(), SourceProviderType.GITHUB));
} catch (ConfigurationException e) {
log.warn("Failed to init config provider with the following error: {}", e.getMessage());
}
}
}
use of com.checkmarx.configprovider.readers.RepoReader in project cx-flow by checkmarx-ltd.
the class ConfigProviderRemoteRepoSteps method initConfigProvider.
@When("initializing config provider")
public void initConfigProvider() throws ConfigurationException {
String nameSpace = "cxflowtestuser";
String repoName = "configProviderTestRepo";
String branchName = "main";
ConfigProvider configProvider = ConfigProvider.getInstance();
configProvider.init(uid, new RepoReader(gitHubProperties.getApiUrl(), nameSpace, repoName, branchName, gitHubProperties.getToken(), sourceProviderType));
}
Aggregations