在Bitbucket存储库上托管和编辑Jenkins配置文件

tcomlyy6  于 2023-01-16  发布在  Jenkins
关注(0)|答案(1)|浏览(211)

我用非常基本的Jenkins文件创建了一个git仓库:

pipeline {
    agent any
    stages {
        stage('Build') {
            steps {
                sh "echo 'building..'"
            }
        }
        stage('Test'){
            steps {
                sh "echo 'Testing...'"
            }
        }
        stage('Deploy') {
            steps {
                sh "echo 'Deploying...'"
            }
        }
    }
}

储存库:

我尝试使用Jenkins Ocean插件导入此配置:

正如您所看到的,该文件无法识别,但我得到了一个生成的图:

当我尝试编辑和提交图表时,我收到错误:

1.您知道什么应该是有效的Jenkins文件才能成功导入吗?
1.如何正确提交文件,以便将更改保存到Bitbucket中?
编辑:Jenkins错误堆栈:

2023-01-15 23:47:49.508+0000 [id=15]    WARNING i.j.b.b.BitbucketPipelineCreateRequest#repoHasJenkinsFile: Error detecting Jenkinsfile: HTTP request error. Status: 401: .
HttpResponseProxy{HTTP/1.1 401  [X-AREQUESTID: @16EV4PWx1427x585x0, Cache-Control: no-cache, no-transform, Vary: x-ausername,x-auserid,cookie,accept-encoding, X-Content-Type-Options: nosniff, WWW-Authenticate: OAuth realm="http%3A%2F%2F192.168.1.30%3A7990", Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Date: Sun, 15 Jan 2023 23:47:49 GMT, Keep-Alive: timeout=60, Connection: keep-alive] org.apache.http.client.entity.DecompressingEntity@600f472a}
com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException: HTTP request error. Status: 401: .
HttpResponseProxy{HTTP/1.1 401  [X-AREQUESTID: @16EV4PWx1427x585x0, Cache-Control: no-cache, no-transform, Vary: x-ausername,x-auserid,cookie,accept-encoding, X-Content-Type-Options: nosniff, WWW-Authenticate: OAuth realm="http%3A%2F%2F192.168.1.30%3A7990", Content-Type: application/json;charset=UTF-8, Transfer-Encoding: chunked, Date: Sun, 15 Jan 2023 23:47:49 GMT, Keep-Alive: timeout=60, Connection: keep-alive] org.apache.http.client.entity.DecompressingEntity@600f472a}
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRequest(BitbucketServerAPIClient.java:884)
        at com.cloudbees.jenkins.plugins.bitbucket.server.client.BitbucketServerAPIClient.getRepository(BitbucketServerAPIClient.java:481)
        at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.getRepositoryType(BitbucketSCMSource.java:508)
        at com.cloudbees.jenkins.plugins.bitbucket.BitbucketSCMSource.retrieve(BitbucketSCMSource.java:556)
        at jenkins.scm.api.SCMSource._retrieve(SCMSource.java:373)
        at jenkins.scm.api.SCMSource.fetch(SCMSource.java:303)
        at io.jenkins.blueocean.blueocean_bitbucket_pipeline.BitbucketPipelineCreateRequest.repoHasJenkinsFile(BitbucketPipelineCreateRequest.java:112)
        at io.jenkins.blueocean.scm.api.AbstractMultiBranchCreateRequest.create(AbstractMultiBranchCreateRequest.java:83)
        at io.jenkins.blueocean.rest.model.BluePipelineContainer.create(BluePipelineContainer.java:54)
        at io.jenkins.blueocean.rest.model.BluePipelineContainer.create(BluePipelineContainer.java:50)
        at java.base/java.lang.invoke.MethodHandle.invokeWithArguments(MethodHandle.java:710)
        at org.kohsuke.stapler.Function$MethodFunction.invoke(Function.java:397)
        at org.kohsuke.stapler.Function$InstanceFunction.invoke(Function.java:409)
        at org.kohsuke.stapler.Function.bindAndInvoke(Function.java:207)
        at org.kohsuke.stapler.SelectionInterceptedFunction$Adapter.invoke(SelectionInterceptedFunction.java:36)
        at org.kohsuke.stapler.verb.HttpVerbInterceptor.invoke(HttpVerbInterceptor.java:48)
        at org.kohsuke.stapler.SelectionInterceptedFunction.bindAndInvoke(SelectionInterceptedFunction.java:26)
        at org.kohsuke.stapler.Function.bindAndInvokeAndServeResponse(Function.java:140)
        at org.kohsuke.stapler.IndexDispatcher.dispatch(IndexDispatcher.java:28)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.MetaClass$2.doDispatch(MetaClass.java:224)
        at org.kohsuke.stapler.NameBasedDispatcher.dispatch(NameBasedDispatcher.java:59)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:739)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.MetaClass$9.dispatch(MetaClass.java:475)
        at org.kohsuke.stapler.Stapler.tryInvoke(Stapler.java:770)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:900)
        at org.kohsuke.stapler.Stapler.invoke(Stapler.java:698)
        at org.kohsuke.stapler.Stapler.service(Stapler.java:248)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:590)
        at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:764)
        at org.eclipse.jetty.servlet.ServletHandler$ChainEnd.doFilter(ServletHandler.java:1665)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:157)
        at org.jenkinsci.plugins.ssegateway.Endpoint$SSEListenChannelFilter.doFilter(Endpoint.java:248)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
        at jenkins.telemetry.impl.UserLanguages$AcceptLanguageFilter.doFilter(UserLanguages.java:129)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
        at jenkins.security.ResourceDomainFilter.doFilter(ResourceDomainFilter.java:81)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
        at io.jenkins.blueocean.ResourceCacheControl.doFilter(ResourceCacheControl.java:134)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
        at io.jenkins.blueocean.auth.jwt.impl.JwtAuthenticationFilter.doFilter(JwtAuthenticationFilter.java:60)
        at hudson.util.PluginServletFilter$1.doFilter(PluginServletFilter.java:154)
        at hudson.util.PluginServletFilter.doFilter(PluginServletFilter.java:160)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at hudson.security.csrf.CrumbFilter.doFilter(CrumbFilter.java:154)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:94)
        at jenkins.security.AcegiSecurityExceptionFilter.doFilter(AcegiSecurityExceptionFilter.java:52)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at hudson.security.UnwrapSecurityExceptionFilter.doFilter(UnwrapSecurityExceptionFilter.java:54)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:126)
        at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:120)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:100)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:110)
        at org.springframework.security.web.authentication.rememberme.RememberMeAuthenticationFilter.doFilter(RememberMeAuthenticationFilter.java:101)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:227)
        at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:221)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at jenkins.security.BasicHeaderProcessor.doFilter(BasicHeaderProcessor.java:97)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:117)
        at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)
        at hudson.security.HttpSessionContextIntegrationFilter2.doFilter(HttpSessionContextIntegrationFilter2.java:63)
        at hudson.security.ChainedServletFilter$1.doFilter(ChainedServletFilter.java:99)
        at hudson.security.ChainedServletFilter.doFilter(ChainedServletFilter.java:111)
        at hudson.security.HudsonFilter.doFilter(HudsonFilter.java:172)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at org.kohsuke.stapler.compression.CompressionFilter.doFilter(CompressionFilter.java:53)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at hudson.util.CharacterEncodingFilter.doFilter(CharacterEncodingFilter.java:86)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at org.kohsuke.stapler.DiagnosticThreadNameFilter.doFilter(DiagnosticThreadNameFilter.java:30)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at jenkins.security.SuspiciousRequestFilter.doFilter(SuspiciousRequestFilter.java:38)
        at org.eclipse.jetty.servlet.FilterHolder.doFilter(FilterHolder.java:202)
        at org.eclipse.jetty.servlet.ServletHandler$Chain.doFilter(ServletHandler.java:1635)
        at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:527)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:131)
        at org.eclipse.jetty.security.SecurityHandler.handle(SecurityHandler.java:549)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:223)
        at org.eclipse.jetty.server.session.SessionHandler.doHandle(SessionHandler.java:1570)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextHandle(ScopedHandler.java:221)
        at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1383)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:176)
        at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:484)
        at org.eclipse.jetty.server.session.SessionHandler.doScope(SessionHandler.java:1543)
        at org.eclipse.jetty.server.handler.ScopedHandler.nextScope(ScopedHandler.java:174)
        at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1305)
        at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:129)
        at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:122)
        at org.eclipse.jetty.server.Server.handle(Server.java:563)
        at org.eclipse.jetty.server.HttpChannel.lambda$handle$0(HttpChannel.java:505)
        at org.eclipse.jetty.server.HttpChannel.dispatch(HttpChannel.java:762)
        at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:497)
        at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:282)
        at org.eclipse.jetty.io.AbstractConnection$ReadCallback.succeeded(AbstractConnection.java:314)
        at org.eclipse.jetty.io.FillInterest.fillable(FillInterest.java:100)
        at org.eclipse.jetty.io.SelectableChannelEndPoint$1.run(SelectableChannelEndPoint.java:53)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.runTask(AdaptiveExecutionStrategy.java:416)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.consumeTask(AdaptiveExecutionStrategy.java:385)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.tryProduce(AdaptiveExecutionStrategy.java:272)
        at org.eclipse.jetty.util.thread.strategy.AdaptiveExecutionStrategy.lambda$new$0(AdaptiveExecutionStrategy.java:140)
        at org.eclipse.jetty.util.thread.ReservedThreadExecutor$ReservedThread.run(ReservedThreadExecutor.java:411)
        at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:934)
        at org.eclipse.jetty.util.thread.QueuedThreadPool$Runner.run(QueuedThreadPool.java:1078)
        at java.base/java.lang.Thread.run(Thread.java:829)
w8ntj3qf

w8ntj3qf1#

我相信这个问题是与蓝海插件。
避免使用Blue Ocean插件(至少在创建作业等时是这样。阅读数据对于轻量级构建来说是可以的),因为它不是由CloudBees主动维护的,他们建议使用其他插件。

相关问题