Pipeline: BUILD_URL for Blue Ocean

classic Classic list List threaded Threaded
7 messages Options
Reply | Threaded
Open this post in threaded view
|

Pipeline: BUILD_URL for Blue Ocean

Sverre Moe-2
We have the following content to mail notifications.
def content "Check console output at ${env.BUILD_URL} to view the results."

Where env.BUILD_URL has the following URL
https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/

Is there an environment variable to get Blue Ocean build URL?
https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/


A workaround would be to replace string values:
Multibranch Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Pipeline: BUILD_URL for Blue Ocean

Daniel Beck
Append /display/redirect to the URL.

> On 18. Apr 2018, at 13:29, Sverre Moe <[hidden email]> wrote:
>
> We have the following content to mail notifications.
> def content "Check console output at ${env.BUILD_URL} to view the results."
>
> Where env.BUILD_URL has the following URL
> https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/
>
> Is there an environment variable to get Blue Ocean build URL?
> https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/
>
>
> A workaround would be to replace string values:
> Multibranch Pipeline
> def buildURL = env.BUILD_URL
> def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
> newBuildURL = newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")
>
> Pipeline
> def buildURL = env.BUILD_URL
> def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")
>
>
> --
> You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
> To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/31D98588-C300-48A3-86C3-E164F83747FB%40beckweb.net.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Pipeline: BUILD_URL for Blue Ocean

Craig Rodrigues
In reply to this post by Sverre Moe-2
Try:

env.RUN_DISPLAY_URL



If you look at this plugin: https://plugins.jenkins.io/display-url-api

you will see there these variables you can try:

RUN_DISPLAY_URL – links to the run result
RUN_CHANGES_DISPLAY_URL – links to the changes page for a run
JOB_DISPLAY_URL – links to the jobs homepage

--
Craig


On Wed, Apr 18, 2018 at 4:29 AM, Sverre Moe <[hidden email]> wrote:
We have the following content to mail notifications.
def content "Check console output at ${env.BUILD_URL} to view the results."

Where env.BUILD_URL has the following URL

Is there an environment variable to get Blue Ocean build URL?


A workaround would be to replace string values:
Multibranch Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/CAG%3DrPVd-chpG%2BzgyOn0AG86-Ne%2B7_VcHvNnjpJBafQdKMxPMKA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Pipeline: BUILD_URL for Blue Ocean

Mark Gargan
Hi including ${RUN_DISPLAY_URL} only returns the classic job view url for me? 


Blue Ocean 1.3.5



emailext(
subject: "My Automation Test",
body: """<h3>Job has been flagged as ${currentBuild.result}!</h3>
<p>Click <a href="${BUILD_URL}Jenkins">here</a> for the Jenkins Classic Report</p>
<p>Click <a href="${RUN_DISPLAY_URL}Jenkins">here</a> for the Jenkins Blue Ocean</p>
""",
to: "${successfulRecipientListDefault}"
)

On Friday, 20 April 2018 23:33:37 UTC+1, Craig Rodrigues wrote:
Try:

env.RUN_DISPLAY_URL



If you look at this plugin: <a href="https://plugins.jenkins.io/display-url-api" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fplugins.jenkins.io%2Fdisplay-url-api\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFOCmxyzlyzQZDkb0Rxck_tvvsXtw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fplugins.jenkins.io%2Fdisplay-url-api\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFOCmxyzlyzQZDkb0Rxck_tvvsXtw&#39;;return true;">https://plugins.jenkins.io/display-url-api

you will see there these variables you can try:

RUN_DISPLAY_URL – links to the run result
RUN_CHANGES_DISPLAY_URL – links to the changes page for a run
JOB_DISPLAY_URL – links to the jobs homepage

--
Craig


On Wed, Apr 18, 2018 at 4:29 AM, Sverre Moe <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="lOcMPuf6AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">sverr...@...> wrote:
We have the following content to mail notifications.
def content "Check console output at ${env.BUILD_URL} to view the results."

