Without the variables the server call works and gitlab is starting the pipeline.
But when I add variables to that call, it errors: "variables needs to be a map of key-valued strings".
This is my code:
axios
.post(`https://gitlab.myurl.com/api/v4/projects/${projectId}/trigger/pipeline`, {
ref: branch,
token: token,
variables: { STAGING_AREA: 'testing1', NOTIFY_STATUS: true, SLACK_USER_ID: 'xxxxx' }
})
.then(res => {
console.log('pipeline started:', res.data.web_url);
})
.catch(error => {
console.error('errorMessage', error);
});
What is the correct syntax for passing variables?
I was doing one thing wrong.
NOTIFY_STATUS: true
It seems that true can only be passed as a string:
NOTIFY_STATUS: 'true'
After this edit my code worked just fine.