Search in sources :

Example 1 with GitLabConnectionProperty

use of com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty in project gitlab-branch-source-plugin by Argelbargel.

the class GitLabSCMItemListener method updateProperties.

private void updateProperties(Job<?, ?> job, String connectionName) {
    try {
        job.removeProperty(GitLabConnectionProperty.class);
        job.addProperty(new GitLabConnectionProperty(connectionName));
    } catch (IOException e) {
        LOGGER.warning("could not update gitlab-connection-property to job " + job.getName() + ": " + e.getMessage());
    }
}
Also used : GitLabConnectionProperty(com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty) IOException(java.io.IOException)

Example 2 with GitLabConnectionProperty

use of com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty in project gitlab-branch-source-plugin by Argelbargel.

the class GitLabSCMItemListener method updateProperties.

private boolean updateProperties(Job<?, ?> job, SCMSourceOwner sourceOwner, String sourceId) {
    SCMSource source = sourceOwner.getSCMSource(sourceId);
    if (source instanceof GitLabSCMSource) {
        String connectionName = ((GitLabSCMSource) source).getSourceSettings().getConnectionName();
        GitLabConnectionProperty property = job.getProperty(GitLabConnectionProperty.class);
        if (property == null || !connectionName.equals(property.getGitLabConnection())) {
            updateProperties(job, connectionName);
            return true;
        }
    }
    return false;
}
Also used : GitLabConnectionProperty(com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty) SCMSource(jenkins.scm.api.SCMSource)

Aggregations

GitLabConnectionProperty (com.dabsquared.gitlabjenkins.connection.GitLabConnectionProperty)2 IOException (java.io.IOException)1 SCMSource (jenkins.scm.api.SCMSource)1