Skip to content

fix: do not run build run if builds are not passed in #209

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

Merged
merged 3 commits into from
Jun 27, 2025
Merged
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
1 change: 1 addition & 0 deletions solutions/project/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,7 @@ module "build" {

resource "terraform_data" "run_build" {
depends_on = [module.build]
count = length(local.updated_builds) > 0 ? 1 : 0

provisioner "local-exec" {
interpreter = ["/bin/bash", "-c"]
Expand Down
29 changes: 26 additions & 3 deletions tests/pr_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -190,9 +190,10 @@ func TestUpgradeCEProjectDA(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
TerraformDir: projectSolutionsDir,
Prefix: "ce-da",
Testing: t,
TerraformDir: projectSolutionsDir,
Prefix: "ce-da",
CheckApplyResultForUpgrade: true,
})

options.TerraformVars = map[string]interface{}{
Expand Down Expand Up @@ -365,3 +366,25 @@ func writeTfvarsFile(t *testing.T, path string, vars map[string]interface{}) err
}
return err
}

// test edge case when only empty project is created
func TestCEProjectDABasic(t *testing.T) {
t.Parallel()

options := testhelper.TestOptionsDefault(&testhelper.TestOptions{
Testing: t,
TerraformDir: projectSolutionsDir,
Prefix: "ce-da-empty",
})

options.TerraformVars = map[string]interface{}{
"existing_resource_group_name": resourceGroup,
"provider_visibility": "public",
"prefix": options.Prefix,
"project_name": "proj-test",
}

output, err := options.RunTestConsistency()
assert.Nil(t, err, "This should not have errored")
assert.NotNil(t, output, "Expected some output")
}