Skip to content

Commit

Permalink
Improve server version detection (#9)
Browse files Browse the repository at this point in the history
* 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>
  • Loading branch information
3 people authored Mar 26, 2024
1 parent c6ae101 commit 9735985
Show file tree
Hide file tree
Showing 6 changed files with 25 additions and 11 deletions.
5 changes: 1 addition & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,13 @@ jobs:
test:

runs-on: ubuntu-latest
strategy:
matrix:
ruby-version: ['2.3.3', '2.5.1', '2.7.0']

steps:
- uses: actions/checkout@v3
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
ruby-version: '2.7.0'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
- name: Lint
run: bundle exec rubocop
Expand Down
21 changes: 17 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ Check if a the local minio version is in the most recent version

### Optional parameters

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

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

## Development

After checking out the repo, run `bin/setup` to install dependencies. You can
Install rbenv and ruby-build to get a ruby 2.7.x on your system (running on ubuntu 20.04).

yay -S rbenv ruby-build

Add the rbenv shell extension (`eval "$(rbenv init -)"`) to your shell config (e.g. `~/.zshrc`) and install ruby 2.7.0

rbenv install 2.7.0

After checking out the repo verify, that your system is using the 2.7.0 ruby:

# rbenv version
2.7.0 (set by ..../sensu-plugins-minio/.ruby-version)

Run `bin/setup` to install dependencies. You can
also run `bin/console` for an interactive prompt that will allow you to
experiment.

Expand Down
2 changes: 1 addition & 1 deletion bin/check-minio-update.rb
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ def latest_version
def local_version
@local_version ||= begin
stdout, stderr, status = Open3.capture3(
{ 'PATH' => ENV['PATH'] }, 'minio --version', unsetenv_others: true
{ 'PATH' => ENV['PATH'] }, 'journalctl --boot --unit minio | grep "Version: RELEASE" | tail -n 1', unsetenv_others: true # rubocop:disable Layout/LineLength
)

unless status.success?
Expand Down
3 changes: 2 additions & 1 deletion bin/setup
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ set -euo pipefail
IFS=$'\n\t'
set -vx

bundle install --path vendor/bundle
bundle config set path vendor/bundle
bundle install

# Do any other automated setup that you need to do here
3 changes: 3 additions & 0 deletions lib/sensu/plugins/minio.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# frozen_string_literal: true

require 'sensu/plugins/minio/version'
2 changes: 1 addition & 1 deletion spec/check_minio_update_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
end

let(:stdout) do
'minio version RELEASE.2022-07-17T15-43-14Z (commit-id=1b339ea062b423f1c6fbeb02116d020d18418917)' # rubocop:disable Layout/LineLength
'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
end

let(:stderr) { nil }
Expand Down

0 comments on commit 9735985

Please sign in to comment.