tech:notes_gitlab-ci_pipeline_-_api
Différences
Ci-dessous, les différences entre deux révisions de la page.
| Les deux révisions précédentesRévision précédenteProchaine révision | Révision précédente | ||
| tech:notes_gitlab-ci_pipeline_-_api [2026/07/10 15:55] – Jean-Baptiste | tech:notes_gitlab-ci_pipeline_-_api [2026/07/16 13:25] (Version actuelle) – Jean-Baptiste | ||
|---|---|---|---|
| Ligne 1: | Ligne 1: | ||
| < | < | ||
| - | {{tag> | + | {{tag> |
| # Notes Gitlab-ci pipeline - API | # Notes Gitlab-ci pipeline - API | ||
| Ligne 60: | Ligne 60: | ||
| " | " | ||
| ~~~ | ~~~ | ||
| + | |||
| + | Avec Ansible | ||
| + | |||
| + | `.gitlab-ci.yml` | ||
| + | ~~~yaml | ||
| + | launch: | ||
| + | tags: | ||
| + | # - gitlab-runner-sh-001 | ||
| + | - gitlab-runner-docker-001 | ||
| + | image: registry.acme.local/ | ||
| + | stage: build | ||
| + | script: ansible-playbook play-launch-ci.yml -e url=" | ||
| + | ~~~ | ||
| + | |||
| + | `play-launch-ci.yml` | ||
| + | ~~~yaml | ||
| + | #! / | ||
| + | |||
| + | --- | ||
| + | |||
| + | - name: Launch CI | ||
| + | gather_facts: | ||
| + | hosts: localhost | ||
| + | |||
| + | vars: | ||
| + | branch: "{{ lookup(' | ||
| + | line: "{{ lookup(' | ||
| + | kind: "{{ lookup(' | ||
| + | |||
| + | tasks: | ||
| + | - name: Assert check environment vars are correctly defined | ||
| + | ansible.builtin.assert: | ||
| + | that: | ||
| + | - url is defined and url != '' | ||
| + | - token is defined and token != '' | ||
| + | - branch is defined and branch != '' | ||
| + | - line is defined and line != '' | ||
| + | - kind is defined and kind != '' | ||
| + | msg: "Env var must be defined" | ||
| + | |||
| + | - name: Call API | ||
| + | # no_log: true | ||
| + | register: reg_uri | ||
| + | until: reg_uri.status == 201 | ||
| + | retries: 3 | ||
| + | delay: 5 # Every 5 seconds | ||
| + | ansible.builtin.uri: | ||
| + | url: "{{ url }}/ | ||
| + | # validate_certs: | ||
| + | status_code: | ||
| + | follow_redirects: | ||
| + | method: POST | ||
| + | body_format: | ||
| + | headers: | ||
| + | Content-Type: | ||
| + | body: | | ||
| + | { | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | " | ||
| + | } | ||
| + | } | ||
| + | ~~~ | ||
| + | |||
| Voir https:// | Voir https:// | ||
tech/notes_gitlab-ci_pipeline_-_api.1783691716.txt.gz · Dernière modification : de Jean-Baptiste
