Artifactory 收集问题
Artifactory collect issues
我已经为我的 Jenkins 构建安装了 Artifactory 和 Jira 插件。添加了必需的标签,我看到构建将我的工件推送到 Artifactory。
我添加了 rtCollectIssues
部分,如下所示:
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.my-company.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
但是我仍然没有在 Artifactory 的 Builds 下看到任何问题:
然而,它成功地从 Jenkins 发送了这个数据(基于下图)
我如何添加 GIT 评论,以便它们被收集并发送到 JFrog Artifactory?
编辑:
詹金斯文件:
pipeline {
agent any
environment {
ENV_BRANCH_NAME = "${env.BRANCH_NAME}"
ENV_BUILD_NUMBER = "${env.BUILD_NUMBER}"
ENV_JOB_NAME = "${env.JOB_NAME.toLowerCase()}"
ENV_ARTIFACTORY_URL = "artifactorydev.mycompany.com:8081"
ENV_ARTIFACTORY_SERVER_ID = "art-01.net"
ENV_ARTIFACTORY_VIRTUAL_REPO = "docker"
ENV_ARTIFACTORY_RELEASE_REPO = "libs-release-local"
ENV_GIT_URL = "https://myserver/_git/hello-world"
}
stages {
stage ('Clone') {
steps {
echo 'Branch Name: ' + "${ENV_BRANCH_NAME}"
echo 'Build Number: ' + "${ENV_BUILD_NUMBER}"
echo 'Job Name: ' + "${ENV_JOB_NAME}"
echo 'Artifactory Url: ' + "http://${ENV_ARTIFACTORY_URL}/artifactory"
echo 'Artifactory ServerId: ' + "${ENV_ARTIFACTORY_SERVER_ID}"
git(
url: "${ENV_GIT_URL}",
credentialsId: '4c81efa2-1d49-4b70-859e-d699c1f618c0',
branch: 'master'
)
}
}
stage ('Artifactory configuration') {
steps {
rtServer (
id: "${ENV_ARTIFACTORY_SERVER_ID}",
url: "http://${ENV_ARTIFACTORY_URL}/artifactory",
credentialsId: 'f8f8918e-0368-4b37-88ed-cf25401fa1e1',
bypassProxy: true
)
}
}
stage('Build Docker Image') {
steps {
echo 'Starting to build docker image'
script {
def dockerfile = 'Dockerfile'
def customImage = docker.build('$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER', "-f ${dockerfile} .")
}
}
}
stage ('Push To Artifactory') {
steps {
rtDockerPush(
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
image: "$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER",
host: 'tcp://localhost:2375',
targetRepo: "$ENV_ARTIFACTORY_VIRTUAL_REPO",
// Attach custom properties to the published artifacts:
properties: 'status=stable'
)
}
}
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.inwk.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
// You may alternatively provide a path to a config file, instead of the config itself, by setting:
// configPath: '/path/to/config'
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Publish Build Info') {
steps {
rtBuildInfo (
captureEnv: true,
includeEnvPatterns: ['*Env*'],
maxBuilds: 2,
maxDays: 2,
doNotDiscardBuilds: ["3"],
deleteBuildArtifacts: true,
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
rtPublishBuildInfo (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
}
}
编辑(将管道添加到问题后):
rtBuildInfo
步骤配置构建信息实例。如果没有指定 name/number ,它会配置与 jenkins 作业匹配的默认构建信息。
提供自定义构建详细信息时,如果尚未创建匹配的构建信息实例,则会创建一个新的构建信息实例。因此,在创建新实例时,应在将使用该实例的其他步骤之前使用该步骤。
因此,您的管道示例为:
pipeline { agent any
environment {
ENV_BRANCH_NAME = "${env.BRANCH_NAME}"
ENV_BUILD_NUMBER = "${env.BUILD_NUMBER}"
ENV_JOB_NAME = "${env.JOB_NAME.toLowerCase()}"
ENV_ARTIFACTORY_URL = "artifactorydev.mycompany.com:8081"
ENV_ARTIFACTORY_SERVER_ID = "art-01.net"
ENV_ARTIFACTORY_VIRTUAL_REPO = "docker"
ENV_ARTIFACTORY_RELEASE_REPO = "libs-release-local"
ENV_GIT_URL = "https://myserver/_git/hello-world"
}
stages {
stage ('Clone') {
steps {
echo 'Branch Name: ' + "${ENV_BRANCH_NAME}"
echo 'Build Number: ' + "${ENV_BUILD_NUMBER}"
echo 'Job Name: ' + "${ENV_JOB_NAME}"
echo 'Artifactory Url: ' + "http://${ENV_ARTIFACTORY_URL}/artifactory"
echo 'Artifactory ServerId: ' + "${ENV_ARTIFACTORY_SERVER_ID}"
git(
url: "${ENV_GIT_URL}",
credentialsId: '4c81efa2-1d49-4b70-859e-d699c1f618c0',
branch: 'master'
)
}
}
stage ('Artifactory configuration') {
steps {
rtServer (
id: "${ENV_ARTIFACTORY_SERVER_ID}",
url: "http://${ENV_ARTIFACTORY_URL}/artifactory",
credentialsId: 'f8f8918e-0368-4b37-88ed-cf25401fa1e1',
bypassProxy: true
)
}
}
stage ('Configure Build Info') {
steps {
rtBuildInfo (
captureEnv: true,
includeEnvPatterns: ['*Env*'],
maxBuilds: 2,
maxDays: 2,
doNotDiscardBuilds: ["3"],
deleteBuildArtifacts: true,
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage('Build Docker Image') {
steps {
echo 'Starting to build docker image'
script {
def dockerfile = 'Dockerfile'
def customImage = docker.build('$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER', "-f ${dockerfile} .")
}
}
}
stage ('Push To Artifactory') {
steps {
rtDockerPush(
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
image: "$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER",
host: 'tcp://localhost:2375',
targetRepo: "$ENV_ARTIFACTORY_VIRTUAL_REPO",
// Attach custom properties to the published artifacts:
properties: 'status=stable',
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.inwk.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
// You may alternatively provide a path to a config file, instead of the config itself, by setting:
// configPath: '/path/to/config'
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Publish Build Info') {
steps {
rtPublishBuildInfo (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
}
}
请注意 rtBuildInfo
步骤是如何移动到使用它的任何步骤之前的。我还将 buildName
和 buildNumber
字段添加到 rtDockerPush
步骤,假设您还希望为该步骤收集构建信息。
现在,当您在日志中看到添加了问题时,您应该也会在 Artifactory 中看到它们。
编辑结束。
How would I add GIT comments so that they are collected and sent to JFrog Artifactory?
问题收集配置中的 regexp
字段控制将哪些 git 消息收集为问题。来自 documentation:
A regular expression used for matching the git commit messages. The expression should include two capturing groups - for the issue key (ID) and the issue summary.
例如,对于以下正则表达式字段:
'regexp': '(.+-[0-9]+)\s-\s(.+)'
正则表达式匹配提交消息,如下例所示:
HAP-1364 - 用空格替换制表符
我已经为我的 Jenkins 构建安装了 Artifactory 和 Jira 插件。添加了必需的标签,我看到构建将我的工件推送到 Artifactory。
我添加了 rtCollectIssues
部分,如下所示:
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.my-company.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
但是我仍然没有在 Artifactory 的 Builds 下看到任何问题:
然而,它成功地从 Jenkins 发送了这个数据(基于下图)
我如何添加 GIT 评论,以便它们被收集并发送到 JFrog Artifactory?
编辑: 詹金斯文件:
pipeline {
agent any
environment {
ENV_BRANCH_NAME = "${env.BRANCH_NAME}"
ENV_BUILD_NUMBER = "${env.BUILD_NUMBER}"
ENV_JOB_NAME = "${env.JOB_NAME.toLowerCase()}"
ENV_ARTIFACTORY_URL = "artifactorydev.mycompany.com:8081"
ENV_ARTIFACTORY_SERVER_ID = "art-01.net"
ENV_ARTIFACTORY_VIRTUAL_REPO = "docker"
ENV_ARTIFACTORY_RELEASE_REPO = "libs-release-local"
ENV_GIT_URL = "https://myserver/_git/hello-world"
}
stages {
stage ('Clone') {
steps {
echo 'Branch Name: ' + "${ENV_BRANCH_NAME}"
echo 'Build Number: ' + "${ENV_BUILD_NUMBER}"
echo 'Job Name: ' + "${ENV_JOB_NAME}"
echo 'Artifactory Url: ' + "http://${ENV_ARTIFACTORY_URL}/artifactory"
echo 'Artifactory ServerId: ' + "${ENV_ARTIFACTORY_SERVER_ID}"
git(
url: "${ENV_GIT_URL}",
credentialsId: '4c81efa2-1d49-4b70-859e-d699c1f618c0',
branch: 'master'
)
}
}
stage ('Artifactory configuration') {
steps {
rtServer (
id: "${ENV_ARTIFACTORY_SERVER_ID}",
url: "http://${ENV_ARTIFACTORY_URL}/artifactory",
credentialsId: 'f8f8918e-0368-4b37-88ed-cf25401fa1e1',
bypassProxy: true
)
}
}
stage('Build Docker Image') {
steps {
echo 'Starting to build docker image'
script {
def dockerfile = 'Dockerfile'
def customImage = docker.build('$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER', "-f ${dockerfile} .")
}
}
}
stage ('Push To Artifactory') {
steps {
rtDockerPush(
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
image: "$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER",
host: 'tcp://localhost:2375',
targetRepo: "$ENV_ARTIFACTORY_VIRTUAL_REPO",
// Attach custom properties to the published artifacts:
properties: 'status=stable'
)
}
}
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.inwk.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
// You may alternatively provide a path to a config file, instead of the config itself, by setting:
// configPath: '/path/to/config'
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Publish Build Info') {
steps {
rtBuildInfo (
captureEnv: true,
includeEnvPatterns: ['*Env*'],
maxBuilds: 2,
maxDays: 2,
doNotDiscardBuilds: ["3"],
deleteBuildArtifacts: true,
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
rtPublishBuildInfo (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
}
}
编辑(将管道添加到问题后):
rtBuildInfo
步骤配置构建信息实例。如果没有指定 name/number ,它会配置与 jenkins 作业匹配的默认构建信息。
提供自定义构建详细信息时,如果尚未创建匹配的构建信息实例,则会创建一个新的构建信息实例。因此,在创建新实例时,应在将使用该实例的其他步骤之前使用该步骤。
因此,您的管道示例为:
pipeline { agent any
environment {
ENV_BRANCH_NAME = "${env.BRANCH_NAME}"
ENV_BUILD_NUMBER = "${env.BUILD_NUMBER}"
ENV_JOB_NAME = "${env.JOB_NAME.toLowerCase()}"
ENV_ARTIFACTORY_URL = "artifactorydev.mycompany.com:8081"
ENV_ARTIFACTORY_SERVER_ID = "art-01.net"
ENV_ARTIFACTORY_VIRTUAL_REPO = "docker"
ENV_ARTIFACTORY_RELEASE_REPO = "libs-release-local"
ENV_GIT_URL = "https://myserver/_git/hello-world"
}
stages {
stage ('Clone') {
steps {
echo 'Branch Name: ' + "${ENV_BRANCH_NAME}"
echo 'Build Number: ' + "${ENV_BUILD_NUMBER}"
echo 'Job Name: ' + "${ENV_JOB_NAME}"
echo 'Artifactory Url: ' + "http://${ENV_ARTIFACTORY_URL}/artifactory"
echo 'Artifactory ServerId: ' + "${ENV_ARTIFACTORY_SERVER_ID}"
git(
url: "${ENV_GIT_URL}",
credentialsId: '4c81efa2-1d49-4b70-859e-d699c1f618c0',
branch: 'master'
)
}
}
stage ('Artifactory configuration') {
steps {
rtServer (
id: "${ENV_ARTIFACTORY_SERVER_ID}",
url: "http://${ENV_ARTIFACTORY_URL}/artifactory",
credentialsId: 'f8f8918e-0368-4b37-88ed-cf25401fa1e1',
bypassProxy: true
)
}
}
stage ('Configure Build Info') {
steps {
rtBuildInfo (
captureEnv: true,
includeEnvPatterns: ['*Env*'],
maxBuilds: 2,
maxDays: 2,
doNotDiscardBuilds: ["3"],
deleteBuildArtifacts: true,
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage('Build Docker Image') {
steps {
echo 'Starting to build docker image'
script {
def dockerfile = 'Dockerfile'
def customImage = docker.build('$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER', "-f ${dockerfile} .")
}
}
}
stage ('Push To Artifactory') {
steps {
rtDockerPush(
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
image: "$ENV_ARTIFACTORY_URL/$ENV_ARTIFACTORY_VIRTUAL_REPO/$ENV_JOB_NAME:$ENV_BUILD_NUMBER",
host: 'tcp://localhost:2375',
targetRepo: "$ENV_ARTIFACTORY_VIRTUAL_REPO",
// Attach custom properties to the published artifacts:
properties: 'status=stable',
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Issues Collection') {
steps {
rtCollectIssues (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
config: """{
"version": 1,
"issues": {
"trackerName": "JIRA",
"regexp": "(.+-[0-9]+)\s-\s(.+)",
"keyGroupIndex": 1,
"summaryGroupIndex": 2,
"trackerUrl": "https://jira.inwk.com",
"aggregate": "true",
"aggregationStatus": "RELEASED"
}
}""",
// You may alternatively provide a path to a config file, instead of the config itself, by setting:
// configPath: '/path/to/config'
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
stage ('Publish Build Info') {
steps {
rtPublishBuildInfo (
serverId: "${ENV_ARTIFACTORY_SERVER_ID}",
buildName: "${ENV_JOB_NAME}",
buildNumber: "${ENV_BUILD_NUMBER}"
)
}
}
}
}
请注意 rtBuildInfo
步骤是如何移动到使用它的任何步骤之前的。我还将 buildName
和 buildNumber
字段添加到 rtDockerPush
步骤,假设您还希望为该步骤收集构建信息。
现在,当您在日志中看到添加了问题时,您应该也会在 Artifactory 中看到它们。
编辑结束。
How would I add GIT comments so that they are collected and sent to JFrog Artifactory?
问题收集配置中的 regexp
字段控制将哪些 git 消息收集为问题。来自 documentation:
A regular expression used for matching the git commit messages. The expression should include two capturing groups - for the issue key (ID) and the issue summary.
例如,对于以下正则表达式字段:
'regexp': '(.+-[0-9]+)\s-\s(.+)'
正则表达式匹配提交消息,如下例所示:
HAP-1364 - 用空格替换制表符