Skip to content

Commit

Permalink
Merge branch 'master' into filinto/add-image-pull-policy
Browse files Browse the repository at this point in the history
  • Loading branch information
filintod committed Dec 6, 2024
2 parents b39be8f + dbbe022 commit 8e4cea5
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 6 deletions.
2 changes: 1 addition & 1 deletion cmd/run.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,7 +230,7 @@ dapr run --run-file /path/to/directory -k
output.DaprGRPCPort)
}

if semver.Compare(fmt.Sprintf("v%v", daprVer.RuntimeVersion), "v1.14.0-rc.1") == -1 {
if (daprVer.RuntimeVersion != "edge") && (semver.Compare(fmt.Sprintf("v%v", daprVer.RuntimeVersion), "v1.14.0-rc.1") == -1) {
print.InfoStatusEvent(os.Stdout, "The scheduler is only compatible with dapr runtime 1.14 onwards.")
for i, arg := range output.DaprCMD.Args {
if strings.HasPrefix(arg, "--scheduler-host-address") {
Expand Down
17 changes: 12 additions & 5 deletions pkg/version/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -119,11 +119,18 @@ func GetLatestReleaseGithub(githubURL string) (string, error) {
latestVersion := defaultVersion

for _, release := range githubRepoReleases {
if !strings.Contains(release.TagName, "-rc") {
cur, _ := version.NewVersion(strings.TrimPrefix(release.TagName, "v"))
if cur.GreaterThan(latestVersion) {
latestVersion = cur
}
cur, err := version.NewVersion(strings.TrimPrefix(release.TagName, "v"))
if err != nil || cur == nil {
print.WarningStatusEvent(os.Stdout, "Malformed version %s, skipping", release.TagName)
continue
}
// Prerelease versions and versions with metadata are skipped.
if cur.Prerelease() != "" || cur.Metadata() != "" {
continue
}

if cur.GreaterThan(latestVersion) {
latestVersion = cur
}
}

Expand Down
46 changes: 46 additions & 0 deletions pkg/version/version_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,52 @@ func TestGetVersionsGithub(t *testing.T) {
"no releases",
"",
},
{
"Malformed version no releases",
"/malformed_version_no_releases",
`[
{
"url": "https://api.github.com/repos/dapr/dapr/releases/186741665",
"html_url": "https://github.com/dapr/dapr/releases/tag/vedge",
"id": 186741665,
"tag_name": "vedge",
"target_commitish": "master",
"name": "Dapr Runtime vedge",
"draft": false,
"prerelease": false
}
] `,
"no releases",
"",
},
{
"Malformed version with latest",
"/malformed_version_with_latest",
`[
{
"url": "https://api.github.com/repos/dapr/dapr/releases/186741665",
"html_url": "https://github.com/dapr/dapr/releases/tag/vedge",
"id": 186741665,
"tag_name": "vedge",
"target_commitish": "master",
"name": "Dapr Runtime vedge",
"draft": false,
"prerelease": false
},
{
"url": "https://api.github.com/repos/dapr/dapr/releases/44766923",
"html_url": "https://github.com/dapr/dapr/releases/tag/v1.5.1",
"id": 44766923,
"tag_name": "v1.5.1",
"target_commitish": "master",
"name": "Dapr Runtime v1.5.1",
"draft": false,
"prerelease": false
}
] `,
"",
"1.5.1",
},
}
m := http.NewServeMux()
s := http.Server{Addr: ":12345", Handler: m, ReadHeaderTimeout: time.Duration(5) * time.Second}
Expand Down

0 comments on commit 8e4cea5

Please sign in to comment.