feat: Add compatibility with CoreOS
This commit is contained in:
parent
b787b15353
commit
94dcd1374e
@ -1,24 +0,0 @@
|
|||||||
#!/usr/bin/env bash
|
|
||||||
|
|
||||||
# Lancer une pipeline
|
|
||||||
request=$(curl --silent --request POST --header "Authorization: Bearer ${DRONE_TOKEN}" ${DRONE_BASE_URL}/api/repos/${DRONE_REPOSITORY_PATH}/builds${DRONE_URL_PARAM} | jq .number)
|
|
||||||
|
|
||||||
# Attendre que la pipeline ne soit plus en exécution
|
|
||||||
while true; do
|
|
||||||
# Récupérer l'état de la pipeline
|
|
||||||
status=$(curl --silent --request GET --header "Authorization: Bearer ${DRONE_TOKEN}" ${DRONE_BASE_URL}/api/repos/${DRONE_REPOSITORY_PATH}/builds/$request | jq .status)
|
|
||||||
|
|
||||||
case "${status}" in
|
|
||||||
"\"pending\"" | "\"running\"")
|
|
||||||
sleep 5s
|
|
||||||
;;
|
|
||||||
"\"success\"")
|
|
||||||
echo "${DRONE_REPOSITORY_PATH}: ${status}"
|
|
||||||
exit 0
|
|
||||||
;;
|
|
||||||
*)
|
|
||||||
echo "${DRONE_REPOSITORY_PATH}: ${status}"
|
|
||||||
exit 1
|
|
||||||
;;
|
|
||||||
esac
|
|
||||||
done
|
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# handlers file for drone_runner_exec
|
# handlers file for drone_runner_exec
|
||||||
|
|
||||||
- name: Redémarrer drone-runner-exec.service
|
- name: Restart drone-runner-exec.service
|
||||||
ansible.builtin.systemd:
|
ansible.builtin.systemd:
|
||||||
enabled: true
|
enabled: true
|
||||||
daemon_reload: true
|
daemon_reload: true
|
||||||
|
@ -11,6 +11,9 @@ galaxy_info:
|
|||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- all
|
- all
|
||||||
|
- name: CoreOS
|
||||||
|
varsions:
|
||||||
|
- 41
|
||||||
|
|
||||||
dependencies:
|
dependencies:
|
||||||
- role: users
|
- role: users
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
# tasks file for drone_runner_exec
|
# tasks file for drone_runner_exec
|
||||||
|
|
||||||
- name: Créer le dossier de configuration
|
- name: Create configuration path
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: "{{ drone_runner_exec_config_base_path }}"
|
path: "{{ drone_runner_exec_config_base_path }}"
|
||||||
@ -10,7 +10,7 @@
|
|||||||
mode: u=rwX,g=rX,o=rX
|
mode: u=rwX,g=rX,o=rX
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Créer le dossier de journalisation
|
- name: Create log path
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /var/log/drone-runner-exec
|
path: /var/log/drone-runner-exec
|
||||||
@ -19,7 +19,7 @@
|
|||||||
mode: u=rwX,g=rX,o=rX
|
mode: u=rwX,g=rX,o=rX
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Configurer le runner
|
- name: Deploy configuration
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: config.j2
|
src: config.j2
|
||||||
dest: "{{ drone_runner_exec_config_base_path }}/config"
|
dest: "{{ drone_runner_exec_config_base_path }}/config"
|
||||||
@ -29,26 +29,26 @@
|
|||||||
become: true
|
become: true
|
||||||
notify: Redémarrer drone-runner-exec.service
|
notify: Redémarrer drone-runner-exec.service
|
||||||
|
|
||||||
- name: Récupérer les faits sur les services
|
- name: Get service facts
|
||||||
ansible.builtin.service_facts:
|
ansible.builtin.service_facts:
|
||||||
|
|
||||||
- name: Installer drone-runner.service
|
- name: Install runner service
|
||||||
ansible.builtin.command:
|
ansible.builtin.command:
|
||||||
cmd: >-
|
cmd: >-
|
||||||
/opt/drone-runner-exec/drone-runner-exec service install
|
/usr/local/bin/drone-runner-exec service install
|
||||||
--config="{{ drone_runner_exec_config_base_path }}/config"
|
--config="{{ drone_runner_exec_config_base_path }}/config"
|
||||||
when: "'drone-runner-exec.service' not in ansible_facts.services"
|
when: "'drone-runner-exec.service' not in ansible_facts.services"
|
||||||
become: true
|
become: true
|
||||||
notify: Redémarrer drone-runner-exec.service
|
notify: Restart drone-runner-exec.service
|
||||||
|
|
||||||
- name: Créer le dossier de surcharge du service
|
- name: Create systemd override directory
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
state: directory
|
state: directory
|
||||||
path: /etc/systemd/system/drone-runner-exec.service.d
|
path: /etc/systemd/system/drone-runner-exec.service.d
|
||||||
mode: u=rwX,g=rX,o=rX
|
mode: u=rwX,g=rX,o=rX
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
- name: Définir l'utilisateur du service
|
- name: Deploy systemd override configuration
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: override.conf.j2
|
src: override.conf.j2
|
||||||
dest: /etc/systemd/system/drone-runner-exec.service.d/override.conf
|
dest: /etc/systemd/system/drone-runner-exec.service.d/override.conf
|
||||||
@ -57,13 +57,3 @@
|
|||||||
mode: u=rwX,g=rX,o=rX
|
mode: u=rwX,g=rX,o=rX
|
||||||
become: true
|
become: true
|
||||||
notify: Redémarrer drone-runner-exec.service
|
notify: Redémarrer drone-runner-exec.service
|
||||||
|
|
||||||
- name: Déployer le script permettant d'exécuter un pipeline depuis une autre
|
|
||||||
ansible.builtin.copy:
|
|
||||||
src: drone-downstream.bash
|
|
||||||
dest: /opt/drone-runner-exec/drone-downstream.bash
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: u=rwx,g=rx,o=rx
|
|
||||||
become: true
|
|
||||||
diff: false
|
|
||||||
|
7
tasks/installation-apt.yml
Normal file
7
tasks/installation-apt.yml
Normal file
@ -0,0 +1,7 @@
|
|||||||
|
---
|
||||||
|
# tasks file for ansible
|
||||||
|
|
||||||
|
- name: Install prerequisites
|
||||||
|
ansible.builtin.apt:
|
||||||
|
name: "{{ drone_runner_exec_prerequisites }}"
|
||||||
|
become: true
|
19
tasks/installation-atomic_container.yml
Normal file
19
tasks/installation-atomic_container.yml
Normal file
@ -0,0 +1,19 @@
|
|||||||
|
---
|
||||||
|
# tasks file for borgmatic
|
||||||
|
|
||||||
|
- name: Install prerequisites
|
||||||
|
ansible.builtin.command:
|
||||||
|
argv: "{{ rpm_ostree + drone_runner_exec_prerequisites }}"
|
||||||
|
creates: /sysroot/ostree/repo/refs/heads/rpmostree/pkg/borgmatic
|
||||||
|
become: true
|
||||||
|
vars:
|
||||||
|
rpm_ostree:
|
||||||
|
- /usr/bin/rpm-ostree
|
||||||
|
- install
|
||||||
|
- --allow-inactive
|
||||||
|
- --assumeyes
|
||||||
|
- --idempotent
|
||||||
|
notify: Apply installation
|
||||||
|
|
||||||
|
- name: Flush handlers
|
||||||
|
meta: flush_handlers
|
@ -1,29 +1,14 @@
|
|||||||
---
|
---
|
||||||
# tasks file for drone_runner_exec
|
# tasks file for drone_runner_exec
|
||||||
|
|
||||||
- name: Installer les prérequis
|
- name: Get version file
|
||||||
ansible.builtin.package:
|
|
||||||
name: "{{ item }}"
|
|
||||||
become: true
|
|
||||||
loop: "{{ drone_runner_exec_prerequisites }}"
|
|
||||||
|
|
||||||
- name: Créer le dossier dédié
|
|
||||||
ansible.builtin.file:
|
|
||||||
path: /opt/drone-runner-exec
|
|
||||||
state: directory
|
|
||||||
owner: root
|
|
||||||
group: root
|
|
||||||
mode: u=rwX,g=rX,o=rX
|
|
||||||
become: true
|
|
||||||
|
|
||||||
- name: Récupérer le contenu du fichier de version
|
|
||||||
ansible.builtin.uri:
|
ansible.builtin.uri:
|
||||||
url: "{{ drone_runner_exec_url }}"
|
url: "{{ drone_runner_exec_url }}"
|
||||||
return_content: true
|
return_content: true
|
||||||
follow_redirects: all
|
follow_redirects: all
|
||||||
register: releases
|
register: releases
|
||||||
|
|
||||||
- name: Extraire l'URL du paquet
|
- name: Extract URL
|
||||||
ansible.builtin.set_fact:
|
ansible.builtin.set_fact:
|
||||||
browser_download_url: >
|
browser_download_url: >
|
||||||
{{
|
{{
|
||||||
@ -33,14 +18,14 @@
|
|||||||
map(attribute='browser_download_url')
|
map(attribute='browser_download_url')
|
||||||
}}
|
}}
|
||||||
|
|
||||||
- name: Extraire le runner
|
- name: Install runner
|
||||||
ansible.builtin.unarchive:
|
ansible.builtin.unarchive:
|
||||||
src: "{{ browser_download_url | first }}"
|
src: "{{ browser_download_url | first }}"
|
||||||
dest: /opt/drone-runner-exec
|
dest: /usr/local/bin/
|
||||||
remote_src: true
|
remote_src: true
|
||||||
list_files: true
|
list_files: true
|
||||||
owner: root
|
owner: "{{ drone_runner_exec_user }}"
|
||||||
group: root
|
group: "{{ drone_runner_exec_group }}"
|
||||||
mode: u=rwX,g=rX,o=rX
|
mode: u=rwX,g=rX,o=rX
|
||||||
become: true
|
become: true
|
||||||
notify: Redémarrer drone-runner-exec.service
|
notify: Restart drone-runner-exec.service
|
@ -1,10 +1,14 @@
|
|||||||
---
|
---
|
||||||
# tasks file for drone_runner_exec
|
# tasks file for drone_runner_exec
|
||||||
|
|
||||||
- name: Importer les tâches d'installation
|
- name: Include installation tasks
|
||||||
tags: installation
|
ansible.builtin.include_tasks:
|
||||||
ansible.builtin.import_tasks: installation.yml
|
file: installation-{{ ansible_facts['pkg_mgr'] }}.yml
|
||||||
|
|
||||||
- name: Importer les tâches de configuration
|
- name: Import service installation tasks
|
||||||
tags: configuration
|
ansible.builtin.import_tasks:
|
||||||
ansible.builtin.import_tasks: configuration.yml
|
file: installation-service.yml
|
||||||
|
|
||||||
|
- name: Import configuration tasks
|
||||||
|
ansible.builtin.import_tasks:
|
||||||
|
file: configuration.yml
|
||||||
|
Loading…
x
Reference in New Issue
Block a user