Repository: dbt-labs/dbt-core

Issue:
[CT-2174] [Regression] Package max version range throwing error
### Is this a regression in a recent version of dbt-core?

- [X] I believe this is a regression in dbt-core functionality
- [X] I have searched the existing issues, and I could not find an existing issue for this regression

### Current Behavior

On the latest 1.4.2 version of dbt-core when installing a dbt package with the range including a range with a max of `0.10.0` you will receive an erroneous failure. For example:
```yml
packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.10.0"]
```
Will result in 
```zsh
Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']
```
However, the [latest version of fivetran/google_ads](https://hub.getdbt.com/fivetran/google_ads_source/latest/) is 0.9.0 and should be fine with that version range.

If I then adjust the range to just not include 0.10.0 it will succeed:
```yml
packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.9.9"]
```
Result
```zsh
22:28:23  Installing fivetran/google_ads_source
22:28:24    Installed from version 0.9.0
22:28:24    Up to date!
```

### Expected/Previous Behavior

The range would succeed with 0.10.0.

### Steps To Reproduce

1. Install the google_ads_source package with the following range

```yml
packages:
   - package: fivetran/google_ads_source
     version: [">=0.9.0", "<0.10.0"]
```
2. Run `dbt deps`
3. See the following error:
```zsh
Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']
```

### Relevant log output

```shell
Version error for package fivetran/google_ads_source: Could not find a satisfactory version from options: ['>=0.9.0', '<0.10.0']
```


### Environment

```markdown
- OS: Mac OS
- Python: 3.9.6
- dbt (working version): 1.4.1
- dbt (regression version): 1.4.2
```


### Which database adapter are you using with dbt?

bigquery

### Additional Context

[Here](https://getdbt.slack.com/archives/C01D1R2JLLA/p1677183954010909) is a slack thread where a user experienced a similar issue when trying to install the fivetran/ad_reporting package.


Discussion:
@fivetran-joemarkiewicz Thanks for opening!

I'm guessing this must be related somehow to the change in https://github.com/dbt-labs/dbt-core/pull/6838. Taking a look
https://github.com/dbt-labs/dbt-core/blob/5ddd40885e0502e968fd2633127cbb7a1959a40f/core/dbt/semver.py#L154-L158

Drop a breakpoint after line 154:
```python
            else:  # major/minor/patch, should all be numbers
                if key == "minor":
                    first = a
                    second = b
                    import ipdb; ipdb.set_trace()
```
```python
ipdb> first
'9'
ipdb> second
'10'
ipdb> first > second
True
```

> should all be numbers

let's make sure of it :)

Resolving patch:
diff --git a/core/dbt/semver.py b/core/dbt/semver.py
--- a/core/dbt/semver.py
+++ b/core/dbt/semver.py
@@ -152,9 +152,9 @@ def compare(self, other):
                 # else is equal and will fall through
 
             else:  # major/minor/patch, should all be numbers
-                if a > b:
+                if int(a) > int(b):
                     return 1
-                elif a < b:
+                elif int(a) < int(b):
                     return -1
                 # else is equal and will fall through
 


Test patch:
diff --git a/test/unit/test_semver.py b/test/unit/test_semver.py
--- a/test/unit/test_semver.py
+++ b/test/unit/test_semver.py
@@ -200,6 +200,14 @@ def test__resolve_to_specific_version(self):
                 ['1.0.0', '1.1.0a1', '1.1.0', '1.2.0a1', '1.2.0']),
             '1.1.0')
 
+        self.assertEqual(
+            resolve_to_specific_version(
+                # https://github.com/dbt-labs/dbt-core/issues/7039
+                # 10 is greater than 9
+                create_range('>0.9.0', '<0.10.0'),
+                ['0.9.0', '0.9.1', '0.10.0']),
+            '0.9.1')
+
     def test__filter_installable(self):
         installable = filter_installable(
             ['1.1.0',  '1.2.0a1', '1.0.0','2.1.0-alpha','2.2.0asdf','2.1.0','2.2.0','2.2.0-fishtown-beta','2.2.0-2'],