jenkins.model.GlobalConfiguration Java Examples

The following examples show how to use jenkins.model.GlobalConfiguration. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: VaultConfigurationIT.java    From hashicorp-vault-plugin with MIT License 6 votes vote down vote up
@Before
public void setupJenkins() throws IOException {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    assertThat(globalConfig, is(notNullValue()));
    VaultConfiguration vaultConfig = new VaultConfiguration();
    vaultConfig.setVaultUrl("http://global-vault-url.com");
    vaultConfig.setVaultCredentialId(GLOBAL_CREDENTIALS_ID_1);
    vaultConfig.setFailIfNotFound(false);
    vaultConfig.setEngineVersion(GLOBAL_ENGINE_VERSION_2);
    vaultConfig.setVaultNamespace("mynamespace");
    vaultConfig.setTimeout(TIMEOUT);
    globalConfig.setConfiguration(vaultConfig);

    globalConfig.save();

    GLOBAL_CREDENTIAL_1 = createTokenCredential(GLOBAL_CREDENTIALS_ID_1);
    GLOBAL_CREDENTIAL_2 = createTokenCredential(GLOBAL_CREDENTIALS_ID_2);

    SystemCredentialsProvider.getInstance()
        .setDomainCredentialsMap(Collections.singletonMap(Domain.global(), Arrays
            .asList(GLOBAL_CREDENTIAL_1, GLOBAL_CREDENTIAL_2)));

    this.project = jenkins.createFreeStyleProject("test");
}
 
Example #2
Source File: UserApprover.java    From telegram-notifications-plugin with MIT License 6 votes vote down vote up
private void updateUserApproval(User user, boolean approved) {
    String message;
    boolean oldStatus = user.isApproved();
    if (approved) {
        user.approve();
        message = String.valueOf(GlobalConfiguration.all().get(TelegramBotGlobalConfiguration.class)
                .getBotStrings().get("message.approved"));
    } else {
        user.unapprove();
        message = String.valueOf(GlobalConfiguration.all().get(TelegramBotGlobalConfiguration.class)
                .getBotStrings().get("message.unapproved"));
    }

    if (oldStatus != user.isApproved()) {
        TelegramBotRunner.getInstance().getBot().sendMessage(user.getId(), message);
    }
}
 
Example #3
Source File: SeedJobTest.java    From configuration-as-code-plugin with MIT License 6 votes vote down vote up
@Test
@ConfiguredWithCode("SeedJobTest_withSecurityConfig.yml")
@Envs(
    @Env(name = "SEED_JOB_FOLDER_FILE_PATH", value = ".")
)
public void configure_seed_job_with_security_config() throws Exception {
    final Jenkins jenkins = Jenkins.get();

    final GlobalJobDslSecurityConfiguration dslSecurity = GlobalConfiguration.all()
        .get(GlobalJobDslSecurityConfiguration.class);
    assertNotNull(dslSecurity);
    assertThat("ScriptSecurity", dslSecurity.isUseScriptSecurity(), is(false));

    FreeStyleProject seedJobWithSecurityConfig = (FreeStyleProject) jenkins.getItem("seedJobWithSecurityConfig");
    assertNotNull(seedJobWithSecurityConfig);

    assertTrue(seedJobWithSecurityConfig.isInQueue());
    FreeStyleBuild freeStyleBuild = j.buildAndAssertSuccess(seedJobWithSecurityConfig);
    j.assertLogContains("Processing DSL script testJob2.groovy", freeStyleBuild);
    j.assertLogContains("Added items:", freeStyleBuild);
    j.assertLogContains("GeneratedJob{name='testJob2'}", freeStyleBuild);
}
 
