How can I find out how the assembly was created in Jenkins

I am trying to update Jelly scripts in my Jenkins setup to email the reason for the build (build trigger), but I cannot find any documentation on this.

I know that it should be accessible, since information will be displayed on the assembly page, but I want it to be displayed on the distributed email.

Does anyone know if there is a var request that I can request, or a Jenkins API call that I can call to get this?

+6
source share
2 answers

You can do this by typing the API .

More conveniently, in the env var installed before the build, you will find BUILD_URL:

BUILD_URL=https://jenkins-server.tld/job/JOBNAME/BUILD_NUMBER 

So you just need to add / api / json. You can also get it in xml:

 <freeStyleBuild> <action> <cause> <shortDescription>Started by user kenji</shortDescription> <userName>kenji</userName> </cause> </action> <action/> <action/> <action> <failCount>0</failCount> <skipCount>0</skipCount> <totalCount>1</totalCount> <urlName>testReport</urlName> </action> <building>false</building> <duration>9772</duration> <fullDisplayName>JOBNAME #4</fullDisplayName> <id>2011-08-10_11-19-42</id> <keepLog>false</keepLog> <number>4</number> <result>SUCCESS</result> <timestamp>1312967982296</timestamp> <url>https://jenkins-server.tld/job/JOBNAME/4/</url> <builtOn>macboo</builtOn> <changeSet> <kind>svn</kind> <revision> <module>https://svn-server.tld/JOBNAME/trunk</module> <revision>7</revision> </revision> </changeSet> </freeStyleBuild> 
+8
source

I find out by clicking on the assembly link, for example, link # 42

Then you will see a yellow diamond and next to it.

  • Fred Jones user (Fred Jones manually clicked on the assembly)

OR

  • Indexing branches (triggered by pressing git)
-1
source

Source: https://habr.com/ru/post/894703/


All Articles