Outils pour utilisateurs

Outils du site


tech:notes_gitlab-ci_pipeline_-_api

Ceci est une ancienne révision du document !


Notes Gitlab-ci pipeline - API

Exemple 1 - avec Access Token

  • Avec Access Token
  • Aller dans le projet - puis : Settings / Access tokens
  • Attention : par défaut les Access Tokens ont une date d'expiration
  • Voir Personnal Access tokens

Launch pipeline with API call - with Private / Personal access tokens

curl --request POST \
  --header "PRIVATE-TOKEN: saltxx-8888888888" \
  --header "Content-Type: application/json" \
  --data '{ "ref": "testjb", "variables": [ {"key": "VAR1", "value": "plop"}, {"key": "VAR2", "value": "plop"}, {"key": "VAR3", "value": "plop"}, {"key": "VAR4", "value": ""} ] }' \
  --url "http://gitlab.acme.local/api/v4/projects/100/pipeline"

Voir https://docs.gitlab.com/api/rest/

Exemple 2 - Avec Trigger Tokens

Voir aussi :

Aller dans le projet, puis Settings/ CI/CD / Pipeline trigger tokens

Trigger pipeline with the API / Pass CI/CD variables in the API call

curl --request POST \
     --form token=glptt-99999999999999 \
     --form ref=testjb \
     --form "variables[VAR1]=plop" \
     --form "variables[VAR2]=plop" \
     --form "variables[VAR3]=plop" \
     --form "variables[VAR4]=plop" \
     "http://gitlab.acme.local/api/v4/projects/100/trigger/pipeline"  

Voir https://docs.gitlab.com/ci/triggers/

tech/notes_gitlab-ci_pipeline_-_api.1781710094.txt.gz · Dernière modification : de Jean-Baptiste

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki