microsoft / terraform-provider-azuredevops

Terraform Azure DevOps provider
https://www.terraform.io/docs/providers/azuredevops/
MIT License
387 stars 280 forks source link

Scheduled runs are only executed after schedule is updated. #961

Open olofmattsson-inriver opened 10 months ago

olofmattsson-inriver commented 10 months ago

Community Note

Terraform (and Azure DevOps Provider) Version

terraform -v Terraform v1.7.1 on linux_amd64

Affected Resource(s)

Terraform Configuration Files

terraform {
  required_providers {
    azuredevops = {
      source  = "microsoft/azuredevops"
      version = "0.11.0"
    }

  }
  required_version = ">=1.3, <2"
}
data "azuredevops_project" "default" {
  name = "YOUR PROJECT"
}
data "azuredevops_git_repository" "default" {
  project_id = data.azuredevops_project.default.id
  name       = "YOUR REPO"
}
resource "azuredevops_build_definition" "drift_pipelines" {
  project_id      = data.azuredevops_project.default.id
  name            = "Test pipeline"
  path            = "\\test"
  queue_status    = "enabled"
  repository {
    repo_id             = data.azuredevops_git_repository.default.id
    repo_type           = "TfsGit"
    branch_name         = "refs/heads/main"
    yml_path            = "Any valid pipeline yaml" 
    report_build_status = false
  }
  ci_trigger {
    use_yaml = false
  }
  schedules {
    branch_filter {
      include = ["refs/heads/main"]
    }
    days_to_build              = ["Wed"]
    schedule_only_with_changes = false
    start_hours                = 08
    start_minutes              = 11
    time_zone                  = "(UTC) Coordinated Universal Time"
  }
  features {
    skip_first_run = false
  }
}

Debug Output

Panic Output

Expected Behavior

The scheduled run should be executed according to schedule.

Actual Behavior

The pipeline is created and the schedule is visible in Azure DevOps web interface but the run is not executed.

Steps to Reproduce

  1. terraform apply
  2. Wait for the scheduled time to pass and observe no run.

Important Factoids

If I update the schedule after the initial apply (move the start_minute a few minutes into the future) and apply the schedule will work. Feels like there is a difference in how the build definition in created versus updated.

References

xuzhang3 commented 10 months ago

@olofmattsson-inriver Checked the pipeline schedules, the schedule was queued but never triggered, this is a service issue.

image
olofmattsson-inriver commented 10 months ago

@xuzhang3 I know but Azuer Devops support claims that since it works when the schedule is created from the UI it is not a service problem. But I will continue to poke at them.

xuzhang3 commented 10 months ago

@olofmattsson-inrive Not sure why the run was scheduled but not triggered, but from the result this should be a service bug

olofmattsson-inriver commented 9 months ago

Adding the issue created with Microsoft Development Community: https://developercommunity.visualstudio.com/t/Scheduled-runs-are-only-executed-after-s/10584928