-
Notifications
You must be signed in to change notification settings - Fork 1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Raise unsupported error when package manager is not supported before …
…update starting update process (#10794) * Raise unsupported error when package manager is not supported before update starting update process --------- Co-authored-by: Kamil Bukum <kbukum1@github.com>
- Loading branch information
1 parent
5751b3d
commit 7f120c2
Showing
15 changed files
with
197 additions
and
43 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,45 @@ | ||
# typed: strong | ||
# frozen_string_literal: true | ||
|
||
require "sorbet-runtime" | ||
require "dependabot/silent/version" | ||
require "dependabot/package_manager" | ||
|
||
module Dependabot | ||
module Silent | ||
PACKAGE_MANAGER = "silent" | ||
|
||
SUPPORTED_SILENT_VERSIONS = T.let([Version.new("2")].freeze, T::Array[Dependabot::Version]) | ||
DEPRECATED_SILENT_VERSIONS = T.let([Version.new("1")].freeze, T::Array[Dependabot::Version]) | ||
|
||
class PackageManager < PackageManagerBase | ||
extend T::Sig | ||
|
||
sig { params(version: T.any(String, Dependabot::Version)).void } | ||
def initialize(version) | ||
@version = T.let(Version.new(version), Dependabot::Version) | ||
@name = T.let(PACKAGE_MANAGER, String) | ||
@deprecated_versions = T.let(DEPRECATED_SILENT_VERSIONS, T::Array[Dependabot::Version]) | ||
@supported_versions = T.let(SUPPORTED_SILENT_VERSIONS, T::Array[Dependabot::Version]) | ||
end | ||
|
||
sig { override.returns(String) } | ||
attr_reader :name | ||
|
||
sig { override.returns(Dependabot::Version) } | ||
attr_reader :version | ||
|
||
sig { override.returns(T::Array[Dependabot::Version]) } | ||
attr_reader :deprecated_versions | ||
|
||
sig { override.returns(T::Array[Dependabot::Version]) } | ||
attr_reader :supported_versions | ||
|
||
sig { override.returns(T::Boolean) } | ||
def unsupported? | ||
# Check if the version is not supported | ||
supported_versions.all? { |supported| supported > version } | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
! dependabot update -f input.yml --local . --updater-image ghcr.io/dependabot/dependabot-updater-silent | ||
! stderr 'created \| dependency-a \( from 1.2.3 to 1.2.5 \)' | ||
! pr-created expected.json | ||
stderr 'Currently, the following silent versions are supported in Dependabot: v2\.*\.' | ||
stdout {"data":{"error-type":"tool_version_not_supported","error-details":{"detected-version":"1","supported-versions":"v2.*","tool-name":"silent"}},"type":"record_update_job_error"} | ||
|
||
|
||
-- manifest.json -- | ||
{ | ||
"silent": { "version": "1" }, | ||
"dependency-a": { "version": "1.2.3" } | ||
} | ||
|
||
-- input.yml -- | ||
job: | ||
package-manager: "silent" | ||
source: | ||
directory: "/" | ||
provider: example | ||
hostname: example.com | ||
api-endpoint: https://example.com/api/v3 | ||
repo: dependabot/smoke-tests |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
# frozen_string_literal: true | ||
|
||
source "https://rubygems.org" | ||
|
||
gem "bundler", "~> 1.15.0" | ||
|
||
gem "business", "~> 1.4.0" | ||
gem "statesman", "~> 1.2.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
GEM | ||
remote: https://rubygems.org/ | ||
specs: | ||
business (1.4.0) | ||
statesman (1.2.1) | ||
|
||
PLATFORMS | ||
ruby | ||
|
||
DEPENDENCIES | ||
bundler (~> 1.15.0) | ||
business (~> 1.4.0) | ||
statesman (~> 1.2.0) | ||
|
||
BUNDLED WITH | ||
1.15.4 |