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

How to pass job variables to job.play() #2731

Closed
2 tasks done
Prophet32j opened this issue Oct 4, 2022 · 8 comments · Fixed by #2258
Closed
2 tasks done

How to pass job variables to job.play() #2731

Prophet32j opened this issue Oct 4, 2022 · 8 comments · Fixed by #2258
Labels
awaiting upstream released This issue/pull request has been released. type:bug Changes fix a minor bug

Comments

@Prophet32j
Copy link

Description
There doesn't appear to be an ability to pass variables to a pipeline when playing from the gitbeaker API. The Gitlab Jobs API shows it as the payload in the call: https://gitlab.com/gitlab-org/gitlab/-/blob/master/doc/api/jobs.md#run-a-job

I need to pass in a couple variables which will simplify my entire process.

Something like this is what I would expect with this API:

const api = new Gitlab({
  host: myHost,
  token: myToken
})

export async function playJob(job: Types.JobSchema, projectId: String): Promise<void> {
  await api.Jobs.play(projectId, job.id, {
    jobVariableAttributes: [
      {
        key: 'CUSTOM_JOB_VARIABLE_NAME',
        value: 'CUSTOM_JOB_VARIABLE_VALUE'
      }
    ]
  })
}

Checklist

  • I have checked that this is not a duplicate issue.
  • I have read the documentation.
@jdalrymple
Copy link
Owner

Hmm, that should work. I've had trouble in the past with the way the Gitlab API handles array though, since they didnt seem to be consistent. Ill give it a look and follow up when I have the time.

@Prophet32j
Copy link
Author

Prophet32j commented Oct 5, 2022 via email

@jdalrymple
Copy link
Owner

Fixed for the next release!

@Prophet32j
Copy link
Author

Prophet32j commented Dec 31, 2022 via email

@Prophet32j
Copy link
Author

@jdalrymple I see this is tagged for the next major release. When are you intending to release?

@jdalrymple
Copy link
Owner

End of the month! 🤞 At least the rc will be available then for people to test out. Currently just need to fix the CI pipeline for the automated release and testing.

@jdalrymple jdalrymple added type:bug Changes fix a minor bug and removed bug labels Mar 16, 2023
@jdalrymple
Copy link
Owner

@Prophet32j Give the latest canary a try, it should be fixed!

@jdalrymple
Copy link
Owner

🚀 Issue was released in 37.0.0 🚀

@jdalrymple jdalrymple added the released This issue/pull request has been released. label Apr 26, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
awaiting upstream released This issue/pull request has been released. type:bug Changes fix a minor bug
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants