Then I think you shoul duse build 403.

________________________________

Kelly Hickel

Product Development Architect
BMC Software

phone: 952.345.8677
BMC 5 digit: 58677
fax: 952.345.8721
cell: 651-815-5531
1600 Tower, Suite 450
1600 Utica Av. So.
St. Louis Park, MN 55416

[BMC TrueSight]
[BMC Software]<http://www.bmc.com/>



From: [email protected] 
[mailto:[email protected]] On Behalf Of Robert Sandell
Sent: Wednesday, May 24, 2017 9:25 AM
To: Jenkins Users <[email protected]>
Subject: Re: Extended E-mail Notification (Email-ext) Default Pre-Send Script 
and Script Security...

Your script doesn't seem to need a classpath entry, and the classpath entry 
seems to be an empty string, or just white space?

/B

On Tuesday, May 23, 2017 at 10:14:57 PM UTC+2, Matt Childress wrote:
This is driving me nuts.   Jenkins has been running just fine until during one 
of the updates in the past month or so something went south.  We're now getting 
no e-mail and the following error in the Job logs:


Executing pre-send script

Pre-send script tried to access secured objects: classpath entry file:/ 
(7a4a36093f15af3f79ad37dbe1308c5da1d8bace) not yet approved for use

ERROR: Could not send email as a part of the post-build publishers.

org.jenkinsci.plugins.scriptsecurity.scripts.UnapprovedClasspathException: 
classpath entry file:/ (7a4a36093f15af3f79ad37dbe1308c5da1d8bace) not yet 
approved for use

I've gone into the Manage Jenkins->In Process Script Security and nothing is 
pending approval.

I've taken the "7aa3609" string (which I'm guessing is a hash) and tried 
putting it directly into the approvedClasspathEntries in scriptApproval.xml

There is no "groovy sandbox" checkbox near the script as mentioned in similar 
problems I've seen described on the 'net.

