book
  • README
  • cheatsheet
    • bash
      • builtin
      • syntactic sugar
      • cmd
      • havefun
    • text-processing
      • awk
      • sed
      • html
      • json
      • regex
      • unicode
    • osx
    • curl
    • tricky
    • widget
    • proxy
    • colors
    • math
    • media
    • ssl
      • keystore
      • verification
      • server
      • client
      • tricky
    • windows
      • powershell
      • choco
      • wsl
      • wt
      • shortcut
      • clsid
      • env
      • shell:folder
  • vim
    • nvim
    • install
    • color
    • plugins
      • usage
      • other plugins
      • deprecated
    • tricky
    • viml
    • windows
    • troubleshooting
  • devops
    • admin tools
    • ssh
    • git
      • config
      • alias
      • submodule
      • eol
      • example
      • gerrit
        • gerrit API
      • github
      • troubleshooting
      • tricky
      • statistics
    • pre-commit
    • release-tools
    • tmux
      • cheatsheet
    • ansible
    • vault
    • artifactory
      • api
      • cli
      • aql
      • nginx cert
    • klocwork
      • kwadmin
      • kwserver
      • api
      • q&a
    • elk
    • mongodb
    • android
    • mobile
  • jenkins
    • config
      • windows
    • appearance
    • troubleshooting
    • jenkinsfile
      • utility
      • parallel
      • build
      • envvar
      • properties
      • trigger
      • node
    • script
      • job
      • build
      • stage
      • agent
      • security & authorization
      • exception
      • monitor
      • tricky
    • api
      • blueocean
    • cli
    • plugins
      • kubernetes
      • docker
      • shared-libs
      • lockable-resource
      • ansicolor
      • badge
      • groovy-postbuild
      • simple-theme
      • customizable-header
      • artifactory
      • jira-steps
      • job-dsl
      • build-timeline
      • crumbIssuer
      • coverage
      • uno-choice
      • tricky
  • virtualization
    • kubernetes
      • init
        • kubespray
        • kubeadm
          • environment
          • crio v1.30.4
          • docker v1.15.3
          • HA
        • addons
        • etcd
      • kubectl
        • pod
        • deploy
        • replicasets
        • namespace
        • secrets
      • node
      • certificates
      • events
      • kubeconfig
      • kubelet
      • troubleshooting
      • cheatsheet
      • auth
      • api
      • tools
        • monitor
        • helm
        • network
        • minikube
    • docker
      • run & exec
      • voume
      • remove
      • show info
      • dockerfile
      • dockerd
      • tricky
      • troubleshooting
      • windows
    • crio
    • podman
  • ai
    • prompt
  • osx
    • apps
      • init
      • brew
    • defaults
    • system
    • network
    • script
    • tricky
  • linux
    • devenv
    • util
      • time & date
      • output formatting
      • params
      • tricky
    • nutshell
    • disk
    • network
    • troubleshooting
    • system
      • apt/yum/snap
      • authorization
      • apps
      • x11
    • ubuntu
      • systemctl
      • x
    • rpi
  • programming
    • groovy
    • python
      • config
      • basic
      • list
      • pip
      • q&a
    • others
    • archive
      • angular
      • maven
      • mysql
        • installation
        • logs
      • ruby
        • rubyInstallationQ&A
  • tools
    • fonts
    • html & css
    • Jira & Confluence
    • node & npm
      • gitbook
      • hexo
      • github.page
      • code themes
    • app
      • microsoft office
      • vscode
      • virtualbox
      • iterm2
      • browser
      • skype
      • teamviewer
      • others
  • quotes
  • english
Powered by GitBook
On this page
  • git clone
  • downgrade

Was this helpful?

  1. jenkins
  2. plugins

tricky

Previousuno-choiceNextvirtualization

Last updated 1 year ago

Was this helpful?

git clone

[!NOTE|label:references:]

setup to fetch refs/changes only

