我正在尝试在Jenkins上设置Bitbucket OAuth,但是一旦这样做,由Swarm插件创建的从属将无法连接到主节点。 我已经用一个时髦的脚本设置了Bitbucket OAuth:
Jenkins jenkins = Jenkins.getInstance()
SecurityRealm bitbucketSecurityRealm = new BitbucketSecurityRealm(
new File("/run/secrets/bitbucket-oauth-id").text.trim(),
new File("/run/secrets/bitbucket-oauth-secret").text.trim()
)
AuthorizationStrategy authorizationStrategy = new hudson.security.FullControlOnceLoggedInAuthorizationStrategy()
authorizationStrategy.setAllowAnonymousRead(false)
jenkins.setSecurityRealm(bitbucketSecurityRealm)
jenkins.setAuthorizationStrategy(authorizationStrategy)
我通过以下方式运行奴隶:
java -jar /usr/share/jenkins/swarm-client-3.9.jar -master ${MASTER_URL} -username ${USERNAME} -password ${PASSWORD}
对于用户名,我尝试使用bitbucket用户名和电子邮件地址;对于密码,我尝试使用bitbucket密码和访问令牌。
但是我得到未经授权的回复:
hudson.plugins.swarm.Client run
INFO: Discovering Jenkins master
SLF4J: Failed to load class "org.slf4j.impl.StaticLoggerBinder".
SLF4J: Defaulting to no-operation (NOP) logger implementation
SLF4J: See http://www.slf4j.org/codes.html#StaticLoggerBinder for further details.
hudson.plugins.swarm.SwarmClient discoverFromMasterUrl
SEVERE: Failed to fetch slave info from Jenkins, HTTP response code: 401
是否可以同时使用Bitbucket OAuth插件和Swarm插件? (来自Jenkins Swarm plugin authentication的LDAP也存在类似的问题)