jenkinsgroovyjenkins-apihudson-api

Check if file path exists in a different node jenkins?


Lets say I have 2 nodes:

I want to check if NodeB has a given directory through NodeA. Is there a way to do this through the Jenkins API?

Expected Results


Solution

  • You can probably do something like this.

    def isDirAvailable() {
      def isAvailble = false;
      node('NodeA') {
         if(fileExists("/Path/to/dir")){
            isAvailble = true;
          }
      }
      return isAvailble;
    }