I've started to play with Permissive Script Security Plugin, but would like to 
avoid that (and the instructions didn't make a lot of sense yet on MacOS).

The script is below.  Is there an easy fix for this?!?

Thanks much!
M@





Pre-send script:


// Load up the first 1000 lines of the log file into a variable
def log = build.getLog(1000)

// Let's setup a boolean of the result of searching for the string that appears
// in the log file when a job successfully completes but no work occurred.

def NothingDone = (log ==~/.*Nothing downloaded, packaged or imported.*/)
assert NothingDone instanceof Boolean
logger.println("** NothingDone is " + NothingDone)

def Error = (log ==~/.*Error.*/)
assert Error instanceof Boolean
logger.println("** Error is " + Error)

def error = (log ==~/.*error.*/)
assert error instanceof Boolean
logger.println("** error is " + error)

// New items were imported into the munki repo
def NewItemsImported = (log ==~/.*new items were imported into Munki.*/)
assert NewItemsImported instanceof Boolean
logger.println("** NewItemsImported is " + NewItemsImported)

// New items were downloaded to the AutoPkg Cache directory
def NewItemsDownloaded = (log ==~/.*new items were downloaded.*/)
assert NewItemsDownloaded instanceof Boolean
logger.println("** NewItemsDownloaded is " + NewItemsDownloaded)

/* The below code is for AutoPkg FAQ #1:
 *
 * Every time I run a recipe it downloads something even if it didn't change. 
Why?
 *      
https://github.com/autopkg/autopkg/wiki/FAQ<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_autopkg_autopkg_wiki_FAQ&d=DwMFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=q0qg2fxg744VhUMF4dROjIQOSbbOR7VYtDObJu4sCp4&m=1osRDz3Dkw_PfD1aHGo9p5u0ZNnRS3wnBVH3nD5S99w&s=IVmlpnTnkJqXCU0Wim4NIUyRDT-MEPVYgUQxAU2Q82o&e=>
 *
 * the IS_TROUBLEMAKER is a per-job environmental variable set using the
 * Jenkins EnvInject Plugin -- 
https://wiki.jenkins-ci.org/display/JENKINS/EnvInject+Plugin<https://urldefense.proofpoint.com/v2/url?u=https-3A__wiki.jenkins-2Dci.org_display_JENKINS_EnvInject-2BPlugin&d=DwMFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=q0qg2fxg744VhUMF4dROjIQOSbbOR7VYtDObJu4sCp4&m=1osRDz3Dkw_PfD1aHGo9p5u0ZNnRS3wnBVH3nD5S99w&s=QQfmuScdE0ZwWJ0wgrsWAsjAOuhPG4UuJTnFNfWbh-Y&e=>
 *
 * below is the elvis/ternary operator that does the following:
 * if IS_TROUBLEMAKER is set from the Jenkins job configuration, take that value
 * (it should be true).  If it's not set/doesn't exist, set it to false
 * because we have a lot of existing jobs and only set the IS_TROUBLEMAKER on 
jobs that
 * ARE troublemakers!
 */


try {

   // if IS_TROUBLMAKER is set by EnvInject plugin, set known_troublemaker to 
that value
   // (as it could've been a troublemaker in the past, and set to false when it 
was
   // fixed

   known_troublemaker = $IS_TROUBLEMAKER

} catch (MissingPropertyExceptionmpe) {

   // if we get an error, then it's because $IS_TROUBLEMAKER doesn't exist, so 
we
   // should set it to false

   known_troublemaker = false
   logger.println("** IS_TROUBLEMAKER try failed, caught 
MissingPropertyExceptionmpe and set known_troublemaker to " + 
known_troublemaker)

}


logger.println("** known_troublemaker is " + known_troublemaker)

/* And now let's test against that boolean and kill the e-mail (cancelEmail = 
true) if it found the
 * -Nothing downloaded, packaged or imported- string  AND it hasn't found a 
string with Error or error
 */

if (NothingDone && !Error && !error) {

       // AutoPkg neither downloaded to the AutoPkg Cache nor imported anything 
to the munki repo,
       // so no e-mail this is the case 99% of the time
       logger.println("=== e-mail cancelled: Job completed without errors but 
nothing was done (nothing downloaded or imported)")
       cancel=true

} else if (NewItemsImported) {

       // New items were imported into the Munki Repo, send the email.
       logger.println("=*=*=*=*=*=*=*=*=*=*=*=* New Item in Munki Repo, E-mail 
Sent !!!! =*=*=*=*=*=*=*=*=*=*=*=*")
       cancel=false

} else if (NewItemsDownloaded && known_troublemaker) {

       // logger.println("** AutoPkg downloaded, but not imported to Munki as " 
+ $JOB_NAME + " is a known troublemaker.")
       logger.println("=== e-mail cancelled: KNOWN TROUBLEMAKER: AutoPkg 
downloaded sucessufully (but no import as this version was already in the munki 
repo")
       logger.println("=== See AutoPkg FAQ, item #1 at 
https://github.com/autopkg/autopkg/wiki/FAQ<https://urldefense.proofpoint.com/v2/url?u=https-3A__github.com_autopkg_autopkg_wiki_FAQ&d=DwMFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=q0qg2fxg744VhUMF4dROjIQOSbbOR7VYtDObJu4sCp4&m=1osRDz3Dkw_PfD1aHGo9p5u0ZNnRS3wnBVH3nD5S99w&s=IVmlpnTnkJqXCU0Wim4NIUyRDT-MEPVYgUQxAU2Q82o&e=>")
       cancel=true

} else {
    // Send the email, something's run amok
    cancel=false
       logger.println('@#$%&!@#$%&!@#$%&!@#$%&!      Ruh Roh!  Something went 
wrong -- E-mail Sent !!!!! @#$%&!@#$%&!@#$%&!@#$%&!')
}

// logger.println("** End of Presend Script and it is " + IS_TROUBLEMAKER + " 
that " + JOB_NAME + " is a known troublemaker.")
// logger.println("** cancel = " + cancel)
// logger.println("** \n\nlogfile begin ..........\n" + log + 
"\n\n..........\nlog file end")
--
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 
[email protected]<mailto:[email protected]>.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/2478b64a-d976-41c8-b0d4-419e4c1d00ee%40googlegroups.com<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_msgid_jenkinsci-2Dusers_2478b64a-2Dd976-2D41c8-2Db0d4-2D419e4c1d00ee-2540googlegroups.com-3Futm-5Fmedium-3Demail-26utm-5Fsource-3Dfooter&d=DwMFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=q0qg2fxg744VhUMF4dROjIQOSbbOR7VYtDObJu4sCp4&m=1osRDz3Dkw_PfD1aHGo9p5u0ZNnRS3wnBVH3nD5S99w&s=0_AWfwNKmmBqV-1XakJBqi2JNmisd2LX62keLMYfEW8&e=>.
For more options, visit 
https://groups.google.com/d/optout<https://urldefense.proofpoint.com/v2/url?u=https-3A__groups.google.com_d_optout&d=DwMFaQ&c=UrUhmHsiTVT5qkaA4d_oSzcamb9hmamiCDMzBAEwC7E&r=q0qg2fxg744VhUMF4dROjIQOSbbOR7VYtDObJu4sCp4&m=1osRDz3Dkw_PfD1aHGo9p5u0ZNnRS3wnBVH3nD5S99w&s=1AYhFUxP_qGzEgNempQdQD3YyJjsdnJBFhv42D9gkS0&e=>.

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6a3ef771a9c2478fb6bb49e30c5c85ec%40hou-exmbprd-01.adprod.bmc.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to