jenkinsci / badge-plugin

Jenkins Badge plugin
https://plugins.jenkins.io/badge/
MIT License
32 stars 43 forks source link

Not adding new line after each call and extending out into the main jenkins page totally broken #207

Closed sfransen closed 3 weeks ago

sfransen commented 3 weeks ago

Jenkins and plugins versions report

The addSummary and addBadge doesn't make a new line everything is warps as one block of text that extents too far out onto the main jenkins page. It is not contains inside of the Builds block

jenkins LTS 2.479.1
active-directory:2.37
analysis-model-api:12.9.0
ant:511.v0a_a_1a_334f41b_
antisamy-markup-formatter:162.v0e6ec0fcfcf6
apache-httpcomponents-client-4-api:4.5.14-208.v438351942757
apache-httpcomponents-client-5-api:5.4-124.v31e2987e48f4
appcenter:0.11.1
asm-api:9.7.1-97.v4cc844130d97
authentication-tokens:1.119.v50285141b_7e1
authorize-project:1.8.1
aws-credentials:231.v08a_59f17d742
aws-java-sdk:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-api-gateway:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-autoscaling:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-cloudformation:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-cloudfront:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-codebuild:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-codedeploy:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-ec2:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-ecr:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-ecs:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-efs:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-elasticbeanstalk:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-elasticloadbalancingv2:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-iam:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-kinesis:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-lambda:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-logs:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-minimal:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-organizations:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-secretsmanager:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-sns:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-sqs:1.12.772-474.v7f79a_2046a_fb_
aws-java-sdk-ssm:1.12.772-474.v7f79a_2046a_fb_
badge:2.3
basic-branch-build-strategies:81.v05e333931c7d
blueocean:1.27.16
blueocean-bitbucket-pipeline:1.27.16
blueocean-commons:1.27.16
blueocean-config:1.27.16
blueocean-core-js:1.27.16
blueocean-dashboard:1.27.16
blueocean-display-url:2.4.3
blueocean-events:1.27.16
blueocean-git-pipeline:1.27.16
blueocean-github-pipeline:1.27.16
blueocean-i18n:1.27.16
blueocean-jwt:1.27.16
blueocean-personalization:1.27.16
blueocean-pipeline-api-impl:1.27.16
blueocean-pipeline-editor:1.27.16
blueocean-pipeline-scm-api:1.27.16
blueocean-rest:1.27.16
blueocean-rest-impl:1.27.16
blueocean-web:1.27.16
bootstrap5-api:5.3.3-1
bouncycastle-api:2.30.1.78.1-248.ve27176eb_46cb_
branch-api:2.1197.vfa_d0c47c267d
build-blocker-plugin:166.vc82fc20b_a_ed6
build-failure-analyzer:2.5.2
build-history-manager:1.11.0
build-monitor-plugin:1.14-925.v95b_9089a_4c7f
build-name-setter:2.4.3
build-pipeline-plugin:2.0.2
build-timeout:1.33
build-user-vars-plugin:176.vb_9c7907fd524
buildtriggerbadge:251.vdf6ef853f3f5
caffeine-api:3.1.8-133.v17b_1ff2e0599
checks-api:2.2.1
cloud-stats:336.v788e4055508b_
cloudbees-bitbucket-branch-source:895.v15dc41668f03
cloudbees-folder:6.955.v81e2a_35c08d3
command-launcher:115.vd8b_301cc15d0
commons-compress-api:1.26.1-2
commons-lang3-api:3.17.0-84.vb_b_938040b_078
commons-text-api:1.12.0-129.v99a_50df237f7
conditional-buildstep:1.4.3
config-file-provider:980.v88956a_a_5d6a_d
configurationslicing:548.ve92d48e66b_f8
console-badge:1.1
copyartifact:757.v05365583a_455
credentials:1384.vf0a_2ed06f9c6
credentials-binding:681.vf91669a_32e45
custom-folder-icon:2.15
customize-build-now:17.ve5db_875e5343
customized-build-message:1.1
dark-theme:479.v661b_1b_911c01
dashboard-view:2.517.v776a_b_811a_b_4e
data-tables-api:2.1.8-1
delivery-pipeline-plugin:1.4.2
discard-old-build:1.07
display-url-api:2.204.vf6fddd8a_8b_e9
docker-build-publish:1.4.0
docker-build-step:2.12
docker-commons:443.v921729d5611d
docker-custom-build-environment:1.7.3
docker-java-api:3.4.0-94.v65ced49b_a_7d5
docker-plugin:1.7.0
docker-slaves:1.0.7
docker-workflow:580.vc0c340686b_54
downstream-build-cache:1.7
dtkit-api:3.0.2
durable-task:577.v2a_8a_4b_7c0247
echarts-api:5.5.1-4
eddsa-api:0.3.0-4.v84c6f0f4969e
editable-choice:71.v02a291ebbe45
email-ext:1844.v3ea_a_b_842374a_
embeddable-build-status:487.va_0ef04c898a_2
emoji-symbols-api:5.v70a_000e95970
envfile:43.v2644436e7d71
envinject:2.919.v009a_a_1067cd0
envinject-api:1.199.v3ce31253ed13
extensible-choice-parameter:1.8.1
external-monitor-job:215.v2e88e894db_f8
favorite:2.221.v19ca_666b_62f5
file-operations:321.vd98ef0161b_7e
folder-auth:1.4
folder-properties:1.2.1
font-awesome-api:6.6.0-2
forensics-api:2.6.0
generic-event:41.v2b15d4dfb893
generic-webhook-trigger:2.2.5
git:5.5.2
git-changelog:3.39
git-client:5.0.0
git-parameter:0.10.0
git-push:34.vd474e0fe7b_ec
git-server:126.v0d945d8d2b_39
github:1.40.0
github-api:1.321-468.v6a_9f5f2d5a_7e
github-branch-source:1807.v50351eb_7dd13
gradle:2.13.1
gson-api:2.11.0-85.v1f4e87273c33
handlebars:3.0.8
handy-uri-templates-2-api:2.1.8-30.v7e777411b_148
hidden-parameter:366.v7024b_32e399e
htmlpublisher:1.36
http_request:1.19
inline-pipeline:1.0.3
instance-identity:201.vd2a_b_5a_468a_a_6
ionicons-api:74.v93d5eb_813d5f
jackson2-api:2.17.0-379.v02de8ec9f64c
jakarta-activation-api:2.1.3-1
jakarta-mail-api:2.1.3-1
javadoc:280.v050b_5c849f69
javax-activation-api:1.2.0-7
javax-mail-api:1.6.2-10
jaxb:2.3.9-1
jdk-tool:80.v8a_dee33ed6f0
jenkins-design-language:1.27.16
jjwt-api:0.11.5-112.ve82dfb_224b_a_d
job-dsl:1.89
job-poll-action-plugin:1.0
joda-time-api:2.13.0-93.v9934da_29b_a_e9
jquery:1.12.4-3
jquery-detached:1.2.1
jquery-ui:1.0.2
jquery3-api:3.7.1-2
jsch:0.2.16-86.v42e010d9484b_
json-api:20240303-101.v7a_8666713110
json-path-api:2.9.0-118.v7f23ed82a_8b_8
junit:1307.vdd5b_2646279e
label-linked-jobs:6.0.1
labelled-steps:1.0
lastfailureversioncolumn:1.1
ldap:725.v3cb_b_711b_1a_ef
list-git-branches-parameter:0.0.13
lockable-resources:1327.ved786b_a_197e0
login-theme:238.va_647346d317b_
mailer:488.v0c9639c1a_eb_3
material-theme:0.5.2-rc100.6121925fe229
matrix-auth:3.2.3
matrix-project:839.vff91cd7e3a_b_2
maven-plugin:3.24
metrics:4.2.21-458.vcf496cb_839e4
mina-sshd-api-common:2.14.0-133.vcc091215a_358
mina-sshd-api-core:2.14.0-133.vcc091215a_358
momentjs:1.1.1
multibranch-build-strategy-extension:51.v88f14e2a_4075
multibranch-scan-webhook-trigger:1.0.11
nested-view:1.35
next-build-number:1.8
next-executions:392.v1d10c1b_5926f
no-agent-job-purge:24.vb_2e4b_b_e0e938
nodejs:1.6.2
nodelabelparameter:1.13.0
okhttp-api:4.11.0-172.vda_da_1feeb_c6e
oss-symbols-api:81.vec2a_0c35c3a_8
p4:1.16.0
pam-auth:1.11
parameter-separator:250.va_6292fd7f47b_
parameterized-trigger:806.vf6fff3e28c3e
periodicbackup:2.0
pipeline-build-step:540.vb_e8849e1a_b_d8
pipeline-config-history:1.6
pipeline-github:2.8-159.09e4403bc62f
pipeline-github-lib:61.v629f2cc41d83
pipeline-githubnotify-step:49.vf37bf92d2bc8
pipeline-graph-analysis:216.vfd8b_ece330ca_
pipeline-graph-view:340.v28cecee8b_25f
pipeline-groovy-lib:744.v5b_556ee7c253
pipeline-input-step:495.ve9c153f6067b_
pipeline-milestone-step:119.vdfdc43fc3b_9a_
pipeline-model-api:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-declarative-agent:1.1.1
pipeline-model-definition:2.2214.vb_b_34b_2ea_9b_83
pipeline-model-extensions:2.2214.vb_b_34b_2ea_9b_83
pipeline-multibranch-defaults:2.1
pipeline-rest-api:2.34
pipeline-stage-step:312.v8cd10304c27a_
pipeline-stage-tags-metadata:2.2214.vb_b_34b_2ea_9b_83
pipeline-stage-view:2.34
pipeline-timeline:1.0.3
pipeline-utility-steps:2.18.0
plain-credentials:183.va_de8f1dd5a_2b_
plugin-util-api:5.1.0
pollscm:1.5
popper2-api:2.11.6-5
prism-api:1.29.0-17
progress-bar-column-plugin:11.vdef198c2d6c1
project-description-setter:1.2
pubsub-light:1.18
purge-build-queue-plugin:88.v23b_97b_f2c7a_d
purge-job-history:1.6
readonly-parameters:1.0.0
rebuild:332.va_1ee476d8f6d
remote-file:1.24
resource-disposer:0.24
rich-text-publisher-plugin:1.5
role-strategy:743.v142ea_b_d5f1d3
run-condition:1.7
saferestart:0.7
scm-api:696.v778d637b_a_762
scm-filter-branch-pr:210.vf35256163d30
script-security:1367.vdf2fc45f229c
simple-theme-plugin:196.v96d9592f4efa_
slack:751.v2e44153c8fe1
snakeyaml-api:2.3-123.v13484c65210a_
solarized-theme:0.1
sse-gateway:1.27
ssh-credentials:343.v884f71d78167
ssh-slaves:2.973.v0fa_8c0dea_f9f
sshd:3.330.vc866a_8389b_58
structs:338.v848422169819
text-finder:1.30
theme-manager:262.vc57ee4a_eda_5d
thinBackup:2.1.1
throttle-concurrents:2.14
timestamper:1.27
token-macro:400.v35420b_922dcb_
trilead-api:2.147.vb_73cc728a_32e
variant:60.v7290fc0eb_b_cd
versioncolumn:243.vda_c20eea_a_8a_f
view-job-filters:392.v2c0a_4dd46909
warnings-ng:11.10.0
webhook-step:342.v620877effe14
workflow-aggregator:600.vb_57cdd26fdd7
workflow-api:1336.vee415d95c521
workflow-basic-steps:1058.vcb_fc1e3a_21a_9
workflow-cps:3990.vd281dd77a_388
workflow-durable-task-step:1371.vb_7cec8f3b_95e
workflow-job:1436.vfa_244484591f
workflow-multibranch:795.ve0cb_1f45ca_9a_
workflow-scm-step:427.v4ca_6512e7df1
workflow-step-api:678.v3ee58b_469476
workflow-support:930.vf51d22b_ce488
ws-cleanup:0.47
ws-ws-replacement:1.0.1
xml-job-to-job-dsl:0.1.13
xunit:3.1.5
yet-another-build-visualizer:1.17