# Refspec
refs/changes/*:refs/remotes/origin/changes/*

setup to fetch only refs/heads/sandbox/marslo/*

# Refspec
refs/heads/sandbox/marslo/*:refs/remotes/origin/heads/sandbox/marslo/*

fetch gerrit changes

# Refspec
$GERRIT_REFSPEC:$GERRIT_REFSPEC

# branch
$GERRIT_REFSPEC
# or
FETCH_HEAD

downgrade

jsch

[!NOTE]

  • api

  • references:

$ curl -O https://repo1.maven.org/maven2/com/github/mwiede/jsch/0.2.7/jsch-0.2.7.jar
$ docker cp jsch-0.2.7.jar e6cd5d7516cd:/var/jenkins_home/plugins/jsch/WEB-INF/lib/jsch-0.1.55.jar
#                               ^
#                        Docker Container ID
import org.jenkinsci.plugins.jsch.JSchConnector
import java.io.InputStream

import com.jcraft.jsch.JSch
import com.jcraft.jsch.Session
import com.jcraft.jsch.LocalIdentityRepository
import com.jcraft.jsch.Channel
import com.jcraft.jsch.ChannelExec

String user = 'srv-ssd-fw-devops'
String host = 'sample.gerrit.com'
int port    = 29418
String path = System.getProperty( 'user.home' ) + '/.ssh/ed25519/devops@ssdfw'
// Byte[] privateKey = ''.getBytes()

JSch jsch = new JSchConnector( user, host, port ).getJSch()
jsch.addIdentity( path )

Session session = jsch.getSession( user, host, port )
session.setConfig( 'StrictHostKeyChecking', 'no' )
session.setConfig( 'HostkeyAlgorithms', '+ssh-rsa' )
session.setConfig( 'PreferredAuthentications', 'publickey' )

println """
  ${session.getClass()}:
    session client version : ${session.getClientVersion()} : ${session.clientVersion}
    session host           : ${session.getHost()} : ${session.host}
    session port           : ${session.getPort()} : ${session.port}
    session hostkey        : ${session.getHostKey()} : ${session.hostKey}
    session hostkey alias  : ${session.getHostKeyAlias()} : ${session.hostKeyAlias}
    session isConnected    : ${session.isConnected()}
"""

def knowHosts = session.getHostKeyRepository()
println """
  ${knowHosts.getClass()}:
    knownHosts host key     : ${knowHosts.getHostKey( host, 'ssh-rsa' )}
    knowHosts repository id : ${knowHosts.getKnownHostsRepositoryID()}
"""

def idRepo = jsch.getIdentityRepository()
println """
  ${idRepo.getClass()} :
      identityRepository name       : ${idRepo.getName()} : ${idRepo.name}
      identityRepository status     : ${idRepo.getStatus()} : ${idRepo.status}
      identityRepository identities : ${idRepo.getIdentities()} : ${idRepo.identities}
"""

session.connect()
  • revert

    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/jsch* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/gerrit* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/maven-plugin* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/mercuri* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/ivy* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/artifactory* .
    sudo cp -rp /jenkins/DEVOPS-JENKINS/plugins/bitbucket*

grgit

[!NOTE]

    • This support must be explicitly enabled with the system property org.ajoberstar.grgit.auth.command.allow=true.

  • grgit-clone

    Grgit.clone {
      dir = <path>
      uri = <path or uri>
      remote = <name>
      all = <boolean>
      bare = <boolean>
      branches = <full refs>
      checkout = <boolean>
      refToCheckout = <name>
      depth = <integer>
      credentials = <credentials>
    }
    • import org.ajoberstar.grgit.Grgit
      import org.ajoberstar.grgit.Credentials
      
      def grgit = Grgit.clone(dir: '...', url: '...', credentials: new Credentials(username, password))

JENKINS-71273: Gerrit Trigger fails to connect Gerrit 2.14 - com.jcraft.jsch.JSchException: verify: false
Nicola Beghin
Public key authentication fails with JSch but work with OpenSSH with the same key
org.jenkinsci.plugins.jsch.JSchConnector
Package com.jcraft.jsch
com.jcraft.jsch.Session
com.jcraft.jsch.KeyExchange
com.jcraft.jsch.OpenSSHConfig
Java JSch Example to run Shell Commands on SSH Unix Server
Best Java code snippets using com.jcraft.jsch.JSch
Java SSH connect with key using JSch - Auth Failed
JSCH: SFTP. Hangs at session.connect() using the port 21
Creating JSch HostKey instance from a public key in .pub format
grgit-authentication
sample
Git - What is "Refspec"
Jenkins Git Refspec not correctly substituted for branch specifier
Why does "git clone" not take a refspec?
Jenkins gerrit trigger not fetching my change when building
How to execute Jenkinsfile with gerrit trigger plugin for changeset in jenkins?
git clone
setup to fetch refs/changes only
setup to fetch only refs/heads/sandbox/marslo/*
fetch gerrit changes
downgrade
jsch
grgit
jsch plugin issue