如何将已完成的管道作业版本发布到公共Jenkins实例?

时间:2019-07-29 13:51:39

标签: jenkins continuous-integration

我有一个私有Jenkins在内部专用网络上运行,该网络无法从Internet上看到。我还有一个公共的Jenkins实例,可以从Internet上看到并且只能通过HTTPS访问。

如何从私有实例向公共实例发布完成的脚本化管道作业的完整版本(包括工件,日志,测试结果等)?

我知道Jenkins有一个Build Publisher Plugin,但我不知道如何从脚本化管道中使用它。

编辑Build Publisher Plugin不能在未经修改的情况下用于管道作业。还有其他方法可以达到相同目的吗?

1 个答案:

答案 0 :(得分:5)

stated here一样,您只能调用已与管道兼容的插件,这是使用较新的API。

并且由于build-publisher插件未在[private static async Task CreateAuthTicket(OAuthCreatingTicketContext context) { var request = new HttpRequestMessage(HttpMethod.Get, context.Options.UserInformationEndpoint); request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", context.AccessToken); request.Headers.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); var response = await context.Backchannel.SendAsync(request, HttpCompletionOption.ResponseHeadersRead, context.HttpContext.RequestAborted); if (!response.IsSuccessStatusCode) { var logger = EngineContext.Current.Resolve<ILogger>(); logger.Error($"An error occurred while retrieving the " + context.Options.ClaimsIssuer + " user profile"); return; } } 3列表中列出,因此您需要分叉jenkinsci/build-publisher-pluginmake it compatible with the new pipeline interface