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

Add pipeline description to spec to match API #71

Closed
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
4 changes: 4 additions & 0 deletions codefresh/resource_pipeline.go
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,10 @@ func resourcePipeline() *schema.Resource {
Optional: true,
Default: "github",
},
"description": {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Event if we supported this field for the pipeline, why do you put in spec_template?

Type: schema.TypeString,
Optional: true,
},
},
},
},
Expand Down
51 changes: 51 additions & 0 deletions codefresh/resource_pipeline_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -731,6 +731,57 @@ resource "codefresh_pipeline" "test" {
`, rName, originalYamlString)
}

func testAccCodefreshPipelineBasicConfigDescription(rName, repo, path, revision, context, description string) string {
return fmt.Sprintf(`
resource "codefresh_pipeline" "test" {

lifecycle {
ignore_changes = [
revision
]
}

name = "%s"

spec {
spec_template {
repo = %q
path = %q
revision = %q
context = %q
}

description = "%s"
}
}
`, rName, repo, path, revision, context, description)
}

func TestAccCodefreshPipeline_Description(t *testing.T) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are you sure this test is valid? You just added the description property under the spec_template and here you are specifying it under the spec

name := pipelineNamePrefix + acctest.RandString(10)
resourceName := "codefresh_pipeline.test"

resource.Test(t, resource.TestCase{
PreCheck: func() { testAccPreCheck(t) },
Providers: testAccProviders,
CheckDestroy: testAccCheckCodefreshPipelineDestroy,
Steps: []resource.TestStep{
{
Config: testAccCodefreshPipelineBasicConfigDescription(name, "codefresh-contrib/react-sample-app", "./codefresh.yml", "master", "git", "This is my pipeline, there are many like it but this one is mine"),
Check: resource.ComposeTestCheckFunc(
testAccCheckCodefreshPipelineExists(resourceName),
resource.TestCheckResourceAttr(resourceName, "spec.0.description", "This is my pipeline, there are many like it but this one is mine"),
),
},
{
ResourceName: resourceName,
ImportState: true,
ImportStateVerify: true,
},
},
})
}

func TestAccCodefreshPipeline_Contexts(t *testing.T) {
name := pipelineNamePrefix + acctest.RandString(10)
resourceName := "codefresh_pipeline.test"
Expand Down
1 change: 1 addition & 0 deletions examples/pipelines.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ resource "codefresh_pipeline" "test" {
spec {
concurrency = 1
priority = 5
description = "This is my pipeline, there are many like it, but this one is mine."

spec_template {
repo = "codefresh-contrib/react-sample-app"
Expand Down