What Operating System are you using (both controller, and any agents involved in the problem)?

Jenkins Host on both AWS Ubuntu 20.04 and Mac 14.6.1 (23G93) Apple M1 Max I ran it on the host and client same result

Reproduction steps

if have tried these 3 commands

Post_Build(String THIS_STRING, String THE_LINK='')
{
        if ( ( THE_LINK == "" ) || ( THE_LINK == null ) )
        {
            addSummary(icon: 'symbol-aperture-outline plugin-ionicons-api', text: THIS_STRING)
                        I tried both of them and both have the problem
            addBadge(text: THIS_STRING, style: 'color: var(--success-color)')
        }
        else
        {
            addSummary(icon: 'symbol-home-outline plugin-ionicons-api', text: THIS_STRING, link: THE_LINK)
        }
}

call Post_Build multi times and you just have one large block of text and it should be one line after another I tried adding html and new line and other to try and fix the bad text it is posting on jenkins now

Expected Results

It should add one line at a time and wrap inside of the build block if too long to fix in the block size

Actual Results

the text extend way out onto the main jenkins build page and doesn't stay inside of th Build block

Anything else?

No response

Are you interested in contributing a fix?

No response

strangelookingnerd commented 3 weeks ago

@sfransen I can not reproduce the badge extending out of the build history and breaking the main view as you describe it. Would you mind sharing a screenshot?

To me everything looks normal and as expected: Image Image

It is true that badges are not separated by a newline but to my understanding this is intentional and the badge-plugin is not in control of it. The arrangement of the badges is delegated towards the build history which is defined in the core. I know that there have been some changes in the past to actually improve the situation (https://github.com/jenkinsci/jenkins/pull/9148 and https://github.com/jenkinsci/jenkins/pull/9693 for example).

strangelookingnerd commented 3 weeks ago

I was able to have a newline between each badge by adding style: 'display: block; width: 100%; text-align: right;' - there might be other ways to achieve the same result but this worked for me:

Image

Closing this task for now. Feel free to re-open if you have questions or can provide more details on the bug you noticed.