diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 126718a..4b09dcb 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -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 diff --git a/README.md b/README.md index 810bd80..c493a21 100644 --- a/README.md +++ b/README.md @@ -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 | @@ -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. diff --git a/bin/check-minio-update.rb b/bin/check-minio-update.rb index 4af034f..cf3f3e2 100755 --- a/bin/check-minio-update.rb +++ b/bin/check-minio-update.rb @@ -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? diff --git a/bin/setup b/bin/setup index 8638873..e065753 100755 --- a/bin/setup +++ b/bin/setup @@ -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 diff --git a/lib/sensu/plugins/minio.rb b/lib/sensu/plugins/minio.rb new file mode 100644 index 0000000..6f3cb21 --- /dev/null +++ b/lib/sensu/plugins/minio.rb @@ -0,0 +1,3 @@ +# frozen_string_literal: true + +require 'sensu/plugins/minio/version' diff --git a/spec/check_minio_update_spec.rb b/spec/check_minio_update_spec.rb index 818d3ec..d5301f8 100644 --- a/spec/check_minio_update_spec.rb +++ b/spec/check_minio_update_spec.rb @@ -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 }