Example #4
Source File: SonarQubeTest.java    From configuration-as-code-plugin with MIT License 6 votes vote down vote up
@Test
@ConfiguredWithReadme("sonarqube/README.md")
public void configure_sonar_globalconfig() throws Exception {

    final SonarGlobalConfiguration configuration = GlobalConfiguration.all().get(SonarGlobalConfiguration.class);
    assertTrue(configuration.isBuildWrapperEnabled());
    final SonarInstallation installation = configuration.getInstallations()[0];
    assertEquals("TEST", installation.getName());
    assertEquals("http://url:9000", installation.getServerUrl());
    assertEquals("token", installation.getServerAuthenticationToken());
    assertEquals("mojoVersion", installation.getMojoVersion());
    assertEquals("additionalAnalysisProperties", installation.getAdditionalAnalysisProperties());
    final TriggersConfig triggers = installation.getTriggers();
    assertTrue(triggers.isSkipScmCause());
    assertTrue(triggers.isSkipUpstreamCause());
    assertEquals("envVar", triggers.getEnvVar());
}
 
Example #5
Source File: GlobalVaultConfiguration.java    From hashicorp-vault-plugin with MIT License 5 votes vote down vote up
@NonNull
public static GlobalVaultConfiguration get() {
    GlobalVaultConfiguration instance = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    if (instance == null) {
        throw new IllegalStateException();
    }
    return instance;
}
 
Example #6
Source File: Subscribers.java    From telegram-notifications-plugin with MIT License 5 votes vote down vote up
public Set<User> getApprovedUsers() {
    if (GlobalConfiguration.all().get(TelegramBotGlobalConfiguration.class).getApprovalType() == UserApprover.ApprovalType.ALL) {
        return users.stream().collect(Collectors.toSet());
    }

    return users.stream()
            .filter(User::isApproved)
            .collect(Collectors.toSet());
}
 
Example #7
Source File: VaultConfigurationIT.java    From hashicorp-vault-plugin with MIT License 5 votes vote down vote up
@Test
public void shouldFailIfCredentialsNotConfigured() throws Exception {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    assertThat(globalConfig, is(notNullValue()));
    VaultConfiguration vaultConfig = new VaultConfiguration();
    vaultConfig.setVaultUrl("http://global-vault-url.com");
    vaultConfig.setFailIfNotFound(false);
    vaultConfig.setVaultNamespace("mynamespace");
    vaultConfig.setTimeout(TIMEOUT);

    globalConfig.setConfiguration(vaultConfig);

    globalConfig.save();

    List<VaultSecret> secrets = standardSecrets();

    VaultBuildWrapper vaultBuildWrapper = new VaultBuildWrapper(secrets);
    VaultAccessor mockAccessor = mockVaultAccessor(GLOBAL_ENGINE_VERSION_2);
    vaultBuildWrapper.setVaultAccessor(mockAccessor);

    this.project.getBuildWrappersList().add(vaultBuildWrapper);
    this.project.getBuildersList().add(echoSecret());

    FreeStyleBuild build = this.project.scheduleBuild2(0).get();

    jenkins.assertBuildStatus(Result.FAILURE, build);
    VaultConfig config = new VaultConfig().address(anyString());
    mockAccessor.setConfig(config);
    mockAccessor.setCredential(any(VaultCredential.class));
    verify(mockAccessor, times(0)).init();
    verify(mockAccessor, times(0)).read(anyString(), anyInt());
    jenkins.assertLogContains(
        "The credential id was not configured - please specify the credentials to use.", build);
}
 