Where env.BUILD_URL has the following URL
<a href="https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.company.com%3A8443%2Fjob%2FprojectA%2Fjob%2Fuser%25252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcnN6FOOyVrHdhPy-sQM5VrM6c-Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.company.com%3A8443%2Fjob%2FprojectA%2Fjob%2Fuser%25252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcnN6FOOyVrHdhPy-sQM5VrM6c-Q&#39;;return true;">https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/

Is there an environment variable to get Blue Ocean build URL?
<a href="https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.compay.com%3A8443%2Fblue%2Forganizations%2Fjenkins%2FprojectA%2Fdetail%2Fuser%252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGV1HTLtFnnCUf0t-AZJBboTN_eXw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.compay.com%3A8443%2Fblue%2Forganizations%2Fjenkins%2FprojectA%2Fdetail%2Fuser%252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGV1HTLtFnnCUf0t-AZJBboTN_eXw&#39;;return true;">https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/


A workaround would be to replace string values:
Multibranch Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

Pipeline
def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="lOcMPuf6AQAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;">https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Pipeline: BUILD_URL for Blue Ocean

Reinhold Füreder

Hi Mark,

 

I am using something like this in a groovy HTML template (for emailext):

def blueOceanDisplayUrlProvider = org.jenkinsci.plugins.displayurlapi.DisplayURLProvider.all().find { it.displayName == "Blue Ocean" }

String blueOceanPipelineUrl = blueOceanDisplayUrlProvider.getJobURL(project)

 

In case you are OK with globally changing default URL provider to Blue Ocean, then this might help you: https://issues.jenkins-ci.org/browse/JENKINS-41578

 

HTH Reinhold

 

 

From: [hidden email] <[hidden email]> On Behalf Of Mark Gargan
Sent: Mittwoch, 11. Juli 2018 19:12
To: Jenkins Users <[hidden email]>
Subject: Re: Pipeline: BUILD_URL for Blue Ocean

 

Hi including ${RUN_DISPLAY_URL} only returns the classic job view url for me? 

 

 

Blue Ocean 1.3.5

 

<a href="https://wiki.jenkins-ci.org/display/JENKINS/BlueOcean&#43;Display&#43;URL&#43;Plugin">Display URL for Blue Ocean 2.1.0

 

 

emailext(
     
subject: "My Automation Test",
     
body: """<h3>Job has been flagged as ${currentBuild.result}!</h3>
                    <p>Click <a href="
${BUILD_URL}Jenkins">here</a> for the Jenkins Classic Report</p>
      <p>Click <a href="
${RUN_DISPLAY_URL}Jenkins">here</a> for the Jenkins Blue Ocean</p>
                """
,
     
to: "${successfulRecipientListDefault}"
)


On Friday, 20 April 2018 23:33:37 UTC+1, Craig Rodrigues wrote:

Try:

env.RUN_DISPLAY_URL



If you look at this plugin: https://plugins.jenkins.io/display-url-api

you will see there these variables you can try:

RUN_DISPLAY_URL – links to the run result
RUN_CHANGES_DISPLAY_URL – links to the changes page for a run
JOB_DISPLAY_URL – links to the jobs homepage

--

Craig

 

On Wed, Apr 18, 2018 at 4:29 AM, Sverre Moe <<a href="javascript:" target="_blank">sverr...@...> wrote:

We have the following content to mail notifications.

def content "Check console output at ${env.BUILD_URL} to view the results."

 

Where env.BUILD_URL has the following URL

 

Is there an environment variable to get Blue Ocean build URL?

 

 

A workaround would be to replace string values:

Multibranch Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

 

Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank">jenkinsci-use...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/VI1P190MB00475616975017254CC8AE40F7590%40VI1P190MB0047.EURP190.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: Pipeline: BUILD_URL for Blue Ocean

Mark Gargan
Hi Reinhold,

                 Thanks for taking the time to get back to me! Much appreciated!

I popped  in env.project instead of just project and alas it throws a nullpointer. have i got the correct project variable?

