Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 4 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,15 @@ jobs:
strategy:
fail-fast: false
matrix:
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7]
ruby-version: [2.3, 2.4, 2.5, 2.6, 2.7, 3.1, 3.2, 3.3, 3.4]
env:
RUBY_VERSION: ${{ matrix.ruby-version }}
steps:
- name: Check out code
uses: actions/checkout@v4

- name: Setup ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
bundler: 1.17.3
bundler-cache: true

- name: Test
run: bundle exec rake
run: make test

- name: Sync README
run: |
Expand Down
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
FROM ruby:2.7.8
ARG RUBY_VERSION=2.3.1
FROM ruby:${RUBY_VERSION}

# Install and use an compatible bundler
ENV BUNDLER_VERSION=1.17.3
RUN gem install bundler -v "${BUNDLER_VERSION}"
ARG BUNDLER_VERSION=1.17.3
ENV BUNDLER_VERSION=${BUNDLER_VERSION}
RUN if [ "${BUNDLER_VERSION}" != "" ] ; then \
gem install bundler -v "${BUNDLER_VERSION}" ; \
fi

# Install required gems before copying in code
# to avoid re-installing gems when developing
Expand All @@ -12,7 +15,7 @@ COPY Gemfile.lock /app
COPY aptible-cli.gemspec /app

# We reference the version, so copy that in, too
CMD mkdir -p /app/lib/aptible/cli/
RUN mkdir -p /app/lib/aptible/cli/
COPY lib/aptible/cli/version.rb /app/lib/aptible/cli/

RUN bundle install
Expand Down
3 changes: 3 additions & 0 deletions Gemfile
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,8 @@ group :test do
gem 'webmock'
end

gem 'aptible-api', git: 'https://github.com/aptible/aptible-api-ruby', branch: 'ext-aws-check'
gem 'aptible-auth', git: 'https://github.com/aptible/aptible-auth-ruby', branch: 'concur-ruby-version-fix'

# Specify your gem's dependencies in aptible-cli.gemspec
gemspec
89 changes: 61 additions & 28 deletions Gemfile.lock
Original file line number Diff line number Diff line change
@@ -1,15 +1,36 @@
GIT
remote: https://github.com/aptible/aptible-api-ruby
revision: 8fe6db7b81c5d6fcbb5b332b58befee1886c2029
branch: ext-aws-check
specs:
aptible-api (1.10.0)
aptible-auth
aptible-resource
gem_config
multipart-post (< 2.2.0)

GIT
remote: https://github.com/aptible/aptible-auth-ruby
revision: e4d569863a6533507ffe7544f3961b8d89f6a520
branch: concur-ruby-version-fix
specs:
aptible-auth (1.3.0)
aptible-resource (~> 1.0)
concurrent-ruby (~> 1.1.9)
gem_config
multipart-post (= 2.1.1)
oauth2 (= 2.0.9)