Example #8
Source File: VaultConfigurationIT.java    From hashicorp-vault-plugin with MIT License 5 votes vote down vote up
@Test
public void shouldFailIfUrlNotConfigured() throws Exception {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    assertThat(globalConfig, is(notNullValue()));
    VaultConfiguration vaultConfig = new VaultConfiguration();
    vaultConfig.setVaultCredentialId(GLOBAL_CREDENTIALS_ID_2);
    vaultConfig.setFailIfNotFound(false);
    vaultConfig.setVaultNamespace("mynamespace");
    vaultConfig.setTimeout(TIMEOUT);
    globalConfig.setConfiguration(vaultConfig);

    globalConfig.save();

    List<VaultSecret> secrets = standardSecrets();

    VaultBuildWrapper vaultBuildWrapper = new VaultBuildWrapper(secrets);
    VaultAccessor mockAccessor = mockVaultAccessor(GLOBAL_ENGINE_VERSION_2);
    vaultBuildWrapper.setVaultAccessor(mockAccessor);

    this.project.getBuildWrappersList().add(vaultBuildWrapper);
    this.project.getBuildersList().add(echoSecret());

    FreeStyleBuild build = this.project.scheduleBuild2(0).get();

    jenkins.assertBuildStatus(Result.FAILURE, build);
    VaultConfig config = new VaultConfig().address(anyString());
    mockAccessor.setConfig(config);
    mockAccessor.setCredential(any(VaultCredential.class));

    verify(mockAccessor, times(0)).init();
    verify(mockAccessor, times(0)).read(anyString(), anyInt());
    jenkins.assertLogContains(
        "The vault url was not configured - please specify the vault url to use.", build);
}
 
Example #9
Source File: QGBuilderIT.java    From sonar-quality-gates-plugin with MIT License 5 votes vote down vote up
@Before
public void setUp() throws IOException {
    MockitoAnnotations.initMocks(this);
    jobConfigData = new JobConfigData();
    jobConfigurationService = new JobConfigurationService();
    jobExecutionService = new JobExecutionService();
    globalConfigDataForSonarInstance = new GlobalConfigDataForSonarInstance();
    builderDescriptor = new QGBuilderDescriptor(jobExecutionService, jobConfigurationService);
    qgBuilder = new QGBuilder(jobConfigData, buildDecision, jobExecutionService, jobConfigurationService, globalConfigDataForSonarInstance);
    globalConfig = GlobalConfiguration.all().get(GlobalConfig.class);
    freeStyleProject = jenkinsRule.createFreeStyleProject("freeStyleProject");
    freeStyleProject.getBuildersList().add(qgBuilder);
    globalConfigDataForSonarInstanceList = new ArrayList<>();
}
 
Example #10
Source File: QGPublisherIT.java    From sonar-quality-gates-plugin with MIT License 5 votes vote down vote up
@Before
public void setUp() throws IOException {
    MockitoAnnotations.initMocks(this);
    jobConfigData = new JobConfigData();
    jobExecutionService = new JobExecutionService();
    globalConfigDataForSonarInstance = new GlobalConfigDataForSonarInstance();
    publisher = new QGPublisher(jobConfigData, buildDecision, jobExecutionService, jobConfigurationService, globalConfigDataForSonarInstance);
    builder = new QGBuilder(jobConfigData, buildDecision, jobExecutionService, jobConfigurationService, globalConfigDataForSonarInstance);
    globalConfig = GlobalConfiguration.all().get(GlobalConfig.class);
    freeStyleProject = jenkinsRule.createFreeStyleProject("freeStyleProject");
    freeStyleProject.getBuildersList().add(builder);
    freeStyleProject.getPublishersList().add(publisher);
    globalConfigDataForSonarInstanceList = new ArrayList<>();
}
 
Example #11
Source File: VaultConfigurationIT.java    From hashicorp-vault-plugin with MIT License 5 votes vote down vote up
@Test
public void shouldFailIfNoConfigurationExists() throws Exception {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    assertThat(globalConfig, is(notNullValue()));
    globalConfig.setConfiguration(null);

    globalConfig.save();
    List<VaultSecret> secrets = standardSecrets();

    VaultBuildWrapper vaultBuildWrapper = new VaultBuildWrapper(secrets);
    VaultAccessor mockAccessor = mockVaultAccessor(GLOBAL_ENGINE_VERSION_2);
    vaultBuildWrapper.setVaultAccessor(mockAccessor);

    this.project.getBuildWrappersList().add(vaultBuildWrapper);
    this.project.getBuildersList().add(echoSecret());

    FreeStyleBuild build = this.project.scheduleBuild2(0).get();

    jenkins.assertBuildStatus(Result.FAILURE, build);
    VaultConfig config = new VaultConfig().address(anyString());
    mockAccessor.setConfig(config);
    mockAccessor.setCredential(any(VaultCredential.class));
    verify(mockAccessor, times(0)).init();
    verify(mockAccessor, times(0)).read(anyString(), anyInt());
    jenkins
        .assertLogContains("No configuration found - please configure the VaultPlugin.", build);
}
 
Example #12
Source File: GitTest.java    From configuration-as-code-plugin with MIT License 5 votes vote down vote up
@Test
@Issue("JENKINS-57604")
@ConfiguredWithCode("GitTest.yml")
public void checkAssemblaWebIsLoaded() throws Exception {
    final Jenkins jenkins = Jenkins.get();
    final GlobalLibraries libs =  jenkins.getExtensionList(GlobalConfiguration.class)
            .get(GlobalLibraries.class);

    LibraryConfiguration lib = libs.getLibraries().get(0);
    SCMRetriever retriever = (SCMRetriever) lib.getRetriever();
    GitSCM scm = (GitSCM) retriever.getScm();
    AssemblaWeb browser = (AssemblaWeb)scm.getBrowser();
    assertEquals("assembla.acmecorp.com", browser.getRepoUrl());
}
 
Example #13
Source File: VaultConfigurationIT.java    From hashicorp-vault-plugin with MIT License 5 votes vote down vote up
@Test
public void shouldFailIfCredentialsDoNotExist() throws Exception {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);
    assertThat(globalConfig, is(notNullValue()));
    VaultConfiguration vaultConfig = new VaultConfiguration();
    vaultConfig.setVaultUrl("http://example.com");
    vaultConfig.setVaultCredentialId("some-made-up-ID");
    vaultConfig.setFailIfNotFound(false);
    vaultConfig.setVaultNamespace("mynamespace");
    vaultConfig.setTimeout(TIMEOUT);
    globalConfig.setConfiguration(vaultConfig);

    globalConfig.save();

    List<VaultSecret> secrets = standardSecrets();

    VaultBuildWrapper vaultBuildWrapper = new VaultBuildWrapper(secrets);
    VaultAccessor mockAccessor = mockVaultAccessor(GLOBAL_ENGINE_VERSION_2);
    vaultBuildWrapper.setVaultAccessor(mockAccessor);

    this.project.getBuildWrappersList().add(vaultBuildWrapper);
    this.project.getBuildersList().add(echoSecret());

    FreeStyleBuild build = this.project.scheduleBuild2(0).get();

    jenkins.assertBuildStatus(Result.FAILURE, build);
    VaultConfig config = new VaultConfig().address(anyString());
    mockAccessor.setConfig(config);
    mockAccessor.setCredential(any(VaultCredential.class));
    verify(mockAccessor, times(0)).init();
    verify(mockAccessor, times(0)).read(anyString(), anyInt());
    jenkins.assertLogContains("CredentialsUnavailableException", build);
}
 
Example #14
Source File: GitHubTest.java    From configuration-as-code-plugin with MIT License 5 votes vote down vote up
@Test
@ConfiguredWithReadme("github/README.md")
public void configure_github() throws Exception {

    final GitHubPluginConfig configuration = GlobalConfiguration.all().get(GitHubPluginConfig.class);
    assertThat(configuration.getConfigs(), hasSize(1));

    GitHubServerConfig config = configuration.getConfigs().get(0);
    assertThat(config.getApiUrl(), is("https://github.domain.local/api/v3"));
    assertThat(config.getCredentialsId(), is("[GitHubEEUser]"));
    assertThat(config.getName(), is("InHouse GitHub EE"));
    assertTrue(config.isManageHooks());

}
 
Example #15
Source File: ConfigurationAsCode.java    From configuration-as-code-plugin with MIT License 5 votes vote down vote up
private List<String> getStandardConfig() {
    List<String> configParameters = getBundledCasCURIs();
    CasCGlobalConfig casc = GlobalConfiguration.all().get(CasCGlobalConfig.class);
    String cascPath = casc != null ? casc.getConfigurationPath() : null;

    String configParameter = System.getProperty(
            CASC_JENKINS_CONFIG_PROPERTY,
            System.getenv(CASC_JENKINS_CONFIG_ENV)
    );

    // We prefer to rely on environment variable over global config
    if (StringUtils.isNotBlank(cascPath) && StringUtils.isBlank(configParameter)) {
        configParameter = cascPath;
    }

    if (configParameter == null) {
        String fullPath = Jenkins.get().getRootDir() + File.separator + DEFAULT_JENKINS_YAML_PATH;
        if (Files.exists(Paths.get(fullPath))) {
            configParameter = fullPath;
        }
    }

    if (configParameter != null) {
        // Add external config parameter
        configParameters.add(configParameter);
    }

    if (configParameters.isEmpty()) {
        LOGGER.log(Level.FINE, "No configuration set nor default config file");
    }
    return configParameters;
}
 
Example #16
Source File: ConfigurationAsCode.java    From configuration-as-code-plugin with MIT License 5 votes vote down vote up
@RequirePOST
@Restricted(NoExternalUse.class)
public void doReplace(StaplerRequest request, StaplerResponse response) throws Exception {
    if (!Jenkins.get().hasPermission(Jenkins.ADMINISTER)) {
        response.sendError(HttpServletResponse.SC_FORBIDDEN);
        return;
    }
    String newSource = request.getParameter("_.newSource");
    String normalizedSource = Util.fixEmptyAndTrim(newSource);
    File file = new File(Util.fixNull(normalizedSource));
    if (file.exists() || ConfigurationAsCode.isSupportedURI(normalizedSource)) {
        List<String> candidatePaths = Collections.singletonList(normalizedSource);
        List<YamlSource> candidates = getConfigFromSources(candidatePaths);
        if (canApplyFrom(candidates)) {
            sources = candidatePaths;
            configureWith(getConfigFromSources(getSources()));
            CasCGlobalConfig config = GlobalConfiguration.all().get(CasCGlobalConfig.class);
            if (config != null) {
                config.setConfigurationPath(normalizedSource);
                config.save();
            }
            LOGGER.log(Level.FINE, "Replace configuration with: " + normalizedSource);
        } else {
            LOGGER.log(Level.WARNING, "Provided sources could not be applied");
            // todo: show message in UI
        }
    } else {
        LOGGER.log(Level.FINE, "No such source exists, applying default");
        // May be do nothing instead?
        configure();
    }
    response.sendRedirect("");
}
 
Example #17
Source File: FolderIT.java    From hashicorp-vault-plugin with MIT License 4 votes vote down vote up
@Before
public void setupJenkins() throws IOException {
    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);

    VaultConfiguration vaultConfig = new VaultConfiguration();
    vaultConfig.setVaultUrl("http://global-vault-url.com");
    vaultConfig.setVaultCredentialId(GLOBAL_CREDENTIALS_ID_1);
    vaultConfig.setFailIfNotFound(false);
    vaultConfig.setVaultNamespace("mynamespace");
    vaultConfig.setTimeout(TIMEOUT);

    globalConfig.setConfiguration(vaultConfig);
    globalConfig.save();

    FOLDER_1_CREDENTIAL = createTokenCredential(FOLDER_1_CREDENTIALS_ID);
    FOLDER_2_CREDENTIAL = createTokenCredential(FOLDER_2_CREDENTIALS_ID);

    FolderCredentialsProvider.FolderCredentialsProperty folder1CredProperty = new FolderCredentialsProvider.FolderCredentialsProperty(
        new DomainCredentials[]{
            new DomainCredentials(Domain.global(),
                Collections.singletonList(FOLDER_1_CREDENTIAL))});

    FolderCredentialsProvider.FolderCredentialsProperty folder2CredProperty = new FolderCredentialsProvider.FolderCredentialsProperty(
        new DomainCredentials[]{
            new DomainCredentials(Domain.global(),
                Collections.singletonList(FOLDER_2_CREDENTIAL))});

    GLOBAL_CREDENTIAL_1 = createTokenCredential(GLOBAL_CREDENTIALS_ID_1);
    GLOBAL_CREDENTIAL_2 = createTokenCredential(GLOBAL_CREDENTIALS_ID_2);

    SystemCredentialsProvider.getInstance()
        .setDomainCredentialsMap(Collections.singletonMap(Domain.global(), Arrays
            .asList(GLOBAL_CREDENTIAL_1, GLOBAL_CREDENTIAL_2)));

    this.folder1 = jenkins.createProject(Folder.class, "folder1");
    this.folder2 = jenkins.createProject(Folder.class, "folder2");

    folder1.addProperty(folder1CredProperty);
    folder2.addProperty(folder2CredProperty);

    projectInFolder1 = this.folder1.createProject(FreeStyleProject.class, "projectInFolder1");
    projectInFolder2 = this.folder2.createProject(FreeStyleProject.class, "projectInFolder2");
}
 
Example #18
Source File: GlobalPipelineMavenConfig.java    From pipeline-maven-plugin with MIT License 4 votes vote down vote up
@Nullable
public static GlobalPipelineMavenConfig get() {
    return GlobalConfiguration.all().get(GlobalPipelineMavenConfig.class);
}
 
Example #19
Source File: GlobalConfig.java    From docker-workflow-plugin with MIT License 4 votes vote down vote up
public static GlobalConfig get() {
    return ExtensionList.lookup(GlobalConfiguration.class).get(GlobalConfig.class);
}
 
Example #20
Source File: GitHubConfiguration.java    From github-branch-source-plugin with MIT License 4 votes vote down vote up
public static GitHubConfiguration get() {
    return GlobalConfiguration.all().get(GitHubConfiguration.class);
}
 
Example #21
Source File: JiraCloudPluginConfig.java    From atlassian-jira-software-cloud-plugin with Apache License 2.0 4 votes vote down vote up
@Nullable
public static JiraCloudPluginConfig get() {
    return GlobalConfiguration.all().get(JiraCloudPluginConfig.class);
}
 