java.lang.NullPointerException
	at io.jenkins.blueocean.rest.factory.organization.OrganizationFactory.getContainingOrg(OrganizationFactory.java:88)
	at org.jenkinsci.plugins.blueoceandisplayurl.BlueOceanDisplayURLImpl.getJobURL(BlueOceanDisplayURLImpl.java:91)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)

Thanks,
Mark.

On Thursday, 12 July 2018 07:56:02 UTC+1, Reinhold Füreder wrote:

Hi Mark,

 

I am using something like this in a groovy HTML template (for emailext):

def blueOceanDisplayUrlProvider = org.jenkinsci.plugins.displayurlapi.DisplayURLProvider.all().find { it.displayName == "Blue Ocean" }

String blueOceanPipelineUrl = blueOceanDisplayUrlProvider.getJobURL(project)

 

In case you are OK with globally changing default URL provider to Blue Ocean, then this might help you: <a href="https://issues.jenkins-ci.org/browse/JENKINS-41578" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fissues.jenkins-ci.org%2Fbrowse%2FJENKINS-41578\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE_Ec5EEewx27rLjJxUm7aqxMn-XA&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fissues.jenkins-ci.org%2Fbrowse%2FJENKINS-41578\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNE_Ec5EEewx27rLjJxUm7aqxMn-XA&#39;;return true;">https://issues.jenkins-ci.org/browse/JENKINS-41578

 

HTH Reinhold

 

 

From: <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LKSyNX9eAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="LKSyNX9eAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com> On Behalf Of Mark Gargan
Sent: Mittwoch, 11. Juli 2018 19:12
To: Jenkins Users <<a href="javascript:" target="_blank" gdf-obfuscated-mailto="LKSyNX9eAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkins...@googlegroups.com>
Subject: Re: Pipeline: BUILD_URL for Blue Ocean

 

Hi including ${RUN_DISPLAY_URL} only returns the classic job view url for me? 

 

<a href="https://jenkins.io/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHQL0iKEef1Q74B69v551M2WfqXIQ&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fjenkins.io%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNHQL0iKEef1Q74B69v551M2WfqXIQ&#39;;return true;">Jenkins ver. 2.60.3

 

Blue Ocean 1.3.5

 

<a href="https://wiki.jenkins-ci.org/display/JENKINS/BlueOcean+Display+URL+Plugin" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlueOcean%2BDisplay%2BURL%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEO5a-7UHbDWVXN8xcx8yDrFT9GHg&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fwiki.jenkins-ci.org%2Fdisplay%2FJENKINS%2FBlueOcean%2BDisplay%2BURL%2BPlugin\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNEO5a-7UHbDWVXN8xcx8yDrFT9GHg&#39;;return true;">Display URL for Blue Ocean 2.1.0

 

 

emailext(
     
subject: "My Automation Test",
     
body: """<h3>Job has been flagged as ${currentBuild.result}!</h3>
                    <p>Click <a href="
${BUILD_URL}Jenkins">here</a> for the Jenkins Classic Report</p>
      <p>Click <a href="
${RUN_DISPLAY_URL}Jenkins">here</a> for the Jenkins Blue Ocean</p>
                """
,
     
to: "${successfulRecipientListDefault}"
)


On Friday, 20 April 2018 23:33:37 UTC+1, Craig Rodrigues wrote:

Try:

env.RUN_DISPLAY_URL



If you look at this plugin: <a href="https://plugins.jenkins.io/display-url-api" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fplugins.jenkins.io%2Fdisplay-url-api\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFOCmxyzlyzQZDkb0Rxck_tvvsXtw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fplugins.jenkins.io%2Fdisplay-url-api\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNFOCmxyzlyzQZDkb0Rxck_tvvsXtw&#39;;return true;"> https://plugins.jenkins.io/display-url-api

you will see there these variables you can try:

