小编Jim*_*Win的帖子

Cloudbees Jenkins Bitbucket Branch Source Plugin 配置硬编码以使用 Cloud?

尝试将 Bitbucket 源插件连接到我的本地 Bitbucket 数据中心(服务器)安装时,我收到 401 Unauthorized 错误。

如果我使用自己的 Bitbucket.org 云帐户凭据,则会出现不同的错误,这使我相信即使我已将插件配置为使用 Bitbucket 服务器,它仍会访问 Cloud bitbucket(.org)。

版本:Jenkins:2.110 Bitbucket Branch Source Plugin:2.2.11 Bitbucket(数据中心):v5.7.1

按照文档https://go.cloudbees.com/docs/cloudbees-documentation/cje-user-guide/index.html#bitbucket没有高级按钮来配置 Bitbucket 服务器/云。我发现的唯一配置是在配置系统 [Jenkins] 部分;

全局配置:

Bitbucket 端点

  • 比特桶服务器
  • 命名我的 Bitbucket Git
  • 服务器 URL https://mygit.net
  • 管理钩子 [no]

在我的多分支管道中,我删除了 Git 源并添加了 Bitbucket 源。

为我的 Bitbucket 实例配置了一个 rest API 帐户。我什至将此用户添加到管理员组中将所有者配置为我的 Bitbucket 实例中的一个项目

其他盒子都没有让我填充它们。

运行手动扫描会导致以下错误:

com.cloudbees.jenkins.plugins.bitbucket.api.BitbucketRequestException:HTTP 请求错误。状态:401:未经授权。

我有个人 Bitbucket.org 凭据。如果我改用这些(不更改任何其他配置),则会收到以下错误:

[Mon Apr 30 12:32:02 UTC 2018] Starting branch indexing...
Connecting to https://bitbucket.org using xxx.xxx@myemail.com/****** (My Atlassian Cloud)
ERROR: [Mon Apr …
Run Code Online (Sandbox Code Playgroud)

bitbucket jenkins cloudbees

5
推荐指数
1
解决办法
4772
查看次数

从字典列表中返回唯一值的计数

我有一个字典列表:

event_results = [{'device': 'prod2261.example.com'}, {'device': 'npbodb253.example.com'}, {'device': 'db221.example.com'}, {'device': 'db219.example.com'}, {'device': 'db209.example.com'}, {'device': 'db243.example.com'}, {'device': 'prod277.example.com'}, {'device': 'prod2228.example.com'}, {'device': 'prod2252.example.com'}, {'device': 'prod2116.example.com'}, {'device': 'prod224.example.com'}, {'device': 'db223.example.com'}, {'device': 'db229.example.com'}, {'device': 'prod2116.example.com'}, {'device': 'db221.example.com'}, {'device': 'db239.example.com'}, {'device': 'npbodb249.example.com'}, {'device': 'db210.example.com'}, {'device': 'db219.example.com'}, {'device': 'db243.example.com'}, {'device': 'prod2210.example.com'}, {'device': 'prod224.example.com'}, {'device': 'npbodb253.example.com'}, {'device': 'npbovwa018.example.com'}, {'device': 'npbovwa018.example.com'}, {'device': 'db221.example.com'}, {'device': 'db243.example.com'}, {'device': 'prod2228.example.com'}]
Run Code Online (Sandbox Code Playgroud)

我需要获取值,并计算唯一值。

输出示例如下:

prod2261.example.com, 2
prod2261.example.com, 5
....etc....
Run Code Online (Sandbox Code Playgroud)

到目前为止,我可以获得一组所有唯一值:

unique_values = set(e['device'] for e in event_results)
Run Code Online (Sandbox Code Playgroud)

但是我一直在努力遍历两个列表,并只返回unique_values集中每个项目的计数,而没有创建一堆临时列表,并且先将值存储在len()中。

我认为解决方案与列表理解有关,但是我无法解决。

python dictionary list-comprehension list

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