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

bitbucket_pipeline_schedule resource throwing 404 #120

Open
alaminopu opened this issue Dec 13, 2022 · 7 comments
Open

bitbucket_pipeline_schedule resource throwing 404 #120

alaminopu opened this issue Dec 13, 2022 · 7 comments

Comments

@alaminopu
Copy link

Creating a pipeline schedule using bitbucket_pipeline_schedule is failing.

resource "bitbucket_pipeline_schedule" "scan_ecr_images" {
  workspace    = "<workspace>"
  repository   = "<repo>"
  cron_pattern = "0 0 * * *"
  enabled      = true

  target {
    ref_name = "master"
    ref_type = "branch"

    selector {
      type    = "custom"
      pattern = "external-amazon-images"
    }
  }
}

Terraform Version

1.3.6

Affected Resource(s)

bitbucket_pipeline_schedule

Debug Output

https://gist.github.com/alaminopu/f06c1c8638d84a14d9c67dd5f8582116

@alaminopu
Copy link
Author

@DrFaust92 Could you please take a look at this issue?

@mauriceackel
Copy link

We are facing a similar issue!

@alaminopu, have you been able to resolve this? I noticed that you are using a 5-segment cron-string while bitbucket expects 7 segments (i.e. seconds and years). However, even with a 7-segment cron-string, we get a 404 although the API call works with CURL

@alaminopu
Copy link
Author

@mauriceackel no. Wasn't able to resolve it. We are currently using manual schedule setup until this is fixed.

@DrFaust92
Copy link
Owner

DrFaust92 commented Nov 13, 2023 via email

@mauriceackel
Copy link

mauriceackel commented Nov 14, 2023

I did some more digging and found out, that the bitbucket go client, that is used by this provider, seems to be working fine.

I tested the main branch of the client library with this setup:

        selector := &bitbucket.PipelineSelector{
		Type_:   "custom",
		Pattern: "mypipeline",
	}
	target := &bitbucket.PipelineSchedulePostRequestBodyTarget{
		Type_:    "pipeline_ref_target",
		RefName:  "main",
		RefType:  "branch",
		Selector: selector,
	}
	schedule := &bitbucket.PipelineSchedulePostRequestBody{
		Enabled:     true,
		CronPattern: "0 0 6-18 ? * 1-5 *",
		Target:      target,
	}

As this was working, I suspect the issue is somewhere in here:
https://github.com/DrFaust92/terraform-provider-bitbucket/blob/master/bitbucket/resource_pipeline_schedule.go#L97-L104

@mauriceackel
Copy link

I don't have experience with Go, but I just stumbled upon this line here.

This casts (at least from my understanding), the whole "target" object to a map of strings. However, it does not only consist of strings, as "selector" is again a list. So maybe this is causing the issue, but I am really unsure.

@alaminopu
Copy link
Author

@DrFaust92 had a chance to look at this issue?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants