Hi Guys,

I need Some help loading external functions in Jenkinsfile.

Jenkinsfile contents below:


git "https://github.com/afahd/MW.git";
echo "this is groovy"


Externally loaded function:

@Grab(group='org.yaml', module='snakeyaml', version='1.17')
import org.yaml.snakeyaml.*
public class Dependency {
   public LinkedHashMap h1;
   Dependency(LinkedHashMap h1) {
       this.h1 = h1
def clone()
  Yaml yaml = new Yaml();
  String project;
  String location;
  String branch;
  String build;
  InputStream input = new FileInputStream(new File("dependencies.yaml"));
  Dependency data = yaml.load(input);
  Set s1 = data.h1.keySet();
  for (int num=0;num<s1.size();num++)
      project = s1.toArray()[num];
      location = data.h1.get(project)['location'];
      branch = data.h1.get(project)['branch'];
      build = data.h1.get(project)['build'];
      echo "Cloning dependencies for $project "
      git branch: branch, url: location
return this;

When i call clone.clone() the function gets executed on the *master node 
not the 'local-node'. *

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 
For more options, visit https://groups.google.com/d/optout.

Reply via email to