Jenkins email send remote server cucumber report











up vote
6
down vote

favorite
1












I have a requirement let me explain scenario,




  • Their is COMPUTER-A (Jenkins Server) through which we triggered pipeline build

  • First Step it will create VM (COMPUTER-B) in vlab machine and get the IP


  • Second Step it will execute testsuites.sh in COMPUTER-B through ssh below is pseudo-code



    steps {
    script {
    sh """
    ssh -i id_rsa -o StrictHostKeyChecking=no ${USER}@${env.IP} "nohup /home/testsuites.sh > foo.out 2> foo.err < /dev/null & "
    """
    }
    }


    this script is run in background "mvn clean test" which will run all test case and generate cucumber report at the end of build.



    till this working fine.



    Since its run in background jenkins job will not going to wait & will move to next stage



  • Third Step Jenkins Server COMPUTER-A will send success mail



Now the requirement is once the build is success i need to send the cucumber test report through another mail. How to notify the jenkins job in COMPUTER-A (Since its already completed) to sent mail with cucumber report file which is their in remote server COMPUTER-B.



i can run corn job to check for build success , but how to notify the jenkins to send email with the cucumber test report.










share|improve this question




























    up vote
    6
    down vote

    favorite
    1












    I have a requirement let me explain scenario,




    • Their is COMPUTER-A (Jenkins Server) through which we triggered pipeline build

    • First Step it will create VM (COMPUTER-B) in vlab machine and get the IP


    • Second Step it will execute testsuites.sh in COMPUTER-B through ssh below is pseudo-code



      steps {
      script {
      sh """
      ssh -i id_rsa -o StrictHostKeyChecking=no ${USER}@${env.IP} "nohup /home/testsuites.sh > foo.out 2> foo.err < /dev/null & "
      """
      }
      }


      this script is run in background "mvn clean test" which will run all test case and generate cucumber report at the end of build.



      till this working fine.



      Since its run in background jenkins job will not going to wait & will move to next stage



    • Third Step Jenkins Server COMPUTER-A will send success mail



    Now the requirement is once the build is success i need to send the cucumber test report through another mail. How to notify the jenkins job in COMPUTER-A (Since its already completed) to sent mail with cucumber report file which is their in remote server COMPUTER-B.



    i can run corn job to check for build success , but how to notify the jenkins to send email with the cucumber test report.










    share|improve this question


























      up vote
      6
      down vote

      favorite
      1









      up vote
      6
      down vote

      favorite
      1






      1





      I have a requirement let me explain scenario,




      • Their is COMPUTER-A (Jenkins Server) through which we triggered pipeline build

      • First Step it will create VM (COMPUTER-B) in vlab machine and get the IP


      • Second Step it will execute testsuites.sh in COMPUTER-B through ssh below is pseudo-code



        steps {
        script {
        sh """
        ssh -i id_rsa -o StrictHostKeyChecking=no ${USER}@${env.IP} "nohup /home/testsuites.sh > foo.out 2> foo.err < /dev/null & "
        """
        }
        }


        this script is run in background "mvn clean test" which will run all test case and generate cucumber report at the end of build.



        till this working fine.



        Since its run in background jenkins job will not going to wait & will move to next stage



      • Third Step Jenkins Server COMPUTER-A will send success mail



      Now the requirement is once the build is success i need to send the cucumber test report through another mail. How to notify the jenkins job in COMPUTER-A (Since its already completed) to sent mail with cucumber report file which is their in remote server COMPUTER-B.



      i can run corn job to check for build success , but how to notify the jenkins to send email with the cucumber test report.










      share|improve this question















      I have a requirement let me explain scenario,




      • Their is COMPUTER-A (Jenkins Server) through which we triggered pipeline build

      • First Step it will create VM (COMPUTER-B) in vlab machine and get the IP


      • Second Step it will execute testsuites.sh in COMPUTER-B through ssh below is pseudo-code



        steps {
        script {
        sh """
        ssh -i id_rsa -o StrictHostKeyChecking=no ${USER}@${env.IP} "nohup /home/testsuites.sh > foo.out 2> foo.err < /dev/null & "
        """
        }
        }


        this script is run in background "mvn clean test" which will run all test case and generate cucumber report at the end of build.



        till this working fine.



        Since its run in background jenkins job will not going to wait & will move to next stage



      • Third Step Jenkins Server COMPUTER-A will send success mail



      Now the requirement is once the build is success i need to send the cucumber test report through another mail. How to notify the jenkins job in COMPUTER-A (Since its already completed) to sent mail with cucumber report file which is their in remote server COMPUTER-B.



      i can run corn job to check for build success , but how to notify the jenkins to send email with the cucumber test report.







      jenkins cucumber jenkins-plugins jenkins-pipeline






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 9 at 13:05









      Navarasu

      1,7881721




      1,7881721










      asked Nov 9 at 7:39









      user1184777

      36211131




      36211131
























          2 Answers
          2






          active

          oldest

          votes

















          up vote
          0
          down vote













          What you need is Quiet Period



          node {
          build job: 'FetchCucumberReport',
          quietPeriod: 60,// in secs -->1min
          wait: false
          }


          So what the above code does is it will trigger FetchCucumberReport Job after a 1 minute. If you roughly know how long the test cases will take to complete all tasks ( lets say 4 hours) then set quietPeriod:14400(seconds) and it will trigger the build after 4 hours.



          UPDATED

          You will have to look into API calls https://wiki.jenkins.io/display/JENKINS/Remote+access+API



          An e.g



          curl -X POST -u user:password http://localhost:8080/job/FetchCucumberReport/build


          Hope it helps :)






          share|improve this answer























          • i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
            – user1184777
            Nov 12 at 6:57










          • If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
            – rohit thomas
            Nov 12 at 7:14












          • Did it help ? or are you still facing issues ?
            – rohit thomas
            Nov 14 at 2:33










          • If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
            – rohit thomas
            Nov 16 at 4:47


















          up vote
          0
          down vote













          You could trigger a build as soon as your long running job is finished, which just emails the results:



          curl -X POST http://user:password@<jenkins-url>:8080/job/test/build


          If the job can run on the same machine it should be easy to gather the results, if not, you could just copy the artifacts via scp.



          But I think that another approach might be better suited for your problem. Just let the job run as long as it takes, then you can send the email afterwards much easier. If you would like to trigger another job before, you could trigger another job which runs on the same machine.



          Maybe creating a temporary jenkins slave might be the best idea. You can also do this via the REST API:
          Creating-node-with-the-REST-API






          share|improve this answer























            Your Answer






            StackExchange.ifUsing("editor", function () {
            StackExchange.using("externalEditor", function () {
            StackExchange.using("snippets", function () {
            StackExchange.snippets.init();
            });
            });
            }, "code-snippets");

            StackExchange.ready(function() {
            var channelOptions = {
            tags: "".split(" "),
            id: "1"
            };
            initTagRenderer("".split(" "), "".split(" "), channelOptions);

            StackExchange.using("externalEditor", function() {
            // Have to fire editor after snippets, if snippets enabled
            if (StackExchange.settings.snippets.snippetsEnabled) {
            StackExchange.using("snippets", function() {
            createEditor();
            });
            }
            else {
            createEditor();
            }
            });

            function createEditor() {
            StackExchange.prepareEditor({
            heartbeatType: 'answer',
            convertImagesToLinks: true,
            noModals: true,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: 10,
            bindNavPrevention: true,
            postfix: "",
            imageUploader: {
            brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
            contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
            allowUrls: true
            },
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            });


            }
            });














             

            draft saved


            draft discarded


















            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221560%2fjenkins-email-send-remote-server-cucumber-report%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown

























            2 Answers
            2






            active

            oldest

            votes








            2 Answers
            2






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            0
            down vote













            What you need is Quiet Period



            node {
            build job: 'FetchCucumberReport',
            quietPeriod: 60,// in secs -->1min
            wait: false
            }


            So what the above code does is it will trigger FetchCucumberReport Job after a 1 minute. If you roughly know how long the test cases will take to complete all tasks ( lets say 4 hours) then set quietPeriod:14400(seconds) and it will trigger the build after 4 hours.



            UPDATED

            You will have to look into API calls https://wiki.jenkins.io/display/JENKINS/Remote+access+API



            An e.g



            curl -X POST -u user:password http://localhost:8080/job/FetchCucumberReport/build


            Hope it helps :)






            share|improve this answer























            • i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
              – user1184777
              Nov 12 at 6:57










            • If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
              – rohit thomas
              Nov 12 at 7:14












            • Did it help ? or are you still facing issues ?
              – rohit thomas
              Nov 14 at 2:33










            • If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
              – rohit thomas
              Nov 16 at 4:47















            up vote
            0
            down vote













            What you need is Quiet Period



            node {
            build job: 'FetchCucumberReport',
            quietPeriod: 60,// in secs -->1min
            wait: false
            }


            So what the above code does is it will trigger FetchCucumberReport Job after a 1 minute. If you roughly know how long the test cases will take to complete all tasks ( lets say 4 hours) then set quietPeriod:14400(seconds) and it will trigger the build after 4 hours.



            UPDATED

            You will have to look into API calls https://wiki.jenkins.io/display/JENKINS/Remote+access+API



            An e.g



            curl -X POST -u user:password http://localhost:8080/job/FetchCucumberReport/build


            Hope it helps :)






            share|improve this answer























            • i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
              – user1184777
              Nov 12 at 6:57










            • If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
              – rohit thomas
              Nov 12 at 7:14












            • Did it help ? or are you still facing issues ?
              – rohit thomas
              Nov 14 at 2:33










            • If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
              – rohit thomas
              Nov 16 at 4:47













            up vote
            0
            down vote










            up vote
            0
            down vote









            What you need is Quiet Period



            node {
            build job: 'FetchCucumberReport',
            quietPeriod: 60,// in secs -->1min
            wait: false
            }


            So what the above code does is it will trigger FetchCucumberReport Job after a 1 minute. If you roughly know how long the test cases will take to complete all tasks ( lets say 4 hours) then set quietPeriod:14400(seconds) and it will trigger the build after 4 hours.



            UPDATED

            You will have to look into API calls https://wiki.jenkins.io/display/JENKINS/Remote+access+API



            An e.g



            curl -X POST -u user:password http://localhost:8080/job/FetchCucumberReport/build


            Hope it helps :)






            share|improve this answer














            What you need is Quiet Period



            node {
            build job: 'FetchCucumberReport',
            quietPeriod: 60,// in secs -->1min
            wait: false
            }


            So what the above code does is it will trigger FetchCucumberReport Job after a 1 minute. If you roughly know how long the test cases will take to complete all tasks ( lets say 4 hours) then set quietPeriod:14400(seconds) and it will trigger the build after 4 hours.



            UPDATED

            You will have to look into API calls https://wiki.jenkins.io/display/JENKINS/Remote+access+API



            An e.g



            curl -X POST -u user:password http://localhost:8080/job/FetchCucumberReport/build


            Hope it helps :)







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Nov 12 at 7:17

























            answered Nov 12 at 3:20









            rohit thomas

            1,412418




            1,412418












            • i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
              – user1184777
              Nov 12 at 6:57










            • If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
              – rohit thomas
              Nov 12 at 7:14












            • Did it help ? or are you still facing issues ?
              – rohit thomas
              Nov 14 at 2:33










            • If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
              – rohit thomas
              Nov 16 at 4:47


















            • i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
              – user1184777
              Nov 12 at 6:57










            • If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
              – rohit thomas
              Nov 12 at 7:14












            • Did it help ? or are you still facing issues ?
              – rohit thomas
              Nov 14 at 2:33










            • If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
              – rohit thomas
              Nov 16 at 4:47
















            i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
            – user1184777
            Nov 12 at 6:57




            i cannot decide approximate time because if test cases increases it will increase time also. and the cucumber reports will be in COMPUTER-B remote server, from Jenkins Server COMPUTER-A i need to send mail along with that reports how to access that cucumber report file which is their in remote server
            – user1184777
            Nov 12 at 6:57












            If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
            – rohit thomas
            Nov 12 at 7:14






            If that's the case, you will have to look into REST API calls to Jenkins to Build the Project let's call it 'SendCucumberReport'.. Basically once the test cases are done you can do a Curl to Jenkins and trigger the job(which will fetch the report from Computer B using curl/ssh/scp up to you) or You can send the report then trigger the Job either way it's how you wan to design it.
            – rohit thomas
            Nov 12 at 7:14














            Did it help ? or are you still facing issues ?
            – rohit thomas
            Nov 14 at 2:33




            Did it help ? or are you still facing issues ?
            – rohit thomas
            Nov 14 at 2:33












            If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
            – rohit thomas
            Nov 16 at 4:47




            If the issue is resolved...Please select the correct answer so that others who face similar issues will benefit..If not, please add the issues you are still facing.
            – rohit thomas
            Nov 16 at 4:47












            up vote
            0
            down vote













            You could trigger a build as soon as your long running job is finished, which just emails the results:



            curl -X POST http://user:password@<jenkins-url>:8080/job/test/build


            If the job can run on the same machine it should be easy to gather the results, if not, you could just copy the artifacts via scp.



            But I think that another approach might be better suited for your problem. Just let the job run as long as it takes, then you can send the email afterwards much easier. If you would like to trigger another job before, you could trigger another job which runs on the same machine.



            Maybe creating a temporary jenkins slave might be the best idea. You can also do this via the REST API:
            Creating-node-with-the-REST-API






            share|improve this answer



























              up vote
              0
              down vote













              You could trigger a build as soon as your long running job is finished, which just emails the results:



              curl -X POST http://user:password@<jenkins-url>:8080/job/test/build


              If the job can run on the same machine it should be easy to gather the results, if not, you could just copy the artifacts via scp.



              But I think that another approach might be better suited for your problem. Just let the job run as long as it takes, then you can send the email afterwards much easier. If you would like to trigger another job before, you could trigger another job which runs on the same machine.



              Maybe creating a temporary jenkins slave might be the best idea. You can also do this via the REST API:
              Creating-node-with-the-REST-API






              share|improve this answer

























                up vote
                0
                down vote










                up vote
                0
                down vote









                You could trigger a build as soon as your long running job is finished, which just emails the results:



                curl -X POST http://user:password@<jenkins-url>:8080/job/test/build


                If the job can run on the same machine it should be easy to gather the results, if not, you could just copy the artifacts via scp.



                But I think that another approach might be better suited for your problem. Just let the job run as long as it takes, then you can send the email afterwards much easier. If you would like to trigger another job before, you could trigger another job which runs on the same machine.



                Maybe creating a temporary jenkins slave might be the best idea. You can also do this via the REST API:
                Creating-node-with-the-REST-API






                share|improve this answer














                You could trigger a build as soon as your long running job is finished, which just emails the results:



                curl -X POST http://user:password@<jenkins-url>:8080/job/test/build


                If the job can run on the same machine it should be easy to gather the results, if not, you could just copy the artifacts via scp.



                But I think that another approach might be better suited for your problem. Just let the job run as long as it takes, then you can send the email afterwards much easier. If you would like to trigger another job before, you could trigger another job which runs on the same machine.



                Maybe creating a temporary jenkins slave might be the best idea. You can also do this via the REST API:
                Creating-node-with-the-REST-API







                share|improve this answer














                share|improve this answer



                share|improve this answer








                edited Nov 18 at 9:04

























                answered Nov 18 at 8:59









                S.Spieker

                3,92152742




                3,92152742






























                     

                    draft saved


                    draft discarded



















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function () {
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53221560%2fjenkins-email-send-remote-server-cucumber-report%23new-answer', 'question_page');
                    }
                    );

                    Post as a guest















                    Required, but never shown





















































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown

































                    Required, but never shown














                    Required, but never shown












                    Required, but never shown







                    Required, but never shown







                    Popular posts from this blog

                    Schultheiß

                    Liste der Kulturdenkmale in Wilsdruff

                    Android Play Services Check