Skip to content

Commit c38c0de

Browse files
committed
Install fleeting-plugin-openstack directly from GitHub
1 parent 8ef1bb3 commit c38c0de

File tree

3 files changed

+61
-8
lines changed

3 files changed

+61
-8
lines changed

roles/gitlab_runner/defaults/main.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,3 +45,7 @@ gitlab_runner_enable_session_server: false
4545
gitlab_runner_session_server_listen_address: "0.0.0.0:8093"
4646
gitlab_runner_session_server_advertise_address: "{{ gitlab_runner_session_server_listen_address }}"
4747
gitlab_runner_session_server_timeout: 1800
48+
49+
gitlab_runner_autoscaler_plugin_version: "0.21.1"
50+
gitlab_runner_autoscaler_plugin_url: "https://github.com/sardinasystems/fleeting-plugin-openstack/releases/download/{{ gitlab_runner_autoscaler_plugin_version }}/fleeting-plugin-openstack_{{ gitlab_runner_autoscaler_plugin_version }}_linux_amd64.tar.gz"
51+
gitlab_runner_autoscaler_plugin_checksumfile: "https://github.com/sardinasystems/fleeting-plugin-openstack/releases/download/{{ gitlab_runner_autoscaler_plugin_version }}/fleeting-plugin-openstack_{{ gitlab_runner_autoscaler_plugin_version }}_sha512-checksums.txt"

roles/gitlab_runner/tasks/install.autoscaler-plugin.yml

Lines changed: 56 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,62 @@
33
# SPDX-License-Identifier: Apache-2.0
44

55
---
6-
- name: "Download and install autoscaler plugin"
7-
ansible.builtin.get_url:
8-
url: "{{ gitlab_runner_autoscaler_plugin_url }}"
9-
dest: "/usr/local/bin/fleeting-plugin-openstack"
10-
checksum: "{{ gitlab_runner_autoscaler_plugin_checksum }}"
11-
mode: '0755'
12-
owner: "root"
13-
group: "root"
6+
7+
- name: "Check if fleeting-plugin-openstack is installed"
8+
ansible.builtin.stat:
9+
path: "/usr/local/bin/fleeting-plugin-openstack"
10+
register: "_fleeting_plugin_openstack_stat"
11+
12+
- name: "Check version of installed fleeting plugin"
13+
when: "_fleeting_plugin_openstack_stat.stat.exists"
14+
ansible.builtin.shell:
15+
cmd: |
16+
set -o pipefail
17+
strings /usr/local/bin/fleeting-plugin-openstack | grep -oP "(?<=fleeting-plugin-openstack.Version=)(\d+\.\d+\.\d+)" | head -n 1
18+
executable: "/bin/bash"
19+
register: "_fleeting_plugin_version_installed"
20+
changed_when: false
21+
check_mode: false
22+
23+
- name: "Download and install fleeting plugin"
24+
when: "not _fleeting_plugin_openstack_stat.stat.exists or _fleeting_plugin_version_installed.stdout != gitlab_runner_autoscaler_plugin_version"
25+
block:
26+
- name: "Create temporary directory"
27+
ansible.builtin.tempfile:
28+
state: "directory"
29+
register: "tempdir_fleeting_plugin"
30+
check_mode: false
31+
changed_when: false
32+
33+
- name: "Download fleeting-plugin-openstack"
34+
ansible.builtin.get_url:
35+
url: "{{ gitlab_runner_autoscaler_plugin_url }}"
36+
dest: "{{ (tempdir_fleeting_plugin.path, 'fleeting-plugin-openstack.tar.gz') | path_join }}"
37+
checksum: "sha512:{{ gitlab_runner_autoscaler_plugin_checksumfile }}"
38+
owner: "root"
39+
group: "root"
40+
mode: "0600"
41+
check_mode: false
42+
43+
- name: "Extract fleeting-plugin-openstack binary"
44+
ansible.builtin.unarchive:
45+
src: "{{ (tempdir_fleeting_plugin.path, 'fleeting-plugin-openstack.tar.gz') | path_join }}"
46+
dest: "/usr/local/bin/"
47+
include:
48+
- "bin/fleeting-plugin-openstack"
49+
owner: "root"
50+
group: "root"
51+
mode: "0755"
52+
remote_src: true
53+
extra_opts: ['--strip-components=1']
54+
55+
always:
56+
- name: "Remove temporary directory"
57+
ansible.builtin.file:
58+
path: "{{ tempdir_fleeting_plugin.path }}"
59+
state: "absent"
60+
check_mode: false
61+
changed_when: false
1462

1563
- name: "Place clouds.yaml template"
1664
ansible.builtin.template:

roles/gitlab_runner/tasks/install.debianlike.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
- "debian-archive-keyring"
1212
- "apt-transport-https"
1313
- "gnupg"
14+
- "binutils"
1415
state: "present"
1516
update_cache: true
1617

0 commit comments

Comments
 (0)