Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cloudbees folder patch 1 #1086

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 6 additions & 2 deletions manifests/job/absent.pp
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,12 @@
fail('Management of Jenkins jobs requires \$jenkins::service_ensure to be set to \'running\'')
}

$tmp_config_path = "/tmp/${jobname}-config.xml"
$job_dir = "${jenkins::job_dir}/${jobname}"
# in case of a cloudbees-folder element replace all '/' with underscore so only a file without subdirectory is deleted
$replaced_jobname = regsubst($jobname, /\//, '_', 'G')
$tmp_config_path = "/tmp/${replaced_jobname}-config.xml"
# in case of a cloudbees-folder element inserting sub-directory '/jobs' for every folder level so the existing config file is deleted
$job_subdir_name = regsubst($jobname, /\//, '/jobs/', 'G')
$job_dir = "${jenkins::job_dir}/${job_subdir_name}"
$config_path = "${job_dir}/config.xml"

# Temp file to use as stdin for Jenkins CLI executable
Expand Down
8 changes: 6 additions & 2 deletions manifests/job/present.pp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,9 @@
$tmp_config_path = $config_file
}
else {
$tmp_config_path = "/tmp/${jobname}-config.xml"
# in case of a cloudbees-folder element replace all '/' with underscore so only a file without subdirectory is created
$replaced_jobname = regsubst($jobname, /\//, '_', 'G')
$tmp_config_path = "/tmp/${replaced_jobname}-config.xml"
#
# When a Jenkins job is imported via the cli, Jenkins will
# re-format the xml file based on its own internal rules.
Expand All @@ -59,7 +61,9 @@
}
}

$job_dir = "${jenkins::job_dir}/${jobname}"
# in case of a cloudbees-folder element inserting sub-directory '/jobs' for every folder level so the existing config_path or job_dir/builds is found
$job_subdir_name = regsubst($jobname, /\//, '/jobs/', 'G')
$job_dir = "${jenkins::job_dir}/${job_subdir_name}"
$config_path = "${job_dir}/config.xml"

# Bring variables from Class['jenkins'] into local scope.
Expand Down
Loading