[DO-1239] add_podtemplates (#45)
Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.tech> Reviewed-on: https://git.avroid.tech/DevOps/jenkins-shared-lib/pulls/45 Reviewed-by: Denis Patrakeev <denis.patrakeev@avroid.team> Co-authored-by: Rustam Tagaev <rustam.tagaev@avroid.team> Co-committed-by: Rustam Tagaev <rustam.tagaev@avroid.team>
This commit is contained in:
committed by
Denis Patrakeev
parent
47a42636db
commit
e7158b0c4f
@@ -43,8 +43,9 @@ class Git implements Serializable {
|
|||||||
* - trackingSubmodules: Boolean - Use last commit in .gitmodules, default false
|
* - trackingSubmodules: Boolean - Use last commit in .gitmodules, default false
|
||||||
* - shallow: Boolean - clone with depth = 1
|
* - shallow: Boolean - clone with depth = 1
|
||||||
* - listFiles: Boolean - List cloned files, default false
|
* - listFiles: Boolean - List cloned files, default false
|
||||||
|
* @return git vars: GIT_BRANCH, GIT_CHECKOUT_DIR, GIT_PREVIOUS_COMMIT, GIT_PREVIOUS_SUCCESSFUL_COMMIT, GIT_URL
|
||||||
*/
|
*/
|
||||||
public clone(Map args = [:]) {
|
public Map clone(Map args = [:]) {
|
||||||
Map defaultArgs = [
|
Map defaultArgs = [
|
||||||
branch: 'main',
|
branch: 'main',
|
||||||
disableSubmodules: false,
|
disableSubmodules: false,
|
||||||
@@ -62,21 +63,23 @@ class Git implements Serializable {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
script.checkout([$class: 'GitSCM',
|
Map scmVars = script.checkout([$class: 'GitSCM',
|
||||||
branches: [[name: "${args.branch}"]],
|
branches: [[name: "${args.branch}"]],
|
||||||
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${args.path}"],
|
extensions: [[$class: 'RelativeTargetDirectory', relativeTargetDir: "${args.path}"],
|
||||||
[$class: 'SubmoduleOption', disableSubmodules: args.disableSubmodules,
|
[$class: 'SubmoduleOption', disableSubmodules: args.disableSubmodules,
|
||||||
recursiveSubmodules: args.recursiveSubmodules,
|
recursiveSubmodules: args.recursiveSubmodules,
|
||||||
parentCredentials: args.parentCredentials,
|
parentCredentials: args.parentCredentials,
|
||||||
trackingSubmodules: args.trackingSubmodules,
|
trackingSubmodules: args.trackingSubmodules,
|
||||||
shallow: args.shallow]],
|
shallow: args.shallow]],
|
||||||
userRemoteConfigs: [[credentialsId: this.creds,
|
userRemoteConfigs: [[credentialsId: this.creds,
|
||||||
url: "${args.urlRepo}"]]
|
url: "${args.urlRepo}"]]
|
||||||
])
|
])
|
||||||
|
|
||||||
if (args.listFiles) {
|
if (args.listFiles) {
|
||||||
this.script.sh "ls -la ${args.path}"
|
this.script.sh "ls -la ${args.path}"
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return scmVars
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user