Skip to content

Commit 9735985

Browse files
Improve server version detection (#9)
* Update setup instructions. * Improve server version detection. https://trello.com/c/JUtcafnV/6223-1-minio-update-stabilisieren-opsmaintenance6223jutcafnv * We only need ruby 2.7.0 support (ubuntu 20.04) * FIx rubocop. * Enable usage of bin/console * Improve install howto for arch AUR packages. Co-authored-by: Jonathan Schlue <49396111+jonathanschlue-as@users.noreply.github.com> --------- Co-authored-by: Jonathan Schlue <jonathan.schlue@aboutsource.net> Co-authored-by: Jonathan Schlue <49396111+jonathanschlue-as@users.noreply.github.com>
1 parent c6ae101 commit 9735985

6 files changed

Lines changed: 25 additions & 11 deletions

File tree

.github/workflows/main.yml

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,13 @@ jobs:
1313
test:
1414

1515
runs-on: ubuntu-latest
16-
strategy:
17-
matrix:
18-
ruby-version: ['2.3.3', '2.5.1', '2.7.0']
1916

2017
steps:
2118
- uses: actions/checkout@v3
2219
- name: Set up Ruby
2320
uses: ruby/setup-ruby@v1
2421
with:
25-
ruby-version: ${{ matrix.ruby-version }}
22+
ruby-version: '2.7.0'
2623
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
2724
- name: Lint
2825
run: bundle exec rubocop

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,9 +24,9 @@ Check if a the local minio version is in the most recent version
2424

2525
### Optional parameters
2626

27-
Checks will check the default URL https://dl.min.io/server/minio/release
28-
and the default Platform linux-amd64 for updates. Adjust these optional
29-
parameters if you want to check a different platform or for whatever
27+
Checks will check the default URL https://dl.min.io/server/minio/release
28+
and the default Platform linux-amd64 for updates. Adjust these optional
29+
parameters if you want to check a different platform or for whatever
3030
reason need to check a different URL.
3131

3232
| Parameter | Description |
@@ -42,7 +42,20 @@ reason need to check a different URL.
4242

4343
## Development
4444

45-
After checking out the repo, run `bin/setup` to install dependencies. You can
45+
Install rbenv and ruby-build to get a ruby 2.7.x on your system (running on ubuntu 20.04).
46+
47+
yay -S rbenv ruby-build
48+
49+
Add the rbenv shell extension (`eval "$(rbenv init -)"`) to your shell config (e.g. `~/.zshrc`) and install ruby 2.7.0
50+
51+
rbenv install 2.7.0
52+
53+
After checking out the repo verify, that your system is using the 2.7.0 ruby:
54+
55+
# rbenv version
56+
2.7.0 (set by ..../sensu-plugins-minio/.ruby-version)
57+
58+
Run `bin/setup` to install dependencies. You can
4659
also run `bin/console` for an interactive prompt that will allow you to
4760
experiment.
4861

bin/check-minio-update.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -72,7 +72,7 @@ def latest_version
7272
def local_version
7373
@local_version ||= begin
7474
stdout, stderr, status = Open3.capture3(
75-
{ 'PATH' => ENV['PATH'] }, 'minio --version', unsetenv_others: true
75+
{ 'PATH' => ENV['PATH'] }, 'journalctl --boot --unit minio | grep "Version: RELEASE" | tail -n 1', unsetenv_others: true # rubocop:disable Layout/LineLength
7676
)
7777

7878
unless status.success?

bin/setup

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ set -euo pipefail
33
IFS=$'\n\t'
44
set -vx
55

6-
bundle install --path vendor/bundle
6+
bundle config set path vendor/bundle
7+
bundle install
78

89
# Do any other automated setup that you need to do here

lib/sensu/plugins/minio.rb

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# frozen_string_literal: true
2+
3+
require 'sensu/plugins/minio/version'

spec/check_minio_update_spec.rb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@
3838
end
3939

4040
let(:stdout) do
41-
'minio version RELEASE.2022-07-17T15-43-14Z (commit-id=1b339ea062b423f1c6fbeb02116d020d18418917)' # rubocop:disable Layout/LineLength
41+
'Mar 25 07:37:03 weact-staging-db-07 minio[220013]: Version: RELEASE.2022-07-17T15-43-14Z (go1.21.8 linux/amd64)' # rubocop:disable Layout/LineLength
4242
end
4343

4444
let(:stderr) { nil }

0 commit comments

Comments
 (0)