RUN_DISPLAY_URL – links to the run result
RUN_CHANGES_DISPLAY_URL – links to the changes page for a run
JOB_DISPLAY_URL – links to the jobs homepage

--

Craig

 

On Wed, Apr 18, 2018 at 4:29 AM, Sverre Moe <[hidden email]> wrote:

We have the following content to mail notifications.

def content "Check console output at ${env.BUILD_URL} to view the results."

 

Where env.BUILD_URL has the following URL

<a href="https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.company.com%3A8443%2Fjob%2FprojectA%2Fjob%2Fuser%25252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcnN6FOOyVrHdhPy-sQM5VrM6c-Q&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.company.com%3A8443%2Fjob%2FprojectA%2Fjob%2Fuser%25252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGcnN6FOOyVrHdhPy-sQM5VrM6c-Q&#39;;return true;">https://build-ci.company.com:8443/job/projectA/job/user%252Fwork/115/

 

Is there an environment variable to get Blue Ocean build URL?

<a href="https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.compay.com%3A8443%2Fblue%2Forganizations%2Fjenkins%2FprojectA%2Fdetail%2Fuser%252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGV1HTLtFnnCUf0t-AZJBboTN_eXw&#39;;return true;" onclick="this.href=&#39;https://www.google.com/url?q\x3dhttps%3A%2F%2Fbuild-ci.compay.com%3A8443%2Fblue%2Forganizations%2Fjenkins%2FprojectA%2Fdetail%2Fuser%252Fwork%2F115%2F\x26sa\x3dD\x26sntz\x3d1\x26usg\x3dAFQjCNGV1HTLtFnnCUf0t-AZJBboTN_eXw&#39;;return true;">https://build-ci.compay.com:8443/blue/organizations/jenkins/projectA/detail/user%2Fwork/115/

 

 

A workaround would be to replace string values:

Multibranch Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

 

Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;"> https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank" gdf-obfuscated-mailto="LKSyNX9eAwAJ" rel="nofollow" onmousedown="this.href=&#39;javascript:&#39;;return true;" onclick="this.href=&#39;javascript:&#39;;return true;">jenkinsci-use...@googlegroups.com.
To view this discussion on the web visit <a href="https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com?utm_medium=email&amp;utm_source=footer" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com?utm_medium\x3demail\x26utm_source\x3dfooter&#39;;return true;"> https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com.
For more options, visit <a href="https://groups.google.com/d/optout" target="_blank" rel="nofollow" onmousedown="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;" onclick="this.href=&#39;https://groups.google.com/d/optout&#39;;return true;">https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5588d951-73bf-496a-973a-a67f48db87b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

RE: Pipeline: BUILD_URL for Blue Ocean

Reinhold Füreder

Hi Mark,

 

Your suspicion sounds good to me: the “project” variable you are using must be wrong?

 

The source code for your NPE: https://github.com/jenkinsci/blueocean-plugin/blob/15e7e594f79930465582df7894f22d333a6966c1/blueocean-rest/src/main/java/io/jenkins/blueocean/rest/factory/organization/OrganizationFactory.java#L88

 

Not sure if this helps you right away, but the binding of “project” variable in email-ext plugin is seemingly defined like this: https://github.com/jenkinsci/email-ext-plugin/blob/9012fcd1b9b2040f2d34c2723198a751eb81cce5/src/main/java/hudson/plugins/emailext/plugins/content/ScriptContent.java#L125

 

I have found this old personal comment when getting started with groovy templates and email-ext plugin:

 

HTH Reinhold

 

 

From: [hidden email] <[hidden email]> On Behalf Of Mark Gargan
Sent: Donnerstag, 12. Juli 2018 19:27
To: Jenkins Users <[hidden email]>
Subject: Re: Pipeline: BUILD_URL for Blue Ocean

 

Hi Reinhold,

 

                 Thanks for taking the time to get back to me! Much appreciated!

 

I popped  in env.project instead of just project and alas it throws a nullpointer. have i got the correct project variable?

 

