How can I update jenkins plugins from the terminal?

后端 未结 6 1893
庸人自扰
庸人自扰 2021-01-30 11:07

I am trying to create a bash script for setting up Jenkins. Is there any way to update a plugin list from the Jenkins terminal?

At first setup there is no plugin availab

6条回答
  •  醉梦人生
    2021-01-30 11:38

    Here is how you can deploy Jenkins CI plugins using Ansible, which of course is used from the terminal. This code is a part of roles/jenkins_ci/tasks/main.yaml:

    - name: Plugins
      with_items:                             # PLUGIN NAME
      - name: checkstyle                      # Checkstyle
      - name: dashboard-view                  # Dashboard View
      - name: dependency-check-jenkins-plugin # OWASP Dependency Check
      - name: depgraph-view                   # Dependency Graph View
      - name: deploy                          # Deploy
      - name: emotional-jenkins-plugin        # Emotional Jenkins
      - name: monitoring                      # Monitoring
      - name: publish-over-ssh                # Publish Over SSH
      - name: shelve-project-plugin           # Shelve Project
      - name: token-macro                     # Token Macro
      - name: zapper                          # OWASP Zed Attack Proxy (ZAP)
      sudo: yes
      get_url: dest="{{ jenkins_home }}/plugins/{{ item.name | mandatory }}.jpi"
               url="https://updates.jenkins-ci.org/latest/{{ item.name }}.hpi"
               owner=jenkins group=jenkins mode=0644
      notify: Restart Jenkins
    

    This is a part of a more complete example that you can find at: https://github.com/sakaal/service_platform_ansible/blob/master/roles/jenkins_ci/tasks/main.yaml

    Feel free to adapt it to your needs.

提交回复
热议问题