chris-peterson / pwsh-gitlab

:computer: PowerShell module for GitLab
MIT License
22 stars 10 forks source link

Start-GitlabJob without Variables #83

Closed CaseyMacPherson closed 1 year ago

CaseyMacPherson commented 1 year ago

Since the change to add the ability to pass variables it appears that if you just want to start a job, it produces a body that gitlab just straight throws away and reports nothing

running Start-GitlabJob with -Debug and no variables specified creates this output

{
    "job_variables_attributes": {}
}

And will silently fail to start the job.

API documentation shows the body for job_variables_attributes is an array []

{
  "job_variables_attributes": [
    {
      "key": "TEST_VAR_1",
      "value": "test1"
    },
    {
      "key": "TEST_VAR_2",
      "value": "test2"
    }
  ]
}

if job_variables_attributes is set to an empty array, then it works

{
    "job_variables_attributes": []
}
chris-peterson commented 1 year ago

Resolved by this change