PATH
remote: .
specs:
aptible-cli (0.25.1)
activesupport (>= 4.0, < 6.0)
aptible-api (~> 1.10.0)
aptible-auth (~> 1.2.5)
aptible-auth (~> 1.3)
aptible-billing (~> 1.0)
aptible-resource (~> 1.1)
aws-eventstream (~> 1.1.1)
aws-sdk (~> 2.0)
aws-sigv4 (~> 1.2.4)
aws-sdk-s3 (~> 1.0)
bigdecimal (~> 1.3.5)
cbor
chronic_duration (~> 0.10.6)
Expand All @@ -35,16 +56,6 @@ GEM
tzinfo (~> 1.1)
addressable (2.8.0)
public_suffix (>= 2.0.2, < 5.0)
aptible-api (1.10.0)
aptible-auth
aptible-resource
gem_config
multipart-post (< 2.2.0)
aptible-auth (1.2.5)
aptible-resource (~> 1.0)
gem_config
multipart-post (= 2.1.1)
oauth2 (= 1.4.7)
aptible-billing (1.0.1)
activesupport (>= 4.0, < 6.0)
aptible-resource (~> 1.0)
Expand All @@ -60,16 +71,26 @@ GEM
rake (>= 10, < 13.0)
rubocop (= 0.42.0)
ast (2.4.2)
aws-eventstream (1.1.1)
aws-sdk (2.11.632)
aws-sdk-resources (= 2.11.632)
aws-sdk-core (2.11.632)
aws-sigv4 (~> 1.0)
jmespath (~> 1.0)
aws-sdk-resources (2.11.632)
aws-sdk-core (= 2.11.632)
aws-sigv4 (1.2.4)
aws-eventstream (1.4.0)
aws-partitions (1.1182.0)
aws-sdk-core (3.237.0)
aws-eventstream (~> 1, >= 1.3.0)
aws-partitions (~> 1, >= 1.992.0)
aws-sigv4 (~> 1.9)
base64
bigdecimal
jmespath (~> 1, >= 1.6.1)
logger
aws-sdk-kms (1.117.0)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sigv4 (~> 1.5)
aws-sdk-s3 (1.203.1)
aws-sdk-core (~> 3, >= 3.234.0)
aws-sdk-kms (~> 1)
aws-sigv4 (~> 1.5)
aws-sigv4 (1.12.1)
aws-eventstream (~> 1, >= 1.0.2)
base64 (0.3.0)
bigdecimal (1.3.5)
cbor (0.5.10.1)
chronic_duration (0.10.6)
Expand All @@ -93,26 +114,31 @@ GEM
git (1.7.0)
rchardet (~> 1.8)
hashdiff (1.1.1)
hashie (5.0.0)
httpclient (2.8.3)
httplog (1.5.0)
rack (>= 1.0)
rainbow (>= 2.0.0)
i18n (0.9.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.5.1)
jwt (2.3.0)
logger (1.7.0)
method_source (1.1.0)
minitest (5.12.0)
multi_json (1.15.0)
multi_xml (0.6.0)
multipart-post (2.1.1)
net-http-persistent (3.1.0)
connection_pool (~> 2.2)
numerizer (0.1.1)
oauth2 (1.4.7)
faraday (>= 0.8, < 2.0)
oauth2 (2.0.9)
faraday (>= 0.17.3, < 3.0)
jwt (>= 1.0, < 3.0)
multi_json (~> 1.3)
multi_xml (~> 0.5)
rack (>= 1.2, < 3)
rack (>= 1.2, < 4)
snaky_hash (~> 2.0)
version_gem (~> 1.1)
parser (2.7.2.0)
ast (~> 2.4.1)
powerpack (0.1.3)
Expand Down Expand Up @@ -146,6 +172,9 @@ GEM
ruby-progressbar (~> 1.7)
unicode-display_width (~> 1.0, >= 1.0.1)
ruby-progressbar (1.13.0)
snaky_hash (2.0.3)
hashie (>= 0.1.0, < 6)
version_gem (>= 1.1.8, < 3)
stripe (4.24.0)
faraday (~> 0.13)
net-http-persistent (~> 3.0)
Expand All @@ -161,6 +190,7 @@ GEM
thread_safe (~> 0.1)
unicode-display_width (1.8.0)
uri_template (0.7.0)
version_gem (1.1.9)
webmock (3.16.2)
addressable (>= 2.8.0)
crack (>= 0.3.2)
Expand All @@ -171,11 +201,14 @@ PLATFORMS

DEPENDENCIES
activesupport (~> 4.0)
aptible-api!
aptible-auth!
aptible-cli!
aptible-tasks (~> 0.5.8)
bundler (~> 1.3)
climate_control (= 0.0.3)
fabrication (~> 2.15.2)
httplog (< 1.6)
pry
rack (~> 1.0)
rake
Expand Down
52 changes: 50 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,58 @@

export COMPOSE_IGNORE_ORPHANS ?= true
export RUBY_VERSION ?= 2.3.1
RUBY_VERSION_MAJOR = $(word 1,$(subst ., ,$(RUBY_VERSION)))
export BUNDLER_VERSION ?=
ifeq ($(BUNDLER_VERSION),)
ifeq ($(RUBY_VERSION_MAJOR),2)
export BUNDLER_VERSION = 1.17.3
endif
endif
export COMPOSE_PROJECT_NAME ?= aptible-cli-$(subst .,_,$(RUBY_VERSION))

## Build and pull docker compose images
build:
docker compose build --pull

## Open shell in a docker container, supports CMD=
bash: build
docker compose run cli bash
$(MAKE) run CMD=bash

CMD ?= bash
## Run command in a docker container, supports CMD=
run:
docker compose run cli $(CMD)

## Run tests in a docker container, supports ARGS=
test: build
docker compose run cli bundle exec rake
$(MAKE) test-direct ARGS="$(ARGS)"

## Run tests in a docker container without building, supports ARGS=
test-direct:
docker compose run cli bundle exec rake $(ARGS)

## Run rubocop in a docker container, supports ARGS=
lint: build
$(MAKE) lint-direct ARGS="$(ARGS)"

## Run rubocop in a docker container without building, supports ARGS=
lint-direct:
docker compose run cli bundle exec rake rubocop $(ARGS)

## Clean up docker compose resources
clean:
docker compose down --remove-orphans --volumes

## Alias for clean
down: clean

## Show this help message
help:
@echo "\n\033[1;34mAvailable targets:\033[0m\n"
@awk 'BEGIN {FS = ":"; prev = ""} \
/^## / {prev = substr($$0, 4); next} \
/^[a-zA-Z_-]+:/ {if (prev != "") printf " \033[1;36m%-20s\033[0m %s\n", $$1, prev; prev = ""} \
{prev = ""}' $(MAKEFILE_LIST) | sort
@echo

.PHONY: build bash test
7 changes: 3 additions & 4 deletions aptible-cli.gemspec
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,10 @@ Gem::Specification.new do |spec|

spec.add_dependency 'activesupport', '>= 4.0', '< 6.0'
spec.add_dependency 'aptible-api', '~> 1.10.0'
spec.add_dependency 'aptible-auth', '~> 1.2.5'
spec.add_dependency 'aptible-auth', '~> 1.3'
spec.add_dependency 'aptible-billing', '~> 1.0'
spec.add_dependency 'aptible-resource', '~> 1.1'
spec.add_dependency 'aws-eventstream', '~> 1.1.1'
spec.add_dependency 'aws-sdk', '~> 2.0'
spec.add_dependency 'aws-sigv4', '~> 1.2.4'
spec.add_dependency 'aws-sdk-s3', '~> 1.0'
spec.add_dependency 'bigdecimal', '~> 1.3.5' # https://github.com/ruby/bigdecimal#which-version-should-you-select
spec.add_dependency 'cbor'
spec.add_dependency 'chronic_duration', '~> 0.10.6'
Expand All @@ -54,4 +52,5 @@ Gem::Specification.new do |spec|
spec.add_development_dependency 'pry'
spec.add_development_dependency 'climate_control', '= 0.0.3'
spec.add_development_dependency 'fabrication', '~> 2.15.2'
spec.add_development_dependency 'httplog', '< 1.6'
end
6 changes: 5 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
services:
cli:
build: .
build:
context: .
args:
RUBY_VERSION: ${RUBY_VERSION:-2.3.1}
BUNDLER_VERSION: ${BUNDLER_VERSION:-}
volumes:
- type: bind
source: .
Expand Down
4 changes: 4 additions & 0 deletions lib/aptible/cli/agent.rb
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,10 @@ def initialize(*)
level = Logger::WARN
debug_level = ENV['APTIBLE_DEBUG']
level = debug_level if debug_level
require 'httplog' if ENV['BUNDLER_VERSION'] && \
ENV['APTIBLE_LOG_HTTP_REQUEST_RESPONSE'] && \
!ENV['APTIBLE_LOG_HTTP_REQUEST_RESPONSE'] \
.downcase.start_with?('f')
conf.logger.tap { |l| l.level = level }
end
warn_sso_enforcement
Expand Down
Loading
Loading