-
Notifications
You must be signed in to change notification settings - Fork 143
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix(artifact): more resilient app version parsing #948
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -154,14 +154,25 @@ class ApplicationService( | |
): ArtifactVersionSummary = | ||
when (artifact.type) { | ||
deb -> { | ||
val appversion = AppVersion.parseName(version) | ||
ArtifactVersionSummary( | ||
var summary = ArtifactVersionSummary( | ||
version = version, | ||
environments = environments, | ||
displayName = appversion?.version ?: version.removePrefix("${artifact.name}-"), | ||
build = if (appversion != null) BuildMetadata(id = appversion.buildNumber.toInt()) else null, | ||
git = if (appversion != null) GitMetadata(commit = appversion.commit) else null | ||
displayName = version.removePrefix("${artifact.name}-") | ||
) | ||
|
||
// attempt to parse helpful info from the appversion. | ||
// todo: replace, this is brittle | ||
val appversion = AppVersion.parseName(version) | ||
if (appversion?.version != null) { | ||
summary = summary.copy(displayName = appversion.version) | ||
} | ||
if (appversion?.buildNumber != null) { | ||
summary = summary.copy(build = BuildMetadata(id = appversion.buildNumber.toInt())) | ||
} | ||
if (appversion?.commit != null) { | ||
summary = summary.copy(git = GitMetadata(commit = appversion.commit)) | ||
} | ||
summary | ||
Comment on lines
+165
to
+175
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm failing to see how this is different from what you had before, other than setting There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I believe the current problem is that There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Lorin is correct. Again, this code should be replaced in Q2. |
||
} | ||
docker -> { | ||
var build: BuildMetadata? = null | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we ever expect fields of
appversion
to be null during normal operation? If not, if thisif
check fails, I'd put aWARN
level log statement with the value of theversion
function argument to make it easier to debug in the future.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we might fail, we might not fail if that's the case. it definitely puts us into a weird state. once we pull the appversion off the ami though it shouldn't be null. we don't rely on any of the other fields that i'm using here (if i remember correctly). Logging would probably be helpful, you're right.