From 1a2a79c28a861a507ef9a0bac62845ea626565b1 Mon Sep 17 00:00:00 2001 From: Karan Thukral Date: Wed, 13 Jan 2021 10:31:23 -0500 Subject: [PATCH 1/4] Update to ruby 2.6.6 --- dev.yml | 2 +- krane.gemspec | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/dev.yml b/dev.yml index 43ccd8e7e..02ce3774b 100644 --- a/dev.yml +++ b/dev.yml @@ -1,7 +1,7 @@ --- name: krane up: - - ruby: 2.5.7 # Matches gemspec + - ruby: 2.6.6 # Matches gemspec - bundler - homebrew: - homebrew/cask/minikube diff --git a/krane.gemspec b/krane.gemspec index e90c10dae..87d09371a 100644 --- a/krane.gemspec +++ b/krane.gemspec @@ -25,7 +25,7 @@ Gem::Specification.new do |spec| spec.metadata['allowed_push_host'] = "https://rubygems.org" - spec.required_ruby_version = '>= 2.5.0' + spec.required_ruby_version = '>= 2.6.0' spec.add_dependency("activesupport", ">= 5.0") spec.add_dependency("kubeclient", "~> 4.3") spec.add_dependency("googleauth", "~> 0.8") From 17642244562590249167c4f77e8351a1c39d5019 Mon Sep 17 00:00:00 2001 From: Karan Thukral Date: Wed, 13 Jan 2021 10:32:33 -0500 Subject: [PATCH 2/4] Update CI default test to use ruby 2.6 --- .shopify-build/krane.yml | 2 +- bin/ci | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.shopify-build/krane.yml b/.shopify-build/krane.yml index f31274c8c..def2d4e11 100644 --- a/.shopify-build/krane.yml +++ b/.shopify-build/krane.yml @@ -1,6 +1,6 @@ containers: default: - docker: circleci/ruby:2.5.7 + docker: circleci/ruby:2.6.6 steps: - label: Lint diff --git a/bin/ci b/bin/ci index a144f1bec..68773d77b 100755 --- a/bin/ci +++ b/bin/ci @@ -16,5 +16,5 @@ docker run --rm \ -e VERBOSE=1 \ -e PARALLELISM=$PARALLELISM \ -w /usr/src/app \ - ruby:"${RUBY_VERSION:-2.5}" \ + ruby:"${RUBY_VERSION:-2.6.6}" \ bin/test From 031dd7f2586f8aa67a767c2e77822ffe28e7ad9e Mon Sep 17 00:00:00 2001 From: Karan Thukral Date: Wed, 13 Jan 2021 13:23:14 -0500 Subject: [PATCH 3/4] Update readme and changelog --- CHANGELOG.md | 3 +++ README.md | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index a078763ab..a5f269f1b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## next +*Other* +- Dropped support for Ruby 2.5 since it will be EoL shortly. [#782](https://github.com/Shopify/krane/pull/782). + ## 2.1.3 - Add version exception for ServiceNetworkEndpointGroup (GKE resource) [#768](https://github.com/Shopify/krane/pull/768) diff --git a/README.md b/README.md index a8a6c2d75..5e29479db 100644 --- a/README.md +++ b/README.md @@ -73,7 +73,7 @@ If you need the ability to render dynamic values in templates before deploying, ## Prerequisites -* Ruby 2.5+ +* Ruby 2.6+ * Your cluster must be running Kubernetes v1.15.0 or higher1 1 We run integration tests against these Kubernetes versions. You can find our From ec09ca39f558e389e95b0d96725449d42da5a3eb Mon Sep 17 00:00:00 2001 From: Karan Thukral Date: Wed, 13 Jan 2021 16:07:24 -0500 Subject: [PATCH 4/4] Add CI for ruby 3.0 --- .shopify-build/krane.yml | 7 ++++--- CHANGELOG.md | 2 +- test/helpers/fixture_sets/ejson_cloud.rb | 3 ++- test/unit/krane/kubernetes_resource_test.rb | 15 ++++++++++----- 4 files changed, 17 insertions(+), 10 deletions(-) diff --git a/.shopify-build/krane.yml b/.shopify-build/krane.yml index def2d4e11..db75df202 100644 --- a/.shopify-build/krane.yml +++ b/.shopify-build/krane.yml @@ -8,21 +8,22 @@ steps: run: - bundle: ~ - bundle exec rubocop - - label: 'Run Test Suite (:kubernetes: 1.20-latest :ruby: 2.7)' + - label: 'Run Test Suite (:kubernetes: 1.20-latest :ruby: 3.0)' command: bin/ci agents: queue: k8s-ci env: LOGGING_LEVEL: "4" KUBERNETES_VERSION: v1.20-latest - RUBY_VERSION: "2.7" - - label: 'Run Test Suite (:kubernetes: 1.19-latest)' + RUBY_VERSION: "3.0" + - label: 'Run Test Suite (:kubernetes: 1.19-latest :ruby: 2.7)' command: bin/ci agents: queue: k8s-ci env: LOGGING_LEVEL: "4" KUBERNETES_VERSION: v1.19-latest + RUBY_VERSION: "2.7" - label: 'Run Test Suite (:kubernetes: 1.18-latest)' command: bin/ci agents: diff --git a/CHANGELOG.md b/CHANGELOG.md index a5f269f1b..f61aa31ce 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,7 +1,7 @@ ## next *Other* -- Dropped support for Ruby 2.5 since it will be EoL shortly. [#782](https://github.com/Shopify/krane/pull/782). +- Dropped support for Ruby 2.5 due to EoL. [#782](https://github.com/Shopify/krane/pull/782). ## 2.1.3 diff --git a/test/helpers/fixture_sets/ejson_cloud.rb b/test/helpers/fixture_sets/ejson_cloud.rb index d18d160bd..85fca9b4b 100644 --- a/test/helpers/fixture_sets/ejson_cloud.rb +++ b/test/helpers/fixture_sets/ejson_cloud.rb @@ -44,7 +44,8 @@ def assert_all_secrets_present token_data = { "api-token" => "this-is-the-api-token", "service" => "Datadog" } # Impt: it isn't _service: Datadog assert_secret_present("monitoring-token", token_data) - assert_secret_present("unused-secret", "this-is-for-testing-deletion" => "true") + token_data = { "this-is-for-testing-deletion" => "true" } + assert_secret_present("unused-secret", token_data) end def assert_web_resources_up diff --git a/test/unit/krane/kubernetes_resource_test.rb b/test/unit/krane/kubernetes_resource_test.rb index 570b8ae6d..f711ac8f2 100644 --- a/test/unit/krane/kubernetes_resource_test.rb +++ b/test/unit/krane/kubernetes_resource_test.rb @@ -177,11 +177,16 @@ def test_validate_definition_doesnt_log_raw_output_for_sensitive_resources resource = DummySensitiveResource.new kubectl.expects(:server_version).returns(Gem::Version.new('1.20')) - kubectl.expects(:run).with { |*_args, **kwargs| kwargs[:output_is_sensitive] == true }.returns([ - "Some Raw Output", - "Error from kubectl: something went wrong and by the way here's your secret: S3CR3T", - stub(success?: false), - ]) + kubectl.expects(:run) + .with('apply', '-f', "/tmp/foo/bar", "--dry-run=server", '--output=name', { + log_failure: false, output_is_sensitive: true, + retry_whitelist: [:client_timeout, :empty, :context_deadline], attempts: 3 + }) + .returns([ + "Some Raw Output", + "Error from kubectl: something went wrong and by the way here's your secret: S3CR3T", + stub(success?: false), + ]) resource.validate_definition(kubectl) refute_includes(resource.validation_error_msg, 'S3CR3T') end