Skip to content

Add audit log for successful LK version changes - #7943

Merged
cnathe merged 13 commits into
developfrom
fb_550_upgradeAudit
Aug 21, 2026
Merged

Add audit log for successful LK version changes#7943
cnathe merged 13 commits into
developfrom
fb_550_upgradeAudit

Conversation

@labkey-jeckels

@labkey-jeckels labkey-jeckels commented Aug 17, 2026

Copy link
Copy Markdown
Contributor

Rationale

In order to understand when their servers were upgraded, we want to expose a new audit table that tracks deployments/startups with new builds.

Related Pull Requests

Changes

  • New System Upgrade audit table
  • Populate table with a new row every startup that's using a different build
  • Variant of getAuditEvents() for setting maxRows

@labkey-susanh labkey-susanh left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I have done no testing of this.


private static boolean isSnapshot(String version)
{
return StringUtils.containsIgnoreCase(version, "SNAPSHOT");

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Probably this could be endsWith for -SNAPSHOT, or contains with -SNAPSHOT, but not a big deal.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Switched to endsWith.

@Test
public void testDowngrade()
{
assertEquals(ChangeType.Downgrade, determineChangeType("26.9.0", BUILD_1, "26.7.1", BUILD_2, false));

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Perhaps add a check for 26.10.1 vs. 26.10.0 (patch version change only) and 26.10.x vs 26.9.y (because string comparison would say it's larger).

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added.

Comment thread api/src/org/labkey/api/module/ModuleLoader.java Outdated
Comment thread api/src/org/labkey/api/util/VersionNumber.java Outdated
_minor = _minor / 10;
if (_minor > 9 || _minor < 0)
throw new IllegalStateException("Bad minor version: " + _minor);
// Temporary fix for SQL Server 2008 R2 (10.50.1600.1). TODO: Support two-digit version ints (MMmm)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not part of this update, of course, but this is weird. Is it still needed as a "temporary" fix?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's temporary as of 2011. getVersionInt() seems like a bad idea to me and I'd like to get rid of it, but I didn't want to wade into the code that figures out which SqlDialect variant to use for the target DB. Adding VersionNumber.compareTo() will make that refactor easier but I think it should be separate.

}

return _major * 10 + _minor;
/** getVersionInt() used to divide the minor version in place, which would corrupt later comparisons */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This "used to" comment will not be relevant past this PR.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed.

labkey-jeckels and others added 3 commits August 18, 2026 09:18
Co-authored-by: Susan Hert <susanh@labkey.com>
Co-authored-by: Susan Hert <susanh@labkey.com>
return _newInstall;
}

/** Did any module, including core, run schema scripts during this startup? */

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are cases where schema versions get bumped without running SQL scripts, but that's a nit.

cnathe added a commit to LabKey/labkey-ui-components that referenced this pull request Aug 21, 2026
#### Rationale
In order to understand when their servers were upgraded, we want to
expose a new audit table that tracks deployments/startups with new
builds.

This PR adds the audit log query name to the app admin settings "Audit
Log" page:
<img width="1457" height="494" alt="Screenshot 2026-08-19 at 3 54 41 PM"
src="https://github.com/user-attachments/assets/7a35adde-a332-47aa-af13-385f78f05e01"
/>


#### Related Pull Requests
- LabKey/platform#7943
- #2063
- LabKey/limsModules#2418

#### Changes
- Add audit log for successful LK version changes

---------

Co-authored-by: labkey-jeckels <jeckels@labkey.com>
@cnathe
cnathe merged commit c222e31 into develop Aug 21, 2026
7 of 15 checks passed
@cnathe
cnathe deleted the fb_550_upgradeAudit branch August 21, 2026 18:23
cnathe added a commit to LabKey/testAutomation that referenced this pull request Aug 21, 2026
## Rationale
In order to understand when their servers were upgraded, we want to
expose a new audit table that tracks deployments/startups with new
builds.

## Related Pull Requests
- LabKey/platform#7943

## Changes
- New upgrade test to ensure that we write entries during bootstrap and
upgrade

---------

Co-authored-by: cnathe <cnathe@labkey.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants