Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
J
jenkins-learning-project
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Nasir Hussain
jenkins-learning-project
Commits
2a95bc2f
Unverified
Commit
2a95bc2f
authored
Feb 03, 2021
by
nasirhm
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔧
👷
Seedjob
Signed-off-by:
nasirhm
<
nasirhussainm14@gmail.com
>
parent
44f4da32
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
35 additions
and
18 deletions
+35
-18
mySeedJob.groovy
mySeedJob.groovy
+35
-18
No files found.
mySeedJob.groovy
View file @
2a95bc2f
folder
(
'My-Project'
)
{
displayName
(
'My Project'
)
description
(
'Project for me'
)
}
//def ENV_gitUrl = build.environment.get("GIT_URL")
//def ENV_gitBranch = build.environment.get("GIT_BRANCH")
//def ENV_jenkinsFilePath = build.environment.get("JENKINS_FILE_URL")
//def ENV_folderName = build.environment.get("FOLDER_NAME")
//def ENV_folderDisplayName = build.environment.get("FOLDER_DISPLAY_NAME")
//def ENV_folderDescription = build.environment.get("FOLDER_DESCRIPTION")
pipelineJob
(
'My-Project/job-dsl-plugin'
)
{
function
createFolder
(
String
folderName
,
String
folderDisplayName
,
String
folderDescription
){
jobDsl
scriptText:
"""folder(\'${folderName}\') {
displayName(\'${folderDisplayName}\')
description(\'${folderDescription}\')
}
"""
}
function
createPipelineJob
(
String
jobName
,
String
gitUrl
,
String
gitBranch
,
String
jenkinsFilePath
)
{
jobDsl
scriptText:
"""
pipelineJob(My-Project/\'${jobName}\'){
definition {
cpsScm {
scm {
git {
remote {
url
(
'https://gitlab.mynisum.com/nhussain/jenkins-learning-project.git'
)
url(\'${gitUrl}\')
}
branch(\'${gitBranch}\')
}
branch
(
'*/master
'
)
scriptPath(\'${jenkinsFilePath}\
')
}
}
lightweight
()
}
}
"""
}
createFolder
(
"My-Project"
,
"My Project"
,
"My Folder Description"
)
createPipelineJob
(
"My-Seed-Job"
,
"https://gitlab.mynisum.com/nhussain/jenkins-learning-project.git"
,
"master"
,
"Jenkinsfile"
)
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment