Using a variable in GitLab CI inside a POST request

Asked By: Anonymous

I can’t understand what YML does to my script and why everything reads as text. Can you please explain why everything is read as text and how to insert variables here?

  script:
    - >
      curl --silent --show-error
      --request POST 
      --header 'Content-Type: application/json'
      --url "https:webhook"
      --data '{"@type": "MessageCard","@context": "http://schema.org/extensions","themeColor": "0076D7","summary": "New changes ","sections": [{"activityTitle": "New changes","activitySubtitle": "Some Build","activityImage": "png","facts": [{"name": "Assigned to","value": "$GITLAB_USER_LOGIN"}, {"name": "Due date","value": "$CI_JOB_STARTED_AT"}, {"name": "Status","value": "$CI_JOB_STATUS"}],}]}'

The result is something like

Mistake


Solution

Answered By: Anonymous

Try with the triple funny quotes around the variables. Example: "'"$CI_JOB_STARTED_AT"'". A more cleaner way would be to move the curl command to a shell script.

techinplanet staff

techinplanet staff


Windows 10 Kaufen Windows 10 Pro Office 2019 Kaufen Office 365 Lizenz Windows 10 Home Lizenz Office 2019 Home Business Kaufen windows office 365 satın al follower kaufen instagram follower kaufen porno