Skip to content
This repository has been archived by the owner on Nov 20, 2019. It is now read-only.

Commit

Permalink
Move */ -> refs/heads/ translation.
Browse files Browse the repository at this point in the history
The addStandardParameters isn"t the normal entrypoint for adding parameters.  It"s not even used any longer.
Also change some other places where */ was showing up
  • Loading branch information
mmitche committed Dec 14, 2017
1 parent f9df265 commit 40a3258
Show file tree
Hide file tree
Showing 9 changed files with 26 additions and 41 deletions.
4 changes: 2 additions & 2 deletions docs/CI-CLASSIC.md
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ def branch = BranchName
// 3. Adds standard parameters for PR and push jobs.
// These allow PR jobs to be used for simple private testing, for instance.
// See the documentation for this function to see additional optional parameters.
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.standardJobSetup(newJob, project, isPR, "refs/heads/${branch}")
// The following two calls add triggers for push and PR jobs
// In Github, the PR trigger will appear as "Windows Debug" and "Windows Release" and will be run
Expand Down Expand Up @@ -94,7 +94,7 @@ def newJob = job(newJobName) {
}
}
// Call standard job setup to give the job default options, source control, etc.
Utilities.standardJobSetup(newJob, project, , false /* not a PR */, "*/${branch}")
Utilities.standardJobSetup(newJob, project, , false /* not a PR */, "refs/heads/${branch}")
// Set what type of machine it runs on
Utilities.setMachineAffinity(newJob, 'Ubuntu14.04', 'latest')
// And add some kind of trigger
Expand Down
2 changes: 1 addition & 1 deletion docs/sample-classic-declaration.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ def branch = BranchName
// 3. Adds standard parameters for PR and push jobs.
// These allow PR jobs to be used for simple private testing, for instance.
// See the documentation for this function to see additional optional parameters.
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.standardJobSetup(newJob, project, isPR, "refs/heads/${branch}")

// The following two calls add triggers for push and PR jobs
// In Github, the PR trigger will appear as "Windows Debug" and "Windows Release" and will be run
Expand Down
2 changes: 1 addition & 1 deletion management/nodes/Clean-Resource-Group.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ param (
[Parameter(Mandatory=$true)]
[string]$ResourceGroupName,
[switch]$RunForever = $false,
$Servers = @("https://ci.dot.net","https://ci2.dot.net","https://ci3.dot.net","https://dotnet-ci4.westus2.cloudapp.azure.com"),
$Servers = @("https://ci.dot.net","https://ci2.dot.net","https://ci3.dot.net"),
[string]$Regex = '.*[a-f0-9]{6}$',
[switch]$DryRun = $false
)
Expand Down
4 changes: 2 additions & 2 deletions src/jobs/generation/MetaGenerator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ repos.each { repoInfo ->
branch('${vstsBranchOrCommit}')
}
else {
branch("*/${repoInfo.utilitiesRepoBranch}")
branch("refs/heads/${repoInfo.utilitiesRepoBranch}")
}
}
}
Expand Down Expand Up @@ -411,7 +411,7 @@ repos.each { repoInfo ->
}
}
else {
branch("*/${repoInfo.branch}")
branch("refs/heads/${repoInfo.branch}")
}

// Set up polling ignore, unless this is a DSL test
Expand Down
18 changes: 9 additions & 9 deletions src/jobs/generation/RootGenerator.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ folder('GenPRTest') {}
}
}

branch("*/${RepoListLocationBranch}")
branch("refs/heads/${RepoListLocationBranch}")

extensions {
relativeTargetDirectory('dotnet-ci-repolist')
Expand Down Expand Up @@ -94,7 +94,7 @@ folder('GenPRTest') {}
}
}

branch("*/${RepoListLocationBranch}")
branch("refs/heads/${RepoListLocationBranch}")

// On older versions of DSL this is a top level git element called relativeTargetDir
extensions {
Expand All @@ -112,7 +112,7 @@ folder('GenPRTest') {}
}
}

branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")