java.lang.NullPointerException
        at io.jenkins.blueocean.rest.factory.organization.OrganizationFactory.getContainingOrg(OrganizationFactory.java:88)
        at org.jenkinsci.plugins.blueoceandisplayurl.BlueOceanDisplayURLImpl.getJobURL(BlueOceanDisplayURLImpl.java:91)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
 
Thanks,
Mark.


On Thursday, 12 July 2018 07:56:02 UTC+1, Reinhold Füreder wrote:

Hi Mark,

 

I am using something like this in a groovy HTML template (for emailext):

def blueOceanDisplayUrlProvider = org.jenkinsci.plugins.displayurlapi.DisplayURLProvider.all().find { it.displayName == "Blue Ocean" }

String blueOceanPipelineUrl = blueOceanDisplayUrlProvider.getJobURL(project)

 

In case you are OK with globally changing default URL provider to Blue Ocean, then this might help you: https://issues.jenkins-ci.org/browse/JENKINS-41578

 

HTH Reinhold

 

 

From: <a href="javascript:" target="_blank">jenkins...@... <<a href="javascript:" target="_blank">jenkins...@...> On Behalf Of Mark Gargan
Sent: Mittwoch, 11. Juli 2018 19:12
To: Jenkins Users <<a href="javascript:" target="_blank">jenkins...@...>
Subject: Re: Pipeline: BUILD_URL for Blue Ocean

 

Hi including ${RUN_DISPLAY_URL} only returns the classic job view url for me? 

 

 

Blue Ocean 1.3.5

 

<a href="https://wiki.jenkins-ci.org/display/JENKINS/BlueOcean&#43;Display&#43;URL&#43;Plugin" target="_blank">Display URL for Blue Ocean 2.1.0

 

 

emailext(
     
subject: "My Automation Test",
     
body: """<h3>Job has been flagged as ${currentBuild.result}!</h3>
                    <p>Click <a href="
${BUILD_URL}Jenkins">here</a> for the Jenkins Classic Report</p>
      <p>Click <a href="
${RUN_DISPLAY_URL}Jenkins">here</a> for the Jenkins Blue Ocean</p>
                """
,
     
to: "${successfulRecipientListDefault}"
)


On Friday, 20 April 2018 23:33:37 UTC+1, Craig Rodrigues wrote:

Try:

env.RUN_DISPLAY_URL



If you look at this plugin: https://plugins.jenkins.io/display-url-api

you will see there these variables you can try:

RUN_DISPLAY_URL – links to the run result
RUN_CHANGES_DISPLAY_URL – links to the changes page for a run
JOB_DISPLAY_URL – links to the jobs homepage

--

Craig

 

On Wed, Apr 18, 2018 at 4:29 AM, Sverre Moe <[hidden email]> wrote:

We have the following content to mail notifications.

def content "Check console output at ${env.BUILD_URL} to view the results."

 

Where env.BUILD_URL has the following URL

 

Is there an environment variable to get Blue Ocean build URL?

 

 

A workaround would be to replace string values:

Multibranch Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}")
newBuildURL
= newBuildURL.replace("job/${env.BRANCH_NAME}", "detail/${env.BRANCH_NAME}")

 

Pipeline

def buildURL = env.BUILD_URL
def newBuildURL = buildURL.replace("job/${env.JOB_NAME}", "blue/organizations/jenkins/${env.JOB_NAME}/detail/${env.JOB_NAME}")

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/c7b463cd-f118-486d-9dfd-e2fad833712e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

 

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to <a href="javascript:" target="_blank">jenkinsci-use...@....
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/bcf6f2fc-adcc-4ce9-a156-0698007a9ea3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/5588d951-73bf-496a-973a-a67f48db87b4%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Jenkins Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To view this discussion on the web visit https://groups.google.com/d/msgid/jenkinsci-users/VI1P190MB00477D9786B99F03BF81D9B8F75D0%40VI1P190MB0047.EURP190.PROD.OUTLOOK.COM.
For more options, visit https://groups.google.com/d/optout.