Jenkins Artifatory pipeline : How to promote a Debian package from a testing distribution to stable in the...











up vote
1
down vote

favorite












I have a Jenkins pipeline to build a .deb package. It successfully uploads the package to an Artifactory repository. The package itself is in the 'pool', and the metadata are created for the 'main' component and the 'testing' distribution. My preprod environment installs the package via APT.



What I would like to do now is to promote the build to the 'stable' distribution in the same repository (we have only one corporate Artifactory instance with lots of repositories, so I can't have several).



My pipeline looks like this:



#!/usr/bin/env groovy
node('XXX') {

def artifactoryServer
def artifactoryBuildInfo

stage('Artifactory configuration') {
artifactoryServer = Artifactory.newServer url: "http://mycorporateartifactoryrepo.com", credentialsId: 'XXXXX'
}

stage('checkout') {
checkout scm
}

stage('packaging & deploying') {
artifactoryBuildInfo = Artifactory.newBuildInfo()
// Packaging & deploying mvn
archiveArtifacts artifacts: "target/cowsay.deb", fingeprint: true

// packaging & deploying deb package
def uploadSpec = """{
"files": [
{
"pattern": "target/cowsay.deb",
"target": "debian-repo/pool/",
"props": "deb.distribution=testing;deb.component=main;deb.architecture=all"
}
]
}"""
artifactoryBuildInfo = artifactoryServer.upload spec: uploadSpec
artifactoryServer.publishBuildInfo artifactoryBuildInfo
}

stage('promotion') {
def promotionConfig = [
'buildName' : artifactoryBuildInfo.name,
'buildNumber' : artifactoryBuildInfo.number,
'sourceRepo' : 'debian-repo/pool/',
'targetRepo' : 'debian-repo/pool/',
'comment' : 'Promoting build',
'status' : 'Released',
'includeDependencies': true,
'copy' : true,
'failFast' : true
]

// Promote build interactively if tests are OK
Artifactory.addInteractivePromotion server: artifactoryServer, promotionConfig: promotionConfig, displayName: 'Promote me!'
}
}


How can I manage this? Artifactory does not document such a possibility. Do I need to create a custom pipeline to achieve this?



Thanks










share|improve this question




























    up vote
    1
    down vote

    favorite












    I have a Jenkins pipeline to build a .deb package. It successfully uploads the package to an Artifactory repository. The package itself is in the 'pool', and the metadata are created for the 'main' component and the 'testing' distribution. My preprod environment installs the package via APT.



    What I would like to do now is to promote the build to the 'stable' distribution in the same repository (we have only one corporate Artifactory instance with lots of repositories, so I can't have several).



    My pipeline looks like this:



    #!/usr/bin/env groovy
    node('XXX') {

    def artifactoryServer
    def artifactoryBuildInfo

    stage('Artifactory configuration') {
    artifactoryServer = Artifactory.newServer url: "http://mycorporateartifactoryrepo.com", credentialsId: 'XXXXX'
    }

    stage('checkout') {
    checkout scm
    }

    stage('packaging & deploying') {
    artifactoryBuildInfo = Artifactory.newBuildInfo()
    // Packaging & deploying mvn
    archiveArtifacts artifacts: "target/cowsay.deb", fingeprint: true

    // packaging & deploying deb package
    def uploadSpec = """{
    "files": [
    {
    "pattern": "target/cowsay.deb",
    "target": "debian-repo/pool/",
    "props": "deb.distribution=testing;deb.component=main;deb.architecture=all"
    }
    ]
    }"""
    artifactoryBuildInfo = artifactoryServer.upload spec: uploadSpec
    artifactoryServer.publishBuildInfo artifactoryBuildInfo
    }

    stage('promotion') {
    def promotionConfig = [
    'buildName' : artifactoryBuildInfo.name,
    'buildNumber' : artifactoryBuildInfo.number,
    'sourceRepo' : 'debian-repo/pool/',
    'targetRepo' : 'debian-repo/pool/',
    'comment' : 'Promoting build',
    'status' : 'Released',
    'includeDependencies': true,
    'copy' : true,
    'failFast' : true
    ]

    // Promote build interactively if tests are OK
    Artifactory.addInteractivePromotion server: artifactoryServer, promotionConfig: promotionConfig, displayName: 'Promote me!'
    }
    }


    How can I manage this? Artifactory does not document such a possibility. Do I need to create a custom pipeline to achieve this?



    Thanks










    share|improve this question


























      up vote
      1
      down vote

      favorite









      up vote
      1
      down vote

      favorite











      I have a Jenkins pipeline to build a .deb package. It successfully uploads the package to an Artifactory repository. The package itself is in the 'pool', and the metadata are created for the 'main' component and the 'testing' distribution. My preprod environment installs the package via APT.



      What I would like to do now is to promote the build to the 'stable' distribution in the same repository (we have only one corporate Artifactory instance with lots of repositories, so I can't have several).



      My pipeline looks like this:



      #!/usr/bin/env groovy
      node('XXX') {

      def artifactoryServer
      def artifactoryBuildInfo

      stage('Artifactory configuration') {
      artifactoryServer = Artifactory.newServer url: "http://mycorporateartifactoryrepo.com", credentialsId: 'XXXXX'
      }

      stage('checkout') {
      checkout scm
      }

      stage('packaging & deploying') {
      artifactoryBuildInfo = Artifactory.newBuildInfo()
      // Packaging & deploying mvn
      archiveArtifacts artifacts: "target/cowsay.deb", fingeprint: true

      // packaging & deploying deb package
      def uploadSpec = """{
      "files": [
      {
      "pattern": "target/cowsay.deb",
      "target": "debian-repo/pool/",
      "props": "deb.distribution=testing;deb.component=main;deb.architecture=all"
      }
      ]
      }"""
      artifactoryBuildInfo = artifactoryServer.upload spec: uploadSpec
      artifactoryServer.publishBuildInfo artifactoryBuildInfo
      }

      stage('promotion') {
      def promotionConfig = [
      'buildName' : artifactoryBuildInfo.name,
      'buildNumber' : artifactoryBuildInfo.number,
      'sourceRepo' : 'debian-repo/pool/',
      'targetRepo' : 'debian-repo/pool/',
      'comment' : 'Promoting build',
      'status' : 'Released',
      'includeDependencies': true,
      'copy' : true,
      'failFast' : true
      ]

      // Promote build interactively if tests are OK
      Artifactory.addInteractivePromotion server: artifactoryServer, promotionConfig: promotionConfig, displayName: 'Promote me!'
      }
      }


      How can I manage this? Artifactory does not document such a possibility. Do I need to create a custom pipeline to achieve this?



      Thanks










      share|improve this question















      I have a Jenkins pipeline to build a .deb package. It successfully uploads the package to an Artifactory repository. The package itself is in the 'pool', and the metadata are created for the 'main' component and the 'testing' distribution. My preprod environment installs the package via APT.



      What I would like to do now is to promote the build to the 'stable' distribution in the same repository (we have only one corporate Artifactory instance with lots of repositories, so I can't have several).



      My pipeline looks like this:



      #!/usr/bin/env groovy
      node('XXX') {

      def artifactoryServer
      def artifactoryBuildInfo

      stage('Artifactory configuration') {
      artifactoryServer = Artifactory.newServer url: "http://mycorporateartifactoryrepo.com", credentialsId: 'XXXXX'
      }

      stage('checkout') {
      checkout scm
      }

      stage('packaging & deploying') {
      artifactoryBuildInfo = Artifactory.newBuildInfo()
      // Packaging & deploying mvn
      archiveArtifacts artifacts: "target/cowsay.deb", fingeprint: true

      // packaging & deploying deb package
      def uploadSpec = """{
      "files": [
      {
      "pattern": "target/cowsay.deb",
      "target": "debian-repo/pool/",
      "props": "deb.distribution=testing;deb.component=main;deb.architecture=all"
      }
      ]
      }"""
      artifactoryBuildInfo = artifactoryServer.upload spec: uploadSpec
      artifactoryServer.publishBuildInfo artifactoryBuildInfo
      }

      stage('promotion') {
      def promotionConfig = [
      'buildName' : artifactoryBuildInfo.name,
      'buildNumber' : artifactoryBuildInfo.number,
      'sourceRepo' : 'debian-repo/pool/',
      'targetRepo' : 'debian-repo/pool/',
      'comment' : 'Promoting build',
      'status' : 'Released',
      'includeDependencies': true,
      'copy' : true,
      'failFast' : true
      ]

      // Promote build interactively if tests are OK
      Artifactory.addInteractivePromotion server: artifactoryServer, promotionConfig: promotionConfig, displayName: 'Promote me!'
      }
      }


      How can I manage this? Artifactory does not document such a possibility. Do I need to create a custom pipeline to achieve this?



      Thanks







      debian jenkins-pipeline artifactory






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 19 at 13:48

























      asked Nov 19 at 9:57









      Yann Poirier

      134




      134
























          1 Answer
          1






          active

          oldest

          votes

















          up vote
          0
          down vote



          accepted










          Artifactory Build Promotion gives you the ability to mark a build as 'promoted' (i.e. released) and perhaps move or copy Artifacts to different repos (which signify a release-ready location).



          In your case though, changing a Debian artifact's distribution can be done by modifying the deb.distribution property set on the artifact - this will cause it to get indexed in stable distribution as well (and thus available to apt in the new distribution).



          I would suggest either adding a step to your pipeline for this or creating a different job altogether that promotes the build and then annotates the artifacts with the required properties.



          Another alternative is to use a user plugin that you can trigger from your job, but tagging with properties is more convenient via standard REST API IMHO.






          share|improve this answer

















          • 1




            Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
            – Yann Poirier
            Nov 23 at 14:44











          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%2f53372132%2fjenkins-artifatory-pipeline-how-to-promote-a-debian-package-from-a-testing-dis%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



          accepted










          Artifactory Build Promotion gives you the ability to mark a build as 'promoted' (i.e. released) and perhaps move or copy Artifacts to different repos (which signify a release-ready location).



          In your case though, changing a Debian artifact's distribution can be done by modifying the deb.distribution property set on the artifact - this will cause it to get indexed in stable distribution as well (and thus available to apt in the new distribution).



          I would suggest either adding a step to your pipeline for this or creating a different job altogether that promotes the build and then annotates the artifacts with the required properties.



          Another alternative is to use a user plugin that you can trigger from your job, but tagging with properties is more convenient via standard REST API IMHO.






          share|improve this answer

















          • 1




            Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
            – Yann Poirier
            Nov 23 at 14:44















          up vote
          0
          down vote



          accepted










          Artifactory Build Promotion gives you the ability to mark a build as 'promoted' (i.e. released) and perhaps move or copy Artifacts to different repos (which signify a release-ready location).



          In your case though, changing a Debian artifact's distribution can be done by modifying the deb.distribution property set on the artifact - this will cause it to get indexed in stable distribution as well (and thus available to apt in the new distribution).



          I would suggest either adding a step to your pipeline for this or creating a different job altogether that promotes the build and then annotates the artifacts with the required properties.



          Another alternative is to use a user plugin that you can trigger from your job, but tagging with properties is more convenient via standard REST API IMHO.






          share|improve this answer

















          • 1




            Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
            – Yann Poirier
            Nov 23 at 14:44













          up vote
          0
          down vote



          accepted







          up vote
          0
          down vote



          accepted






          Artifactory Build Promotion gives you the ability to mark a build as 'promoted' (i.e. released) and perhaps move or copy Artifacts to different repos (which signify a release-ready location).



          In your case though, changing a Debian artifact's distribution can be done by modifying the deb.distribution property set on the artifact - this will cause it to get indexed in stable distribution as well (and thus available to apt in the new distribution).



          I would suggest either adding a step to your pipeline for this or creating a different job altogether that promotes the build and then annotates the artifacts with the required properties.



          Another alternative is to use a user plugin that you can trigger from your job, but tagging with properties is more convenient via standard REST API IMHO.






          share|improve this answer












          Artifactory Build Promotion gives you the ability to mark a build as 'promoted' (i.e. released) and perhaps move or copy Artifacts to different repos (which signify a release-ready location).



          In your case though, changing a Debian artifact's distribution can be done by modifying the deb.distribution property set on the artifact - this will cause it to get indexed in stable distribution as well (and thus available to apt in the new distribution).



          I would suggest either adding a step to your pipeline for this or creating a different job altogether that promotes the build and then annotates the artifacts with the required properties.



          Another alternative is to use a user plugin that you can trigger from your job, but tagging with properties is more convenient via standard REST API IMHO.







          share|improve this answer












          share|improve this answer



          share|improve this answer










          answered Nov 21 at 22:17









          danf

          1,9891222




          1,9891222








          • 1




            Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
            – Yann Poirier
            Nov 23 at 14:44














          • 1




            Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
            – Yann Poirier
            Nov 23 at 14:44








          1




          1




          Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
          – Yann Poirier
          Nov 23 at 14:44




          Thanks, that's exactly what I did : another pipeline that changes the distribution to stable using the REST API. I didn't want the build pipeline to automatically release the artifact on the stable repository without some tests :).
          – Yann Poirier
          Nov 23 at 14:44


















          draft saved

          draft discarded




















































          Thanks for contributing an answer to Stack Overflow!


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.





          Some of your past answers have not been well-received, and you're in danger of being blocked from answering.


          Please pay close attention to the following guidance:


          • Please be sure to answer the question. Provide details and share your research!

          But avoid



          • Asking for help, clarification, or responding to other answers.

          • Making statements based on opinion; back them up with references or personal experience.


          To learn more, see our tips on writing great answers.




          draft saved


          draft discarded














          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53372132%2fjenkins-artifatory-pipeline-how-to-promote-a-debian-package-from-a-testing-dis%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

          A CLEAN and SIMPLE way to add appendices to Table of Contents and bookmarks

          Calculate evaluation metrics using cross_val_predict sklearn

          Insert data from modal to MySQL (multiple modal on website)