extensions {
relativeTargetDirectory('dotnet-ci-sdk')
Expand Down Expand Up @@ -262,7 +262,7 @@ job('disable_jobs_in_folder') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down Expand Up @@ -306,7 +306,7 @@ job('workspace_cleaner') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down Expand Up @@ -350,7 +350,7 @@ job('system_cleaner') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down Expand Up @@ -395,7 +395,7 @@ job('swap_space_monitor_remover') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down Expand Up @@ -442,7 +442,7 @@ job('node_cleaner') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down Expand Up @@ -488,7 +488,7 @@ job('generator_cleaner') {
github("dotnet/dotnet-ci")
}
}
branch("*/${SDKImplementationBranch}")
branch("refs/heads/${SDKImplementationBranch}")
}
}

Expand Down
32 changes: 8 additions & 24 deletions src/jobs/generation/Utilities.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -189,14 +189,14 @@ class Utilities {
* @param job Job to set up.
* @param project Name of project
* @param isPR True if job is PR job, false otherwise.
* @param defaultBranch If not a PR job, the branch that we should be building.
* @param branch If not a PR job, the branch that we should be building.
*/
def static standardJobSetup(def job, String project, boolean isPR, String defaultBranch = "*/master") {
def static standardJobSetup(def job, String project, boolean isPR, String branch) {
String defaultRefSpec = getDefaultRefSpec(null)
if (isPR) {
defaultBranch = getDefaultBranchOrCommitPR(null)
branch = getDefaultBranchOrCommitPR(null)
}
standardJobSetupEx(job, project, isPR, defaultBranch, defaultRefSpec)
standardJobSetupEx(job, project, isPR, branch, defaultRefSpec)
}

/**
Expand Down Expand Up @@ -689,26 +689,6 @@ class Utilities {
}
}

/**
* Adds the standard parameters for PR and Push jobs.
*
* @param job Job to change
* @param project Github project
* @param isPR True if this is a PR job, false otherwise.
* @param branch Branch to build by default if this is NOT a PR job.
*/
def private static addStandardParameters(def job, String project, boolean isPR, String branch) {
if (branch.indexOf('*/') == 0){
branch = branch.replace('*','refs/heads')
}
String defaultRefSpec = getDefaultRefSpec(null)
if (isPR) {
branch = getDefaultBranchOrCommitPR(null)
}

addStandardParametersEx(job, project, isPR, branch, defaultRefSpec)
}

/**
* Adds the standard parameters for PR and Push jobs.
*
Expand All @@ -719,6 +699,10 @@ class Utilities {
* @param defaultRefSpec the refs that Jenkins must sync on a PR job
*/
def private static addStandardParametersEx(def job, String project, boolean isPR, String defaultBranchOrCommit, String defaultRefSpec) {
if (defaultBranchOrCommit.indexOf('*/') == 0){
defaultBranchOrCommit = defaultBranchOrCommit.replace('*/','/refs/heads')
}

if (isPR) {
addStandardPRParameters(job, project, defaultBranchOrCommit, defaultRefSpec)
}
Expand Down
1 change: 1 addition & 0 deletions tests/dsl/simple_job_check_out_to_subdir.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ def branch = BranchName
}

Utilities.setMachineAffinity(newJob, "Windows_NT", 'latest-or-auto')
// Leave */ on this, should be replaced by refs/heads/
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")

// After calling standardJobSetup, modify the job so it checks out to a subdir
Expand Down
2 changes: 1 addition & 1 deletion tests/dsl/simple_traditional_job.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -13,5 +13,5 @@ def branch = BranchName
}

Utilities.setMachineAffinity(newJob, "Windows_NT", 'latest-or-auto')
Utilities.standardJobSetup(newJob, project, isPR, "*/${branch}")
Utilities.standardJobSetup(newJob, project, isPR, "refs/heads/${branch}")
}
2 changes: 1 addition & 1 deletion tests/dsl/test_repro_job.groovy
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ def reproJob = job(Utilities.getFullJobName(project, 'simple_repro', false)) {
}
label('test-vm')
}
Utilities.standardJobSetup(reproJob, project, false, "*/${branch}")
Utilities.standardJobSetup(reproJob, project, false, "refs/heads/${branch}")

0 comments on commit 40a3258

Please sign in to comment.