Skip to content

Crashes when version string is not in proper semver format #30

@joscha-alisch

Description

@joscha-alisch

For a buildpack that had a typo in the version string ("v.9.1.6" instead of "v9.1.6"), the update action crashed with the following exception:

04:34:25.121 INFO  c.s.n.BuildpackVersionChecker - Performing checks
Exception in thread "main" java.lang.IllegalArgumentException: Invalid version string [.9.1.6]
	at net.swiftzer.semver.SemVer$Companion.parse(SemVer.kt:28)
	at com.springernature.newversion.SemanticVersion.toSemVer(Manifest.kt:46)
	at com.springernature.newversion.BuildpackUpdate.hasUpdate(BuildpackUpdate.kt:11)
	at com.springernature.newversion.BuildpackVersionChecker.performChecks(BuildpackVersionChecker.kt:41)
	at com.springernature.newversion.MainKt.main(Main.kt:17)
	at com.springernature.newversion.MainKt.main(Main.kt)

The trigger was an invalid tag name for the latest release on GitHub, not a typo in the manifest. In this case the buildpack had a git tag v.9.1.6.

Instead of crashing, it should probably do one of those things:

  • Act as if there is no update at all
  • Print a warning, that something appears to be wrong - but don't fail
  • Fail with a proper error message stating that the user should alert the buildpack maintainers

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions