Search in sources :

Example 1 with OntrackGitHubClient

use of net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient in project ontrack by nemerosa.

the class GitHubIssueServiceExtension method getIssue.

@Override
public Issue getIssue(IssueServiceConfiguration issueServiceConfiguration, String issueKey) {
    GitHubIssueServiceConfiguration configuration = (GitHubIssueServiceConfiguration) issueServiceConfiguration;
    OntrackGitHubClient client = gitHubClientFactory.create(configuration.getConfiguration());
    return client.getIssue(configuration.getRepository(), getIssueId(issueKey));
}
Also used : OntrackGitHubClient(net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient) GitHubIssueServiceConfiguration(net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration)

Example 2 with OntrackGitHubClient

use of net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient in project ontrack by nemerosa.

the class GitHubConfigurationServiceImpl method validate.

@Override
protected ConnectionResult validate(GitHubEngineConfiguration configuration) {
    try {
        // Gets the client
        OntrackGitHubClient client = gitHubClientFactory.create(configuration);
        // Gets the list of repositories
        client.getRepositories();
        // OK
        return ConnectionResult.ok();
    } catch (Exception ex) {
        applicationLogService.log(ApplicationLogEntry.error(ex, NameDescription.nd("github", "GitHub connection issue"), configuration.getUrl()).withDetail("github-config-name", configuration.getName()).withDetail("github-config-url", configuration.getUrl()));
        return ConnectionResult.error(ex.getMessage());
    }
}
Also used : OntrackGitHubClient(net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient)

Example 3 with OntrackGitHubClient

use of net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient in project ontrack by nemerosa.

the class GitHubHealthIndicator method getHealth.

@Override
protected Health getHealth(GitHubEngineConfiguration config) {
    try {
        // Gets the client
        OntrackGitHubClient client = gitHubClientFactory.create(config);
        // Gets the list of repositories
        client.getRepositories();
        // OK
        return Health.up().build();
    } catch (Exception ex) {
        return Health.down(ex).build();
    }
}
Also used : OntrackGitHubClient(net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient)

Aggregations

OntrackGitHubClient (net.nemerosa.ontrack.extension.github.client.OntrackGitHubClient)3 GitHubIssueServiceConfiguration (net.nemerosa.ontrack.extension.github.service.GitHubIssueServiceConfiguration)1