SVN tagging a release in Jenkins Pipeline











up vote
1
down vote

favorite












I'm fairly new to Jenkins Pipeline groovy scripts but I have written a script which performs an SVN Checkout, NuGet Restore, etc and eventually copying an msi file to the server. After successfully packaging the .msi file I would like to tag the source in SVN but I'm struggling to find a method of doing this.



The svn check out is performed as follows:



def svn = checkout scm


I was sort of hoping I could just to the following:



svn = copy scm "svn://svn/MyPath/MyApp/tag/${versionNumber}" -m "V${versionNumber}"


I could obviously use the bat command and specify the full svn command but then I'd have to enter the Jenkins credentials into the groovy script which is not ideal.



Any help/pointers would be greatly appreciated.










share|improve this question


























    up vote
    1
    down vote

    favorite












    I'm fairly new to Jenkins Pipeline groovy scripts but I have written a script which performs an SVN Checkout, NuGet Restore, etc and eventually copying an msi file to the server. After successfully packaging the .msi file I would like to tag the source in SVN but I'm struggling to find a method of doing this.



    The svn check out is performed as follows:



    def svn = checkout scm


    I was sort of hoping I could just to the following:



    svn = copy scm "svn://svn/MyPath/MyApp/tag/${versionNumber}" -m "V${versionNumber}"


    I could obviously use the bat command and specify the full svn command but then I'd have to enter the Jenkins credentials into the groovy script which is not ideal.



    Any help/pointers would be greatly appreciated.










    share|improve this question
























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I'm fairly new to Jenkins Pipeline groovy scripts but I have written a script which performs an SVN Checkout, NuGet Restore, etc and eventually copying an msi file to the server. After successfully packaging the .msi file I would like to tag the source in SVN but I'm struggling to find a method of doing this.



      The svn check out is performed as follows:



      def svn = checkout scm


      I was sort of hoping I could just to the following:



      svn = copy scm "svn://svn/MyPath/MyApp/tag/${versionNumber}" -m "V${versionNumber}"


      I could obviously use the bat command and specify the full svn command but then I'd have to enter the Jenkins credentials into the groovy script which is not ideal.



      Any help/pointers would be greatly appreciated.










      share|improve this question













      I'm fairly new to Jenkins Pipeline groovy scripts but I have written a script which performs an SVN Checkout, NuGet Restore, etc and eventually copying an msi file to the server. After successfully packaging the .msi file I would like to tag the source in SVN but I'm struggling to find a method of doing this.



      The svn check out is performed as follows:



      def svn = checkout scm


      I was sort of hoping I could just to the following:



      svn = copy scm "svn://svn/MyPath/MyApp/tag/${versionNumber}" -m "V${versionNumber}"


      I could obviously use the bat command and specify the full svn command but then I'd have to enter the Jenkins credentials into the groovy script which is not ideal.



      Any help/pointers would be greatly appreciated.







      jenkins svn






      share|improve this question













      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 9 at 15:01









      Jason

      62




      62
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote













          If you are tied to Subversion you could extract bits of code from this post, but I would HIGHLY recommend, if you can, to migrate your code to Git as the tooling support in Git is so much better and where the world is already gone.



          In Git this is all I have to do tag a branch as part of my Jenkins multibranch pipeline:



          success {
          script {
          if( "${env.BRANCH_NAME}" == "develop" ) {
          bat "git tag ${JOB_NAME}_${BUILD_NUMBER}"
          bat "git push ${env.REPO} --tags"
          }
          }
          }


          ${env.REPO} is my clone URL.



          SO much easier.






          share|improve this answer





















          • Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
            – Jason
            Nov 14 at 9:22












          • Thanks Jason, appreciate if you could up vote if my answer has helped
            – Andrew Gray
            Nov 14 at 13:22










          • Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
            – Jason
            Nov 15 at 14:35










          • Thanks Jason. I'm sure it will all come out in the wash
            – Andrew Gray
            Nov 15 at 22:41











          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%2f53228202%2fsvn-tagging-a-release-in-jenkins-pipeline%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          1 Answer
          1






          active

          oldest

          votes








          1 Answer
          1






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes








          up vote
          0
          down vote













          If you are tied to Subversion you could extract bits of code from this post, but I would HIGHLY recommend, if you can, to migrate your code to Git as the tooling support in Git is so much better and where the world is already gone.



          In Git this is all I have to do tag a branch as part of my Jenkins multibranch pipeline:



          success {
          script {
          if( "${env.BRANCH_NAME}" == "develop" ) {
          bat "git tag ${JOB_NAME}_${BUILD_NUMBER}"
          bat "git push ${env.REPO} --tags"
          }
          }
          }


          ${env.REPO} is my clone URL.



          SO much easier.






          share|improve this answer





















          • Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
            – Jason
            Nov 14 at 9:22












          • Thanks Jason, appreciate if you could up vote if my answer has helped
            – Andrew Gray
            Nov 14 at 13:22










          • Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
            – Jason
            Nov 15 at 14:35










          • Thanks Jason. I'm sure it will all come out in the wash
            – Andrew Gray
            Nov 15 at 22:41















          up vote
          0
          down vote













          If you are tied to Subversion you could extract bits of code from this post, but I would HIGHLY recommend, if you can, to migrate your code to Git as the tooling support in Git is so much better and where the world is already gone.



          In Git this is all I have to do tag a branch as part of my Jenkins multibranch pipeline:



          success {
          script {
          if( "${env.BRANCH_NAME}" == "develop" ) {
          bat "git tag ${JOB_NAME}_${BUILD_NUMBER}"
          bat "git push ${env.REPO} --tags"
          }
          }
          }


          ${env.REPO} is my clone URL.



          SO much easier.






          share|improve this answer





















          • Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
            – Jason
            Nov 14 at 9:22












          • Thanks Jason, appreciate if you could up vote if my answer has helped
            – Andrew Gray
            Nov 14 at 13:22










          • Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
            – Jason
            Nov 15 at 14:35










          • Thanks Jason. I'm sure it will all come out in the wash
            – Andrew Gray
            Nov 15 at 22:41













          up vote
          0
          down vote










          up vote
          0
          down vote









          If you are tied to Subversion you could extract bits of code from this post, but I would HIGHLY recommend, if you can, to migrate your code to Git as the tooling support in Git is so much better and where the world is already gone.



          In Git this is all I have to do tag a branch as part of my Jenkins multibranch pipeline:



          success {
          script {
          if( "${env.BRANCH_NAME}" == "develop" ) {
          bat "git tag ${JOB_NAME}_${BUILD_NUMBER}"
          bat "git push ${env.REPO} --tags"
          }
          }
          }


          ${env.REPO} is my clone URL.



          SO much easier.






          share|improve this answer












          If you are tied to Subversion you could extract bits of code from this post, but I would HIGHLY recommend, if you can, to migrate your code to Git as the tooling support in Git is so much better and where the world is already gone.



          In Git this is all I have to do tag a branch as part of my Jenkins multibranch pipeline:



          success {
          script {
          if( "${env.BRANCH_NAME}" == "develop" ) {
          bat "git tag ${JOB_NAME}_${BUILD_NUMBER}"
          bat "git push ${env.REPO} --tags"
          }
          }
          }


          ${env.REPO} is my clone URL.



          SO much easier.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 13 at 4:48









          Andrew Gray

          2,11222139




          2,11222139












          • Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
            – Jason
            Nov 14 at 9:22












          • Thanks Jason, appreciate if you could up vote if my answer has helped
            – Andrew Gray
            Nov 14 at 13:22










          • Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
            – Jason
            Nov 15 at 14:35










          • Thanks Jason. I'm sure it will all come out in the wash
            – Andrew Gray
            Nov 15 at 22:41


















          • Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
            – Jason
            Nov 14 at 9:22












          • Thanks Jason, appreciate if you could up vote if my answer has helped
            – Andrew Gray
            Nov 14 at 13:22










          • Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
            – Jason
            Nov 15 at 14:35










          • Thanks Jason. I'm sure it will all come out in the wash
            – Andrew Gray
            Nov 15 at 22:41
















          Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
          – Jason
          Nov 14 at 9:22






          Thank you, I believe I can use the code from your link to do what I need. I am constantly requesting that we move to Git but it is yet to happen.
          – Jason
          Nov 14 at 9:22














          Thanks Jason, appreciate if you could up vote if my answer has helped
          – Andrew Gray
          Nov 14 at 13:22




          Thanks Jason, appreciate if you could up vote if my answer has helped
          – Andrew Gray
          Nov 14 at 13:22












          Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
          – Jason
          Nov 15 at 14:35




          Sorry, I tried this yesterday but as my reputation is less than 15 it says it's recorded but not publicly displayed. Hopefully when I hit 15 it will get shown automatically.
          – Jason
          Nov 15 at 14:35












          Thanks Jason. I'm sure it will all come out in the wash
          – Andrew Gray
          Nov 15 at 22:41




          Thanks Jason. I'm sure it will all come out in the wash
          – Andrew Gray
          Nov 15 at 22:41


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53228202%2fsvn-tagging-a-release-in-jenkins-pipeline%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

          How to pass form data using jquery Ajax to insert data in database?

          National Museum of Racing and Hall of Fame

          Guess what letter conforming each word