Re: Issue with the Jenkins Plugin emailext Plugin.

2023-02-14 Thread Alex Earl
Does failure.html exist in the root of the workspace?

On Fri, Feb 3, 2023, 03:35 Chetan  wrote:

> Hi Jenkins Experts
>
> I get the below error message sometime only when i use the html file as
> email.
>
> Jenkins Code:
>
>  emailext (
> mimeType: 'text/html',
> subject: 'Compilation Varification Failed for Gerrit',
> attachLog: true,
> attachmentsPattern: 'Errors/*.log,BTLD/Errors/*.log',
> body: '${FILE, path="failure.html"}',
> from: 'tbui...@harman.com',
> to :
> '$GERRIT_CHANGE_OWNER_EMAIL,$GERRIT_PATCHSET_UPLOADER_EMAIL'
> )
>
> *Error: *
> *[Error replacing 'FILE' - Error processing tokens]*
>
>
>
>
>
>
>
>
> Thanks & Best Regars
>
> *Chetan B*
>
> --
> 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-users+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/jenkinsci-users/CA%2B6q8-5vQ7Z430Mi6pqCUL8pP7n%3DR04MFUTCGifBMPyTQcLtEw%40mail.gmail.com
> 
> .
>

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/CAPiUgVfoxQ%3D47qUiyVMv0gdyHCRPaZdh_nOkfpNCZ6RN%3Dqh-5Q%40mail.gmail.com.


sh: sh: command not found

2023-02-14 Thread Andrei Suslov
*I'm trying to run this pipeline script:*
def getAgentMachine() {
  def agentMachine
  switch(params.agentMachine) {
  case "cloud1": agentMachine = "cloud1"; break
  case "mac1": agentMachine = "mac1"; break
  }
  return agentMachine
}

def getOs(){
  if (agentMachine.contains("mac")) {
return "macosx"
  } else {
return "windows"
  }
}

def printWorkingDirectory(){
String os = getOs();
if (os == 'windows'){
bat 'chdir'
} else {
sh 'pwd'
}
}

def listFiles(){
String os = getOs();
if (os == 'windows'){
bat 'dir'
} else {
sh 'ls -l'
}
}

def cmd_exec(command) {
return bat(returnStdout: true, script: "${command}").trim()
}

def getProjectName() {
return params.projectName
}

pipeline {
  agent {
// label params.agentMachine == "any" ? "" : params.agentMachine 
label "mac1" 
  }
  parameters {
string(
  name: "agentMachine",
  defaultValue: "mac1",
  description: "Select the agent machine to run the project on"
)
string(
  name: "projectName",
  defaultValue: "Auto_MC",
  description: "Provide the project to copy"
)
  }
  stages {
stage("Start services") {
  steps {
sh('pwsh -version')
echo "Agent machine is [${getAgentMachine()}]"
echo "OS is [${getOs()}]"
echo "1. Project name is [${getProjectName()}]"
script {
  projectNameToCopy = getProjectName().trim()
}
powershell """
write-host (Get-Item .).FullName -fore green
write-host "2. Project name: " ${projectNameToCopy} -fore green
"""
  }
}
  }
}

*The output is:*

Started by user Andrei Suslov
[Pipeline] Start of Pipeline
[Pipeline] node
Running on a51-wg7-mac1 in /Library/Automation/slave/jenkins/workspace/123
[Pipeline] {
[Pipeline] stage
[Pipeline] { (Start services)
[Pipeline] sh
sh: sh: command not found
wrapper script does not seem to be touching the log file in 
/Library/Automation/slave/jenkins/workspace/123@tmp/durable-b0720b96
(JENKINS-48300: if on an extremely laggy filesystem, consider 
-Dorg.jenkinsci.plugins.durabletask.BourneShellScript.HEARTBEAT_CHECK_INTERVAL=86400)
[Pipeline] }
[Pipeline] // stage
[Pipeline] }
[Pipeline] // node
[Pipeline] End of Pipeline
ERROR: script returned exit code -1
Finished: FAILURE

I tried to look for a solution: people suggest to delete PATH variable 
(it's not there already, so I guess someone else deleted it) and introduce 
PATH+EXTRA variable, but I don't know what value to assign to it...

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/ef343a38-01e3-465c-8e74-04026c5c4d22n%40googlegroups.com.


Re: LDAP security realm / groovy init script issue

2023-02-14 Thread geoffroy...@gmail.com
Thanks for your help

sure we are also considering CasC, but so far Post Init groovy scripts 

 
have proven to be a viable solution (but now outdated) to perform some 
configuration as code.

My concern here is this is the first time i am facing such issue, where a 
Java class method cannot be called from init groovy script.
Script is directly manipulating Jenkins java code, not API. So i would 
expect that the well-defined and simple (setter) java method 
setDisableRolePrefixing 

 can 
be called from it...

Regards

-- 
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-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/jenkinsci-users/6c59421f-a686-40a8-a15e-6089f5d7943cn%40googlegroups.com.