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

CLI pipeline trigger with variables? #663

Open
vilhelmen opened this issue Dec 12, 2018 · 4 comments
Open

CLI pipeline trigger with variables? #663

vilhelmen opened this issue Dec 12, 2018 · 4 comments

Comments

@vilhelmen
Copy link
Contributor

Description of the problem, including code/CLI snippet

It doesn't seem possible to trigger a pipeline and send variables from the CLI, but maybe I'm doing something wrong? I was hoping to use the cli instead of a bunch of curl for easier project id resolution, but I admit JSON on the CLI is gross and I should probably just do it directly in three lines of python.

Example I'm trying:

gitlab project trigger-pipeline \
        --id 43 \
        --ref "dev" \
        --token "XXXXXXX" \
        --variables "{\"TEST\": \"??????????\"}"

If you run a pipeline trigger with debug on, you can see that it's sending an empty variables dictionary by default:

send: b'{"ref": "dev", "token": "XXXXXXX", "variables": {}}'

Expected Behavior

Trigger pipeline with variables

Actual Behavior

gitlab: error: unrecognized arguments: --variables {"TEST": "??????????"}

Specifications

  • python-gitlab version: 1.7.0
  • API version you are using (v3/v4): v4
  • Gitlab server version (or gitlab.com): 11.5.3-ee
@gpocentek
Copy link
Contributor

Hi @vilhelmen

This is a limitation with have in the CLI at the moment, "complex" arguments are not supported properly.

@emayssat
Copy link

what about
gitlab trigger-pipeline --id 1234 --ref branch --token XXXXX --variable VAR1=value1 --variable VAR2=value2 ?

Is there any way to pass parameters to a pipeline using the CLI?

@dgricci
Copy link

dgricci commented Jul 7, 2022

Hi,

I am facing the same issue as @vilhelmen (still using curl for addressing this functionnality) :

According to the GitLab API doc on trigger pipeline, the variables is an array of {key: name, 'variable_type': 'file ou env_var (default)', value: value}.

Any feedback on this issue ?

@nickbroon
Copy link
Contributor

nickbroon commented Mar 28, 2023

I guess this is an other enhancement that also depends on #1735

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

No branches or pull requests

5 participants