Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Usage/purpose of the "link" parameter is unclear #370

Open
kkaja123 opened this issue Jan 10, 2025 · 2 comments
Open

Usage/purpose of the "link" parameter is unclear #370

kkaja123 opened this issue Jan 10, 2025 · 2 comments

Comments

@kkaja123
Copy link

Describe your use-case which is not covered by existing documentation.

The "link" can be provided in the query or in the pipeline addEmbeddableBadgeConfiguration function. This results in the icon now being clickable, but I can't figure out how to embed the icon while still taking me to the configured link.

E.g. in Markdown, an image target hyperlink needs to be explicitly provided. It's not like the rendered markdown will automatically inherit the source icon's hyperlink target. I can make the markdown image's hyperlink the image itself, which takes me to a page that only has the badge, and I can click on that to go to the configured "link".

Maybe there's a special http://<jenkins_root>/buildStatus/link URL that would redirect the client to the configured "link", but I haven't been able to find anything in the documentation that could do something like that.

Ultimately, is there a point of the "link" parameter if the primary use case for the plugin is to "embed" the badges elsewhere, where the "link" parameter cannot be used? The information in the documentation about the "link" parameter is lacking in this regard.

Reference any relevant documentation, other materials or issues/pull requests that can be used for inspiration.

No response

Are you interested in contributing to the documentation?

No response

@MarkEWaite
Copy link
Contributor

I think that I'm not understanding the question. The link parameter is primarily

I embed ci.jenkins.io build status in a GitHub markdown page to many ci.jenkins.io builds with the following markdown (one example)

[![Core](https://ci.jenkins.io/job/Core/job/jenkins/job/master/badge/icon?subject=Core)](https://ci.jenkins.io/job/Core/job/jenkins/job/master/)

The job status is provided by ci.jenkins.io from the https://ci.jenkins.io/job/Core/job/jenkins/job/master/badge/icon?subject=Core text. The hyperlink destination is provided by my Markdown https://ci.jenkins.io/job/Core/job/jenkins/job/master/

The ci.jenkins.io examples in the embeddable build status pages show that pattern as well.

I'm not aware of any way in markdown to embed an image and have that image also return its hyperlink destination.

Jenkins Pipeline

I use the link parameter to Pipeline so that when badges are added to a build, they have a link. Here is an example Pipeline:

pipeline {
    agent any
    stages {
        stage('Hello') {
            steps {
                echo 'Hello World'
                addInfoBadge id: 'info-badge-id', link: 'https://www.jenkins.io', text: 'Info Badge'
            }
        }
    }
}

@MarkEWaite
Copy link
Contributor

Would it be clearer if the current "Query parameters" section of the documentation were split into two sections, one for badges inside Jenkins, and one for build status used outside of Jenkins?

The link argument to a badge definition works because it is processed inside Jenkins and the link value is converted into a clickable hyperlink inside Jenkins.

The link parameter in an HTML query string does not have any way of returning the link to the calling page.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants