utility

findFiles

  • jenkinsfile

  • result

tips

java.io.NotSerializableException: groovy.lang.IntRange

refenrece:

references:

load a constant

see also imarslo: groovy metaClass

groovy file ( constant.groovy )

Jenkinsfile

  • result

extend the pipeline

groovy script ( builtInStage.groovy )

jenkinsfile

  • stage viewbuilt-in stages

timeout

sample jenkins pipeline

get previous build abort

[!TIP]

DSL

original DSL:

others

handle api

running in temporaray folders

  • using pwd(temp:true)

    • console output

  • using System.currentTimeMillis()

    • console output

check git branch exists in local repo

  • or via show-ref

withCredentials

references:

Both `gitUsernamePassword` and `gitSshPrivateKey` bindings depend on the Credential Plugin to retrieve user’s credential using the Credentials API. Git SSH Private Key Binding The gitSshPrivateKey implementation provides git authentication support over SSH protocol using private key and passphrase credentials of a user. The binding uses two git specific environment variables depending upon the minimum CLI-git version - `GIT_SSH_COMMAND` - If version is greater than or equal to 2.3, then the GIT_SSH_COMMAND environment variable provides the ssh command including necessary options which are: path to the private key and host key checking, to authenticate and connect to the git server without using an executable script. - `SSH_ASKPASS` - If version is less than 2.3, an executable script is attached to the variable which provides the ssh command including necessary options which are: path to the private key and host key checking, to authenticate and connect to the git server

push with ssh private credentials

gitUsernamePassword

[!NOTE] If for any particular reason, the push must be done using a different method the URL needs to be configured accordingly:

  • git config url.git@github.com/.insteadOf https://github.com/ : if the checkout was done through HTTPS but push must be done using SSH

  • git config url.https://github.com/.insteadOf git@github.com/ : if the checkout was done through SSH but push must be done using HTTPS escaping characters in the ECHO commands of the askpass script:

sshUserPrivateKey

  • or

  • sample code

code clone

groovy.io.FileType

[!NOTE|label:references:]

  • way to call

Last updated

Was this helpful?