小编Tho*_*ene的帖子

在Jenkinsfile中检查不同的分支是不可能的吗?

我在BitBucket上有两个分支:masterdevelop.我还在Jenkins服务器上配置了BitBucket Team Folder作业来构建该存储库.在develop分支上有以下Jenkinsfile:

node {
    stage('Checkout') {
        checkout scm
    }

    stage('Try different branch') {
        sh "git branch -r"
        sh "git checkout master"
    }
}
Run Code Online (Sandbox Code Playgroud)

当Jenkins运行它时,构建在尝试签出时失败master:

[Pipeline] stage
[Pipeline] { (Try different branch)
[Pipeline] sh
[e_jenkinsfile-tests_develop-4R65E2H6B73J3LB52BLACQOZLBJGN2QG22IPONX3CV46B764LAXA] Running shell script
+ git branch -r
  origin/develop
[Pipeline] sh
[e_jenkinsfile-tests_develop-4R65E2H6B73J3LB52BLACQOZLBJGN2QG22IPONX3CV46B764LAXA] Running shell script
+ git checkout master
error: pathspec 'master' did not match any file(s) known to git.
[Pipeline] }
Run Code Online (Sandbox Code Playgroud)

我所预料的git branch -r命令打印出两个origin/master …

git bitbucket jenkins jenkins-pipeline

12
推荐指数
3
解决办法
3万
查看次数

我可以在资源服务器启动时禁用颁发者验证吗?

我正在尝试使用 Spring Security 设置一个资源服务器,现在我想在我的机器上运行它,它必须通过 SSH 隧道才能到达令牌颁发者,因此我的应用程序最终调用的 URI 类似于http://localhost:1234/.well-known/openid-configuration. 然而,这个端点返回类似的https://my-auth-server.my-domain.com内容issuer的内容,当框架在启动期间尝试检查两个 URI 是否相等时,这会产生问题。

我已经能够追踪到JwtDecoderProviderConfigurationUtils进行此检查的位置,但我只是找不到任何挂钩来操纵它:

  • JwtDecoders不公开任何指示它不验证启动时的属性issuer源文件)。
  • JwtDecoderProviderConfigurationUtil使用它自己的私有的RestTemplate,所以我不能向它添加任何拦截器。
  • JwtDecoderProviderConfigurationUtil是包私有的,所以我无法访问它的任何方法来编写我自己的JwtDecoder.

我很高兴收到有关如何解决此问题的任何指示!我不想为了让它工作而复制一大堆代码。

java spring-security-oauth2

7
推荐指数
1
解决办法
2092
查看次数

测试自定义Spring Boot自动配置是否有效

我决定编写一个简单的测试来检查我的Spring Boot自动配置是否正常工作-所有必需的bean及其依赖关系都已创建。

自动配置是:

package org.project.module.autoconfigure;

import org.project.module.SomeFactory;
import org.project.module.SomeProducer;
import org.project.module.SomeServiceClient;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;

/**
 * Spring Boot simple auto-configuration.
 *
 * @author istepanov
 */
@Configuration
@ComponentScan("org.project.module.support")
public class SomeAutoConfiguration {

    @Bean
    @ConditionalOnMissingBean
    public SomeFactory someFactory() {
        return new SomeFactory();
    }

    @Bean
    @ConditionalOnMissingBean
    public SomeServiceClient someServiceClient() {
        return new SomeServiceClient();
    }

    @Bean
    @ConditionalOnMissingBean
    public SomeProducer someProducer() {
        return new SomeProducer();
    }
}
Run Code Online (Sandbox Code Playgroud)

测试是:

package org.project.module.autoconfigure;

import org.project.module.SomeFactory;
import org.project.module.SomeProducer;
import org.project.module.SomeServiceClient;
import org.junit.Test;
import org.junit.runner.RunWith; …
Run Code Online (Sandbox Code Playgroud)

java integration-testing spring-boot

2
推荐指数
1
解决办法
5790
查看次数