From 094284bbcbce888a8524ceced256766fc26d2991 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 5 Dec 2025 03:08:39 -0800 Subject: [PATCH 01/12] external aws account check! endpoint --- lib/aptible/api/external_aws_account.rb | 17 +++++++++++++++++ .../api/external_aws_account_check_response.rb | 6 ++++++ lib/aptible/api/resource.rb | 1 + 3 files changed, 24 insertions(+) create mode 100644 lib/aptible/api/external_aws_account_check_response.rb diff --git a/lib/aptible/api/external_aws_account.rb b/lib/aptible/api/external_aws_account.rb index ef6876e..04c46e2 100644 --- a/lib/aptible/api/external_aws_account.rb +++ b/lib/aptible/api/external_aws_account.rb @@ -26,6 +26,23 @@ def organization auth = Aptible::Auth::Organization.new(token: token, headers: headers) @organization = auth.find_by_url(organization_url) end + + def check! + response = HyperResource::Link.new( + self, + 'href' => "#{href}/check" + ).get + ExternalAwsAccountCheckResponse.new( + state: response.attributes['state'], + checks: (response.attributes['checks'] || []).map do |c| + ExternalAwsAccountCheck.new( + check_name: c['check_name'], + state: c['state'], + details: c['details'] + ) + end + ) + end end end end diff --git a/lib/aptible/api/external_aws_account_check_response.rb b/lib/aptible/api/external_aws_account_check_response.rb new file mode 100644 index 0000000..194ac18 --- /dev/null +++ b/lib/aptible/api/external_aws_account_check_response.rb @@ -0,0 +1,6 @@ +module Aptible + module Api + ExternalAwsAccountCheckResponse = Struct.new("ExternalAwsAccountCheckResponse", :state, :checks, keyword_init: true) + ExternalAwsAccountCheck = Struct.new("ExternalAwsAccountCheck", :check_name, :state, :details, keyword_init: true) + end +end diff --git a/lib/aptible/api/resource.rb b/lib/aptible/api/resource.rb index f4add09..8fa06e8 100644 --- a/lib/aptible/api/resource.rb +++ b/lib/aptible/api/resource.rb @@ -57,5 +57,6 @@ def root_url require 'aptible/api/disk_attachment' require 'aptible/api/maintenance' require 'aptible/api/vpn_tunnel' +require 'aptible/api/external_aws_account_check_response' require 'aptible/api/external_aws_account' require 'aptible/api/external_aws_resource' From 8299f5ae09bebf78e5dd33caf689e0b8e7289ab2 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Thu, 11 Dec 2025 13:25:31 -0800 Subject: [PATCH 02/12] lint roller --- lib/aptible/api/external_aws_account_check_response.rb | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/lib/aptible/api/external_aws_account_check_response.rb b/lib/aptible/api/external_aws_account_check_response.rb index 194ac18..38d4337 100644 --- a/lib/aptible/api/external_aws_account_check_response.rb +++ b/lib/aptible/api/external_aws_account_check_response.rb @@ -1,6 +1,10 @@ module Aptible module Api - ExternalAwsAccountCheckResponse = Struct.new("ExternalAwsAccountCheckResponse", :state, :checks, keyword_init: true) - ExternalAwsAccountCheck = Struct.new("ExternalAwsAccountCheck", :check_name, :state, :details, keyword_init: true) + ExternalAwsAccountCheckResponse = Struct.new( + 'ExternalAwsAccountCheckResponse', :state, :checks, keyword_init: true + ) + ExternalAwsAccountCheck = Struct.new( + 'ExternalAwsAccountCheck', :check_name, :state, :details, keyword_init: true + ) end end From fde098494f494174a8ce6aee77e6903f8b2f81a4 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:51:04 -0800 Subject: [PATCH 03/12] rm bundler version from ci.yml to match https://github.com/aptible/aptible-auth-ruby/pull/82 --- .github/workflows/ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5cab9e8..6ffc2a3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,10 +25,9 @@ jobs: persist-credentials: false - name: Install Ruby - uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0 + uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0 with: ruby-version: ${{ matrix.RUBY_VERSION }} - bundler: 1.17.3 - name: Bundle install run: bundle install From 789b46634c9d2f81a34436bea829e7f3f07add46 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 16:54:39 -0800 Subject: [PATCH 04/12] Revert "rm bundler version from ci.yml" This reverts commit fde098494f494174a8ce6aee77e6903f8b2f81a4. ruby versions 2.1 - 2... don't work without the earlier bundler. womp womp --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6ffc2a3..5cab9e8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,9 +25,10 @@ jobs: persist-credentials: false - name: Install Ruby - uses: ruby/setup-ruby@d697be2f83c6234b20877c3b5eac7a7f342f0d0c # v1.269.0 + uses: ruby/setup-ruby@d5126b9b3579e429dd52e51e68624dda2e05be25 # v1.267.0 with: ruby-version: ${{ matrix.RUBY_VERSION }} + bundler: 1.17.3 - name: Bundle install run: bundle install From e8ab5da6be23df15dd1841f662ef43cf31adab08 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:20:53 -0800 Subject: [PATCH 05/12] Struct does not support keyword init args until ruby 2.5, so use simple classes instead --- .../external_aws_account_check_response.rb | 24 ++++++++++++++----- 1 file changed, 18 insertions(+), 6 deletions(-) diff --git a/lib/aptible/api/external_aws_account_check_response.rb b/lib/aptible/api/external_aws_account_check_response.rb index 38d4337..6f1d8cb 100644 --- a/lib/aptible/api/external_aws_account_check_response.rb +++ b/lib/aptible/api/external_aws_account_check_response.rb @@ -1,10 +1,22 @@ module Aptible module Api - ExternalAwsAccountCheckResponse = Struct.new( - 'ExternalAwsAccountCheckResponse', :state, :checks, keyword_init: true - ) - ExternalAwsAccountCheck = Struct.new( - 'ExternalAwsAccountCheck', :check_name, :state, :details, keyword_init: true - ) + class ExternalAwsAccountCheckResponse + attr_reader :state, :checks + + def initialize(state:, checks:) + @state = state + @checks = checks + end + end + + class ExternalAwsAccountCheck + attr_reader :check_name, :state, :details + + def initialize(check_name:, state:, details:) + @check_name = check_name + @state = state + @details = details + end + end end end From a118e0a5dfe1e447bf43498d1f98a0845ed995ff Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:21:25 -0800 Subject: [PATCH 06/12] ensure tests work even if APTIBLE_API_ROOT_URL env var is set --- spec/aptible/api_spec.rb | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/spec/aptible/api_spec.rb b/spec/aptible/api_spec.rb index fcafc9c..19fd1d3 100644 --- a/spec/aptible/api_spec.rb +++ b/spec/aptible/api_spec.rb @@ -6,12 +6,17 @@ it 'should have a configurable root_url' do config = described_class.configuration expect(config).to be_a GemConfig::Configuration - expect(config.root_url).to eq 'https://api.aptible.com' + with_env 'APTIBLE_API_ROOT_URL', nil do + load 'aptible/api.rb' + config.reset + expect(config.root_url).to eq 'https://api.aptible.com' + end end - pending 'uses ENV["APTIBLE_API_ROOT_URL"] if defined' do + it 'uses ENV["APTIBLE_API_ROOT_URL"] if defined' do config = described_class.configuration with_env 'APTIBLE_API_ROOT_URL', 'http://foobar.com' do + load 'aptible/api.rb' config.reset expect(config.root_url).to eq 'http://foobar.com' end From b7a79253a532c4e0af2be2335241c2b4862e382b Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:37:37 -0800 Subject: [PATCH 07/12] does this make ci happy? --- .rubocop.yml | 3 +++ 1 file changed, 3 insertions(+) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..b337b39 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,3 @@ +AllCops: + TargetRubyVersion: 2.3 + NewCops: enable From 51b14524f83debceb2e53c4525d4a744f27af895 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Fri, 12 Dec 2025 18:51:15 -0800 Subject: [PATCH 08/12] it did not --- .rubocop.yml | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index b337b39..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,3 +0,0 @@ -AllCops: - TargetRubyVersion: 2.3 - NewCops: enable From 8fe6db7b81c5d6fcbb5b332b58befee1886c2029 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Sat, 13 Dec 2025 00:03:20 -0800 Subject: [PATCH 09/12] =?UTF-8?q?ok=20maybe=20this=20will=20fix=20ci=20?= =?UTF-8?q?=F0=9F=A4=9E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .rubocop.yml | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml new file mode 100644 index 0000000..920dff6 --- /dev/null +++ b/.rubocop.yml @@ -0,0 +1,5 @@ +inherit_gem: + aptible-tasks: .rubocop.yml + +AllCops: + TargetRubyVersion: 2.2 From c746b637dcb9a1c8e1548b1bbeac511f45ce18a9 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Tue, 16 Dec 2025 10:41:56 -0800 Subject: [PATCH 10/12] we do not support 2.1 and 2.2 anymore... --- .rubocop.yml | 5 ----- 1 file changed, 5 deletions(-) delete mode 100644 .rubocop.yml diff --git a/.rubocop.yml b/.rubocop.yml deleted file mode 100644 index 920dff6..0000000 --- a/.rubocop.yml +++ /dev/null @@ -1,5 +0,0 @@ -inherit_gem: - aptible-tasks: .rubocop.yml - -AllCops: - TargetRubyVersion: 2.2 From 0367fdcd8e998ffbc7de70d1ac19aeb2f6479b95 Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Tue, 16 Dec 2025 20:34:53 -0800 Subject: [PATCH 11/12] bump version 1.10.1 --> 1.11.0 --- lib/aptible/api/version.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/aptible/api/version.rb b/lib/aptible/api/version.rb index 42ddc08..e73c649 100644 --- a/lib/aptible/api/version.rb +++ b/lib/aptible/api/version.rb @@ -1,5 +1,5 @@ module Aptible module Api - VERSION = '1.10.1'.freeze + VERSION = '1.11.0'.freeze end end From a993c06e3ff663255045a47db94865b48df4eaed Mon Sep 17 00:00:00 2001 From: T Van Doren <210452321+tvdaptible@users.noreply.github.com> Date: Tue, 16 Dec 2025 22:06:08 -0800 Subject: [PATCH 12/12] chore: use bundler 2.x with ruby 2.7 this seems to be a known issue: https://gitlab.com/gitlab-org/gitlab/-/issues/337510 --- Makefile | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Makefile b/Makefile index 09eccf4..0e1cad5 100644 --- a/Makefile +++ b/Makefile @@ -2,12 +2,18 @@ export COMPOSE_IGNORE_ORPHANS ?= true export RUBY_VERSION ?= 2.3.1 RUBY_VERSION_MAJOR = $(word 1,$(subst ., ,$(RUBY_VERSION))) +RUBY_VERSION_MINOR = $(word 2,$(subst ., ,$(RUBY_VERSION))) export BUNDLER_VERSION ?= ifeq ($(BUNDLER_VERSION),) ifeq ($(RUBY_VERSION_MAJOR),2) +# Use old bundler for Ruby 2.3-2.6; Ruby 2.7 needs bundler 2.x to avoid resolver bugs +ifeq ($(RUBY_VERSION_MINOR),7) +export BUNDLER_VERSION = 2.4.22 +else export BUNDLER_VERSION = 1.17.3 endif endif +endif PROJECT_NAME = $(shell ls *.gemspec | sed 's/\.gemspec//') export COMPOSE_PROJECT_NAME ?= $(PROJECT_NAME)-$(subst .,_,$(RUBY_VERSION))