Example #22
Source File: VaultHelper.java    From hashicorp-vault-plugin with MIT License 4 votes vote down vote up
@Override
public String call() throws IOException {
    Jenkins jenkins = Jenkins.get();

    String msg = String.format(
        "Retrieving vault secret path=%s key=%s engineVersion=%s",
        secretPath, secretKey, engineVersion);
    LOGGER.info(msg);

    GlobalVaultConfiguration globalConfig = GlobalConfiguration.all()
        .get(GlobalVaultConfiguration.class);

    if (globalConfig == null) {
        throw new IllegalStateException("Vault plugin has not been configured.");
    }

    ExtensionList<VaultBuildWrapper.DescriptorImpl> extensionList = jenkins
        .getExtensionList(VaultBuildWrapper.DescriptorImpl.class);
    VaultBuildWrapper.DescriptorImpl descriptor = extensionList.get(0);

    VaultConfiguration configuration = globalConfig.getConfiguration();

    if (descriptor == null || configuration == null) {
        throw new IllegalStateException("Vault plugin has not been configured.");
    }

    try {
        SslConfig sslConfig = new SslConfig()
            .verify(configuration.isSkipSslVerification())
            .build();

        VaultConfig vaultConfig = new VaultConfig()
            .address(configuration.getVaultUrl())
            .sslConfig(sslConfig)
            .engineVersion(engineVersion);

        if (isNotEmpty(configuration.getVaultNamespace())) {
            vaultConfig.nameSpace(configuration.getVaultNamespace());
        }

        if (isNotEmpty(configuration.getPrefixPath())) {
            vaultConfig.prefixPath(configuration.getPrefixPath());
        }

        VaultCredential vaultCredential = configuration.getVaultCredential();
        if (vaultCredential == null) vaultCredential = retrieveVaultCredentials(configuration.getVaultCredentialId());

        VaultAccessor vaultAccessor = new VaultAccessor(vaultConfig, vaultCredential);
        vaultAccessor.setMaxRetries(configuration.getMaxRetries());
        vaultAccessor.setRetryIntervalMilliseconds(configuration.getRetryIntervalMilliseconds());
        vaultAccessor.init();

        Map<String, String> values = vaultAccessor.read(secretPath, engineVersion).getData();

        if (!values.containsKey(secretKey)) {
            String message = String.format(
                "Key %s could not be found in path %s",
                secretKey, secretPath);
            throw new VaultPluginException(message);
        }

        return values.get(secretKey);
    } catch (Exception e) {
        throw new RuntimeException(e);
    }
}
 
Example #23
Source File: SetupConfig.java    From DotCi with MIT License 4 votes vote down vote up
public static SetupConfig get() {
    return GlobalConfiguration.all().get(SetupConfig.class);
}
 
Example #24
Source File: GlobalConfig.java    From hubot-steps-plugin with Apache License 2.0 4 votes vote down vote up
public GlobalConfig get() {
  return GlobalConfiguration.all().get(GlobalConfig.class);
}
 
Example #25
Source File: GlobalItemStorage.java    From jobcacher-plugin with MIT License 4 votes vote down vote up
public static GlobalItemStorage get() {
    return GlobalConfiguration.all().get(GlobalItemStorage.class);
}
 
Example #26
Source File: JobDslGlobalSecurityConfigurationTest.java    From configuration-as-code-plugin with MIT License 4 votes vote down vote up
private GlobalJobDslSecurityConfiguration getGlobalJobDslSecurityConfiguration() {
    final GlobalJobDslSecurityConfiguration dslSecurity = GlobalConfiguration.all()
        .get(GlobalJobDslSecurityConfiguration.class);
    assertNotNull(dslSecurity);
    return dslSecurity;
}
 
Example #27
Source File: GlobalKafkaConfiguration.java    From remoting-kafka-plugin with MIT License 4 votes vote down vote up
public static GlobalKafkaConfiguration get() {
    return GlobalConfiguration.all().getInstance(GlobalKafkaConfiguration.class);
}
 
Example #28
Source File: JobExecutionService.java    From sonar-quality-gates-plugin with MIT License 3 votes vote down vote up
public GlobalConfig getGlobalConfigData() {

        GlobalConfig globalConfig = GlobalConfiguration.all().get(GlobalConfig.class);

        if (globalConfig == null) {
            return new GlobalConfig();
        }

        return globalConfig;
    }
 
Example #29
Source File: ViolationsToGitHubConfiguration.java    From violation-comments-to-github-plugin with MIT License 2 votes vote down vote up
/**
 * Returns this singleton instance.
 *
 * @return the singleton.
 */
public static ViolationsToGitHubConfiguration get() {
  return GlobalConfiguration.all().get(ViolationsToGitHubConfiguration.class);
}
 
Example #30
Source File: BuildStatusConfig.java    From github-autostatus-plugin with MIT License 2 votes vote down vote up
/**
 * Convenience method to get the configuration object
 *
 * @return the configuration object
 */
public static BuildStatusConfig get() {
    return GlobalConfiguration.all().get(BuildStatusConfig.class);
}