STRING doesn't get issue title, but CONTEXT does
Opened this issue · 3 comments
sprnza commented
Jenkins and plugins versions report
Environment
Jenkins: 2.318
OS: Linux - 5.4.0-72-generic
---
ace-editor:1.1
allure-jenkins-plugin:2.29.0
ant:1.12
antisamy-markup-formatter:2.5
apache-httpcomponents-client-4-api:4.5.13-1.0
artifactory:3.13.2
authentication-tokens:1.4
basic-branch-build-strategies:1.3.2
bitbucket:1.1.29
blueocean:1.25.1
blueocean-autofavorite:1.2.4
blueocean-bitbucket-pipeline:1.25.1
blueocean-commons:1.25.1
blueocean-config:1.25.1
blueocean-core-js:1.25.1
blueocean-dashboard:1.25.1
blueocean-display-url:2.4.1
blueocean-events:1.25.1
blueocean-git-pipeline:1.25.1
blueocean-github-pipeline:1.25.1
blueocean-i18n:1.25.1
blueocean-jwt:1.25.1
blueocean-personalization:1.25.1
blueocean-pipeline-api-impl:1.25.1
blueocean-pipeline-editor:1.25.1
blueocean-pipeline-scm-api:1.25.1
blueocean-rest:1.25.1
blueocean-rest-impl:1.25.1
blueocean-web:1.25.1
bootstrap4-api:4.6.0-3
bootstrap5-api:5.1.1-1
bouncycastle-api:2.20
branch-api:2.7.0
build-user-vars-plugin:1.8
caffeine-api:2.9.2-29.v717aac953ff3
checks-api:1.7.2
cloudbees-bitbucket-branch-source:2.9.11
cloudbees-folder:6.16
command-launcher:1.2
config-file-provider:3.8.1
configuration-as-code:1.54
confluence-publisher:2.0.6
credentials:2.6.2
credentials-binding:1.27
crowd2:2.0.2
display-url-api:2.3.5
docker-commons:1.17
docker-workflow:1.26
durable-task:1.39
echarts-api:5.2.1-2
favorite:2.3.3
font-awesome-api:5.15.4-1
git:4.10.0
git-changelog:3.21
git-client:3.10.0
git-server:1.10
gitea:1.4.1
github:1.34.1
github-api:1.133
github-branch-source:2.11.3
gradle:1.37.1
greenballs:1.15.1
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-1.0
htmlpublisher:1.27
http_request:1.11
ivy:2.1
jackson2-api:2.13.0-230.v59243c64b0a5
javadoc:1.6
jdk-tool:1.0
jenkins-design-language:1.25.1
jira:3.6
jira-ext:0.9
jira-steps:1.6.0
jira-trigger:1.0.1
jjwt-api:0.11.2-9.c8b45b8bb173
jquery3-api:3.6.0-2
jsch:0.1.55.2
junit:1.53
lockable-resources:2.12
mailer:1.34
matrix-auth:2.6.8
matrix-project:1.19
maven-plugin:3.15
mercurial:2.15
momentjs:1.1.1
monitoring:1.88.0
msbuild:1.30
mstest:1.0.0
nodejs:1.4.1
okhttp-api:3.14.9-20211029
pipeline-build-step:2.15
pipeline-graph-analysis:1.11
pipeline-input-step:2.12
pipeline-milestone-step:1.3.2
pipeline-model-api:1.9.2
pipeline-model-definition:1.9.2
pipeline-model-extensions:1.9.2
pipeline-npm:0.9.2
pipeline-rest-api:2.19
pipeline-stage-step:2.5
pipeline-stage-tags-metadata:1.9.2
pipeline-stage-view:2.19
pipeline-utility-steps:2.10.0
plain-credentials:1.7
plugin-util-api:2.5.0
popper-api:1.16.1-2
popper2-api:2.10.2-1
pubsub-light:1.16
resource-disposer:0.16
scm-api:2.6.5
script-security:1.78
short-workspace-path:0.3
slack:2.48
snakeyaml-api:1.29.1
sse-gateway:1.24
ssh-credentials:1.19
sshd:3.1.0
startup-trigger-plugin:2.9.3
structs:1.23
thinBackup:1.10
timestamper:1.13
token-macro:267.vcdaea6462991
trilead-api:1.0.13
variant:1.4
workflow-aggregator:2.6
workflow-api:2.47
workflow-basic-steps:2.24
workflow-cps:2.94
workflow-cps-global-lib:2.21
workflow-durable-task-step:2.40
workflow-job:2.42
workflow-multibranch:2.26
workflow-scm-step:2.13
workflow-step-api:2.24
workflow-support:3.8
ws-cleanup:0.39
What Operating System are you using (both controller, and any agents involved in the problem)?
Linux Ubuntu 20.04.2 LTS
Reproduction steps
withCredentials([usernamePassword(credentialsId: '', usernameVariable: 'USERNAME', passwordVariable: 'PASSWORD')]) {
def changelogString = gitChangelog returnType: 'STRING',
from: [type: 'REF', value: '1.0'],
to: [type: 'REF', value: '1.0.1'],
template: '''
{{#issues}}
{{issue}}
{{title}}
{{/issues}}''',
jira: [issuePattern: 'OPS-([0-9]+)\\b', password: PASSWORD, server: '', username: USERNAME]
println(changelogString)
def changelogContext = gitChangelog returnType: 'CONTEXT',
from: [type: 'REF', value: '1.0'],
to: [type: 'REF', value: '1.0.1'],
jira: [issuePattern: 'OPS-([0-9]+)\\b', password: PASSWORD, server: '', username: USERNAME]
Set<String> issueIdentifiers = new TreeSet<>()
changelogContext.issues.each { issue ->
if (issue.name == 'Jira') {
issueIdentifiers.add(issue.issue)
issueIdentifiers.add(issue.title)
}
}
println(issueIdentifiers.join(','))
yelds to
[Pipeline] {
[Pipeline] gitChangelog
[Pipeline] echo
OPS-146
[Pipeline] gitChangelog
[Pipeline] echo
OPS-146,Task title
[Pipeline] }
### Expected Results
STRING variable {{title}} gets resolved to the jira issue title.
### Actual Results
STRING variable {{title}} is always empty
### Anything else?
If I use CONTEXT I get issue.title value correctly.
tomasbjerre commented
Made a quick analysis, did not find anything obvious. PR:s are welcome.
Possibly related to #50.
vladimirfx commented
It is because useIntegrations
flag is always true
for getChangelog()
(COTNEXT mode), but for render()
(STRING mode) it is used from settings which is false
by default and is no way to set it true
from this plugin.
I think it should be enabled when any integration settings are set to the plugin.
Needs to set .withUseIntegrations(true)
like in library tests. I wonder why is not set by library inself when any 'enabler' called.
tomasbjerre commented
My problem here is that I do not have access to a jira server and cannot test this properly. PR:s are welcome.