Usage of file variable type in Trigger pipelines using command line


I’m trying to pass a variable of type file while using the trigger pipeline option from command line

We need to automate few pipeline runs so thought of using trigger pipeline , So under this I created the trigger token for a subproject and started exploring it

To run our pipeline we are using 2 variables one is a normal variable and other is of type file as we are passing a token value

So In order to achieve this I’m not getting any reference or guidance in the docs of using file variable type in trigger pipeline

We are using a self-managed gitlab 14.9.2-ee

I referred the below mentioned links

curl -X POST --fail -F token=<trigger_token> -F ref=main -F variables[SUBNAMESPACE]=<value_used> -F files[TOKEN]= https://<>/api/v4/projects/46058/trigger/pipeline

This is not working as it’s not able to register as files under Trigger variables

So How to use file type here

Please help here and Thanks in advance

Hi @kaushikr

you can’t pass file variables via trigger API, if you have to use trigger API then send the file content as normal variable and create a file from it in the triggered pipeline if it must be a file.

Hi Balonik,

Thanks for replying

Can you please let me know how to create a file while using the triggering pipeline option?

It will be really helpful

In the job that needs it just do (if on Linux) echo $TOKEN > token_file.