Skip to content

Commit

Permalink
no double negation
Browse files Browse the repository at this point in the history
  • Loading branch information
andreineculau committed Aug 1, 2015
1 parent af1376e commit 751081e
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 12 deletions.
4 changes: 0 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,6 @@ All available **Switches** can be found in the source-code [here](src/main/groov
I currently use something like this

```
-DnoDelete=true
-DnoViews=true
-DjenkinsUrl=https://example.com/jenkins
-DallowSelfsignedSslCerts=true
[email protected]:repo.git
Expand All @@ -47,8 +45,6 @@ I currently use something like this

**NOTE**: `testing-my-repo-Xbranch-sync-with-repo` is disabled, but has cronjob builder/poller, so that the new jobs based on it, will be enabled and will start on their own.

**NOTE**: if you use this for branches that eventually get deleted, and you would like `jenkins-build-per-branch` to delete jobs for those pruned branches set `noDelete=false` AND MAKE SURE TO RENAME `testing-my-repo-Xbranch-sync-with-repo` to e.g. `sync-with-repo-testing-my-repo-Xbranch`, or else it will think `Xbranch-sync-with-repo` is a branch that doesn't exist anymore.

## Original docs

[README.original.md](README.original.md)
Expand Down
2 changes: 1 addition & 1 deletion build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ task syncWithRepo(dependsOn: 'classes', type: JavaExec) {
main = 'com.entagen.jenkins.Main'
classpath = sourceSets.main.runtimeClasspath
// pass through specified system properties to the call to main
['help', 'jenkinsUrl', 'jenkinsUser', 'jenkinsPassword', 'gitUrl', 'templateJobPrefix', 'templateBranchName', 'branchNameRegex', 'nestedView', 'viewRegex', 'printConfig', 'dryRun', 'startOnCreate', 'noViews', 'noDelete', 'allowSelfsignedSslCerts', 'enableJobRegex', 'disableJobRegex'].each {
['help', 'jenkinsUrl', 'jenkinsUser', 'jenkinsPassword', 'gitUrl', 'templateJobPrefix', 'templateBranchName', 'branchNameRegex', 'nestedView', 'viewRegex', 'printConfig', 'dryRun', 'startOnCreate', 'views', 'deleteOld', 'allowSelfsignedSslCerts', 'enableJobRegex', 'disableJobRegex'].each {
if (System.getProperty(it)) systemProperty it, System.getProperty(it)
}

Expand Down
10 changes: 5 additions & 5 deletions src/main/groovy/com/entagen/jenkins/JenkinsJobManager.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ class JenkinsJobManager {
Boolean allowSelfsignedSslCerts = false

Boolean dryRun = false
Boolean noViews = false
Boolean noDelete = false
Boolean views = false
Boolean deleteOld = false

JenkinsApi jenkinsApi
GitApi gitApi
Expand All @@ -41,7 +41,7 @@ class JenkinsJobManager {
syncJobs(allBranchNames, allJobNames, templateJobs)

// create any missing branch views, scoped within a nested view if we were given one
if (!noViews) {
if (views) {
syncViews(allBranchNames)
}
}
Expand All @@ -52,7 +52,7 @@ class JenkinsJobManager {
List<ConcreteJob> expectedJobs = this.expectedJobs(templateJobs, nonTemplateBranchNames)

createMissingJobs(expectedJobs, currentTemplateDrivenJobNames, templateJobs)
if (!noDelete) {
if (deleteOld) {
deleteDeprecatedJobs(currentTemplateDrivenJobNames - expectedJobs.jobName)
}
}
Expand Down Expand Up @@ -117,7 +117,7 @@ class JenkinsJobManager {
List<BranchView> missingBranchViews = expectedBranchViews.findAll { BranchView branchView -> !existingViewNames.contains(branchView.viewName)}
addMissingViews(missingBranchViews)

if (!noDelete) {
if (deleteOld) {
List<String> deprecatedViewNames = getDeprecatedViewNames(existingViewNames, expectedBranchViews)
deleteDeprecatedViews(deprecatedViewNames)
}
Expand Down
4 changes: 2 additions & 2 deletions src/main/groovy/com/entagen/jenkins/Main.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -15,9 +15,9 @@ class Main {
c: [longOpt: 'print-config', required: false, args: 0, argName: 'printConfig', description: "Check configuration - print out settings then exit"],
d: [longOpt: 'dry-run', required: false, args: 0, argName: 'dryRun', description: "Dry run, don't actually modify, create, or delete any jobs, just print out what would happen"],
s: [longOpt: 'start-on-create', required: false, args: 0, argName: 'startOnCreate', description: "When creating a new job, start it at once."],
v: [longOpt: 'no-views', required: false, args: 0, argName: 'noViews', description: "Suppress view creation - gradle flag -DnoViews=true"],
k: [longOpt: 'no-delete', required: false, args: 0, argName: 'noDelete', description: "Do not delete (keep) branches and views - gradle flag -DnoDelete=true"],
v: [longOpt: 'views', required: false, args: 0, argName: 'views', description: "Create views"],
r: [longOpt: 'view-regex', required: false, args: 1, argName: 'viewRegex', description: "Supply a custom regex to be applied to any generated views, overriding the default template regex"],
k: [longOpt: 'delete-old', required: false, args: 0, argName: 'deleteOld', description: "Delete old branches and views"],
f: [longOpt: 'filter-branch-names', required: false, args: 1, argName: 'branchNameRegex', description: "Only branches matching the regex will be accepted"],
en: [longOpt: 'enable-job-regex', required: false, args: 1, argName: 'enableJobRegex', description: "If job matches regex, enable job no matter status of template job"],
dis: [longOpt: 'disable-job-regex', required: false, args: 1, argName: 'disableJobRegex', description: "If job matches regex, disable job no matter status of template job"],
Expand Down

0 comments on commit 751081e

Please sign in to comment.