mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
fix(lambda): keep MicroVM version update timestamps independent (#9021)
Each MicroVM image version now keeps its own updatedAt instead of reporting the parent image's. Building another version leaves older versions' timestamps alone, and a status update advances only the version it changes. A stored version without the field reports its own createdAt, including after a restart, and reading it does not rewrite storage. Closes #8616
This commit is contained in:
1 parent
a283c7a49b
commit
c1e7b240ea
5 files changed
+147
-1
No files matched your search
@@ -408,7 +408,8 @@ public class LambdaMicrovmsController {
|
||||
node.put("state", version.state);
|
||||
node.put("status", version.status);
|
||||
node.put("createdAt", EpochSeconds.fromInstant(version.createdAt));
|
||||
node.put("updatedAt", EpochSeconds.fromInstant(image.updatedAt));
|
||||
node.put("updatedAt", EpochSeconds.fromInstant(
|
||||
version.updatedAt != null ? version.updatedAt : version.createdAt));
|
||||
node.put("baseImageArn", buildSpec.baseImageArn());
|
||||
node.put("baseImageVersion", buildSpec.baseImageVersion());
|
||||
node.put("buildRoleArn", buildSpec.buildRoleArn());
|
||||
|
||||
@@ -161,6 +161,7 @@ public class LambdaMicrovmsService implements ResourceProvider {
|
||||
public String state;
|
||||
public String status;
|
||||
public Instant createdAt;
|
||||
public Instant updatedAt;
|
||||
public final List<MicrovmBuild> builds = new ArrayList<>();
|
||||
public BuildSpec buildSpec;
|
||||
public RuntimeSettings runtimeSettings;
|
||||
@@ -231,6 +232,7 @@ public class LambdaMicrovmsService implements ResourceProvider {
|
||||
version.state = "SUCCESSFUL";
|
||||
version.status = "ACTIVE";
|
||||
version.createdAt = Instant.now();
|
||||
version.updatedAt = version.createdAt;
|
||||
version.buildSpec = BuildSpec.from(image);
|
||||
version.runtimeSettings = image.runtimeSettings;
|
||||
// A version is built once per Graviton generation the service targets,
|
||||
@@ -342,6 +344,7 @@ public class LambdaMicrovmsService implements ResourceProvider {
|
||||
MicrovmImage image = getImage(region, name);
|
||||
MicrovmImageVersion version = getVersion(region, name, imageVersion);
|
||||
version.status = status;
|
||||
version.updatedAt = Instant.now();
|
||||
persist(images, region, image.name, image);
|
||||
return version;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user