Skip to content

Commit

Permalink
Merge pull request #31 from knapsu/master
Browse files Browse the repository at this point in the history
GitLab CI support
  • Loading branch information
rspieldenner authored Sep 30, 2016
2 parents c53746a + 0b0cf9e commit 89ff7db
Show file tree
Hide file tree
Showing 2 changed files with 48 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ContinuousIntegrationInfoPlugin implements Plugin<Project>, InfoCollectorP
void apply(Project project) {
this.project = project

providers = [new JenkinsProvider(), new TravisProvider(), new UnknownContinuousIntegrationProvider()]
providers = [new GitlabProvider(), new JenkinsProvider(), new TravisProvider(), new UnknownContinuousIntegrationProvider()]
selectedProvider = findProvider()

extension = project.extensions.create('ciinfo', ContinuousIntegrationInfoExtension)
Expand Down
47 changes: 47 additions & 0 deletions src/main/groovy/nebula/plugin/info/ci/GitlabProvider.groovy
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
/*
* Copyright 2014-2016 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

package nebula.plugin.info.ci

import org.gradle.api.Project

class GitlabProvider extends AbstractContinuousIntegrationProvider {

@Override
boolean supports(Project project) {
getEnvironmentVariable('GITLAB_CI')
}

@Override
String calculateBuildNumber(Project project) {
getEnvironmentVariable('CI_BUILD_ID')
}

@Override
String calculateBuildId(Project project) {
getEnvironmentVariable('CI_BUILD_ID')
}

@Override
String calculateHost(Project project) {
return hostname()
}

@Override
String calculateJob(Project project) {
getEnvironmentVariable('CI_BUILD_NAME')
}
}

0 comments on commit 89ff7db

Please sign in to comment.