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

added setting clean build #96

Open
wants to merge 1 commit 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
3 changes: 3 additions & 0 deletions examples/build_config_settings/build_config_settings.tf
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,9 @@ resource "teamcity_build_config" "nocode_config" {
#Positive int
build_counter = 1

#Delete all files in the checkout directory before the build. Default: false
clean_build = false

#Set to false to disable personal builds. Default: true
allow_personal_builds = true

Expand Down
9 changes: 9 additions & 0 deletions teamcity/resource_build_config.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,6 +171,11 @@ func resourceBuildConfig() *schema.Resource {
ValidateFunc: validation.IntAtLeast(0),
Computed: true,
},
"clean_build": {
Type: schema.TypeBool,
Optional: true,
Default: false,
},
"allow_personal_builds": {
Type: schema.TypeBool,
Optional: true,
Expand Down Expand Up @@ -649,6 +654,9 @@ func expandBuildConfigOptionsRaw(v *schema.Set) (*api.BuildTypeOptions, error) {
if v, ok := raw["build_counter"]; ok {
opt.BuildCounter = v.(int)
}
if v, ok := raw["clean_build"]; ok {
opt.CleanBuild = v.(bool)
}
if v, ok := raw["allow_personal_builds"]; ok {
opt.AllowPersonalBuildTriggering = v.(bool)
}
Expand Down Expand Up @@ -678,6 +686,7 @@ func flattenBuildConfigOptionsRaw(dt *api.BuildTypeOptions) map[string]interface
m["configuration_type"] = dt.BuildConfigurationType
m["build_number_format"] = dt.BuildNumberFormat
m["build_counter"] = dt.BuildCounter
m["clean_build"] = dt.CleanBuild
m["allow_personal_builds"] = dt.AllowPersonalBuildTriggering
m["artifact_paths"] = flattenStringSlice(dt.ArtifactRules)
m["detect_hanging"] = dt.EnableHangingBuildsDetection
Expand Down
5 changes: 5 additions & 0 deletions teamcity/resource_build_config_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ func TestAccBuildConfig_Settings(t *testing.T) {
resource.TestCheckResourceAttr(resName, "settings.3961488219.artifact_paths.#", "1"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.artifact_paths.0", "+:*.json => /config/*.json"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.build_counter", "20"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.clean_build", "false"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.build_number_format", "1.0.%build.counter%"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.concurrent_limit", "10"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.detect_hanging", "true"),
Expand Down Expand Up @@ -560,6 +561,7 @@ func TestAccBuildConfig_SettingsUpdate(t *testing.T) {
resource.TestCheckResourceAttr(resName, "settings.3961488219.artifact_paths.#", "1"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.artifact_paths.0", "+:*.json => /config/*.json"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.build_counter", "20"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.clean_build", "false"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.build_number_format", "1.0.%build.counter%"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.concurrent_limit", "10"),
resource.TestCheckResourceAttr(resName, "settings.3961488219.detect_hanging", "true"),
Expand All @@ -575,6 +577,7 @@ func TestAccBuildConfig_SettingsUpdate(t *testing.T) {
resource.TestCheckResourceAttr(resName, "settings.3684435053.artifact_paths.#", "1"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.artifact_paths.0", "+:*.json => /artifacts/*.json"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.build_counter", "25"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.clean_build", "true"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.build_number_format", "2.0.%build.counter%"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.concurrent_limit", "0"),
resource.TestCheckResourceAttr(resName, "settings.3684435053.detect_hanging", "false"),
Expand Down Expand Up @@ -955,6 +958,7 @@ resource "teamcity_build_config" "build_configuration_test" {
configuration_type = "DEPLOYMENT"
build_number_format = "1.0.%build.counter%"
build_counter = 20
clean_build = false
allow_personal_builds = true
artifact_paths = ["+:*.json => /config/*.json"]
detect_hanging = true
Expand All @@ -977,6 +981,7 @@ resource "teamcity_build_config" "build_configuration_test" {
configuration_type = "REGULAR"
build_number_format = "2.0.%build.counter%"
build_counter = 25
clean_build = true
allow_personal_builds = false
artifact_paths = ["+:*.json => /artifacts/*.json"]
detect_hanging = false
Expand Down