【问题标题】:What is the best way to archive/restore selected jenkins job存档/恢复所选詹金斯工作的最佳方法是什么
【发布时间】:2015-08-04 09:45:26
【问题描述】:

我想知道存档您未使用的作业的最佳方式是什么。是否有任何插件可以让我们存档选定的 Jenkins 作业并在以后如果我们觉得他们需要时恢复它们。 现在我正在复制作业文件夹并在删除作业日志后将其存档。为了恢复,我正在将此目录恢复到 Jenkins 中的作业目录。

【问题讨论】:

    标签: jenkins jenkins-plugins


    【解决方案1】:

    Shelve Project plugin 正是这样做的。

    来自维基页面:

    此插件可让您“搁置”项目,以便它们可以轻松复活。当您搁置一个项目时,它会从项目列表中消失 [...] 而不是被删除,数据会归档到一个 zip 文件中并存储在服务器上 [...] 这允许管理员恢复它稍后。

    【讨论】:

      【解决方案2】:

      我不知道最佳答案,但我创建了一个 python 脚本来完成这项工作, 你可以在 https://github.com/thinkingmonster/pythonscripts

      This module provides facility  to  take easy backup of Jenkins jobs which needs to be archived.It provided the facility where you can either provide a single jobname to be archived or multiple job names written inside a file and passing file path as an argument to the script.Script can be run as shown below.
      
      <h6>How to use module </h6>
      - Pull the files and place them at /opt
      - TakeInput.py is the main file execute the same to start the program.
      - Alternatively you can also create a softlink to the same in /bin and use soft-link as command.
      
      ```
      python TakeInput.py -n <jobname>
      ```
      
      <br>
      
      <table style="width:100%">
        <tr>
          <th>Option</th>
          <th>Explain</th> 
        </tr>
        <tr>
          <td>-h</td>
          <td>Prints help menu</td>     
        </tr>
        <tr>
          <td>-n</td>
          <td>Provide job name or full job name(absolute path) as input</td>     
        </tr>
        <tr>
          <td>-f</td>
          <td>Provide input file path(absolute path)</td>     
        </tr>
        <tr>
          <td>-b</td>
          <td>Provide backup location,ie location where you want the archived job to be placed<br>
      	     default is /tmp location</td>     
        </tr>
        <tr>
          <td>-r</td>
          <td>This option works when you want to restore an archived job back to the Jenkins<br> environment.You can provide absolute
      	path of job archive or absolute path of directory containing job archives for mass restore</td>     
        </tr>
      </table>

      【讨论】:

      • 此脚本不再可用。
      【解决方案3】:

      Jenkins 的Job Config History 插件间接包含了这一点。删除的作业会进入一种回收站,并且可以通过从主页 (/jobConfigHistory) 转到作业配置历史记录来恢复。由于配置历史插件非常有用,因此这是一个不错的奖励。

      【讨论】:

        猜你喜欢
        • 2014-07-10
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 1970-01-01
        • 2022-08-10
        • 1970-01-01
        相关资源
        最近更新 更多