feat(archive): allowing archive options to be overridable

This commit is contained in:
Corey Hammerton 2022-09-02 10:14:00 -04:00
parent 2cb8316edb
commit 2f52af7e18
5 changed files with 43 additions and 1 deletions

View File

@ -47,7 +47,6 @@ prometheus-archive-install-{{ name }}:
{{- format_kwargs(p.pkg.component[name]['archive']) }}
- trim_output: true
- enforce_toplevel: false
- options: --strip-components=1
- force: {{ p.force }}
- retry: {{ p.retry_option|json }}
- require:

View File

@ -29,6 +29,7 @@
{%- for name,v in p.pkg.component.items() %}
{%- set url = None %}
{%- set dir = name %}
{%- do p.pkg.component[name].get('archive', {}).setdefault('options', '--strip-components=1') %}
{%- if 'version' in v and v.version and 'archive' in v and v.archive and 'uri' in p.pkg %}
{%- set uri = '%s/%s/releases/download/%s/%s'|format(p.pkg.uri, name, v.version, name) %}
{%- set url = '%s-%s.%s-%s.tar.gz'|format(uri, v.version|replace('v',''), p.kernel, p.arch) %}

View File

@ -53,6 +53,12 @@ control 'prometheus components' do
describe user('mysqld_exporter') do
it { should exist }
end
describe group('prometheus_bigquery_remote_st...') do
it { should exist }
end
describe user('prometheus_bigquery_remote_st...') do
it { should exist }
end
describe directory('/var/lib/prometheus') do
it { should exist }
end
@ -157,6 +163,23 @@ control 'prometheus components' do
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
end
describe directory('/opt/prometheus/prometheus_bigquery_remote_storage_adapter-v0.4.6') do # rubocop:disable Layout/LineLength
it { should exist }
its('group') { should eq 'root' }
end
describe file('/opt/prometheus/prometheus_bigquery_remote_storage_adapter-v0.4.6/prometheus_bigquery_remote_storage_adapter') do # rubocop:disable Layout/LineLength
it { should exist }
its('group') { should eq 'root' }
end
describe directory('/var/lib/prometheus/prometheus_bigquery_remote_storage_adapter') do # rubocop:disable Layout/LineLength
it { should exist }
its('group') { should eq 'prometheus_bigquery_remote_st...' }
end
describe file("#{service_dir}/prometheus-bigquery-backend.service") do
it { should exist }
its('group') { should eq 'root' }
its('mode') { should cmp '0644' }
end
describe file('/usr/local/sbin/alertmanager') do
it { should exist }

View File

@ -11,6 +11,7 @@ control 'services with a consistent service name on each distro' do
prometheus-alertmanager
prometheus-node-exporter
prometheus-blackbox-exporter
prometheus-bigquery-backend
]
else
%w[
@ -18,6 +19,7 @@ control 'services with a consistent service name on each distro' do
alertmanager
node_exporter
blackbox_exporter
prometheus-bigquery-backend
]
end

View File

@ -20,6 +20,7 @@ prometheus:
- postgres_exporter
- mysqld_exporter
- memcached_exporter # not in upstream repo, only archive
- prometheus_bigquery_remote_storage_adapter
exporters:
node_exporter:
@ -218,6 +219,22 @@ prometheus:
source: https://github.com/wrouesnel/postgres_exporter/releases/download/v0.8.0/postgres_exporter_v0.8.0_linux-amd64.tar.gz
skip_verify: true
prometheus_bigquery_remote_storage_adapter:
version: v0.4.6
service:
name: prometheus-bigquery-backend
env:
- "PROMBQ_DATASET=prometheus"
- "PROMBQ_TABLE=metrics_stream"
- "PROMBQ_GCP_PROJECT_ID=foobar"
archive:
official: false
name: /opt/prometheus/prometheus_bigquery_remote_storage_adapter
options: "--strip-components=0"
source: https://github.com/KohlsTechnology/prometheus_bigquery_remote_storage_adapter/releases/download/v0.4.6/prometheus_bigquery_remote_storage_adapter_0.4.6_Linux_x86_64.tar.gz # noqa: 204
source_hash: https://github.com/KohlsTechnology/prometheus_bigquery_remote_storage_adapter/releases/download/v0.4.6/checksums.txt
source_hash_name: prometheus_bigquery_remote_storage_adapter_0.4.6_Linux_x86_64.tar.gz
linux:
# 'Alternatives system' priority: zero disables (default)
# yamllint disable-line rule:braces