Quantcast
Channel: User Louis Maddox - Stack Overflow
Viewing all articles
Browse latest Browse all 51

Answer by Louis Maddox for Read webhook payload in Gitlab CI

$
0
0

If you run compgen -v to show the environment variables when triggering the pipeline in the UI (without JSON payload) you get 3 fewer lines in your job log than when POSTing a JSON payload.

The additional variables are:

  • CI_BUILD_TRIGGERED
  • CI_PIPELINE_TRIGGERED
  • TRIGGER_PAYLOAD

If you print their values out and re-run the pipeline:

echo CI_BUILD_TRIGGERED=$CI_BUILD_TRIGGEREDecho CI_PIPELINE_TRIGGERED=$CI_PIPELINE_TRIGGEREDecho TRIGGER_PAYLOAD=$TRIGGER_PAYLOAD

You get (for username YOUR_USER_NAME and repo name YOUR_REPO_NAME)

CI_BUILD_TRIGGERED=trueCI_PIPELINE_TRIGGERED=trueTRIGGER_PAYLOAD=/builds/YOUR_USER_NAME/YOUR_REPO_NAME.tmp/TRIGGER_PAYLOAD

So as you can see the payload is stored as TRIGGER_PAYLOAD in a temporary directory suffixed .tmp, which re-running the pipeline and printing it out (cat) shows it contains the payload, in my case that’s JSON.


Viewing all articles
Browse latest Browse all 51

Trending Articles