Skip to content

Commit b00637c

Browse files
committed
enh: logging for Git deployments into IRIS
1 parent 03607e9 commit b00637c

File tree

3 files changed

+54
-1
lines changed

3 files changed

+54
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1010
### Added
1111
- LoadProductionsFromDirectory method to help custom deployment scripts load decomposed productions from the repository (#670)
1212
- Added ability to reset head / revert most recent commit (#586)
13+
- Changes deployed through Git are now logged in a new table SourceControl_Git.DeploymentLog
1314

1415
### Fixed
1516
- Fixed not showing warnings on Studio (#660)
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
Class SourceControl.Git.DeploymentLog Extends %Persistent [ Owner = {%Developer} ]
2+
{
3+
4+
Property Token As %String [ InitialExpression = {$System.Util.CreateGUID()} ];
5+
6+
Property StartTimestamp As %TimeStamp;
7+
8+
Property EndTimestamp As %TimeStamp;
9+
10+
Property HeadRevision As %String;
11+
12+
Property Status As %Status;
13+
14+
Storage Default
15+
{
16+
<Data name="DeploymentLogDefaultData">
17+
<Value name="1">
18+
<Value>%%CLASSNAME</Value>
19+
</Value>
20+
<Value name="2">
21+
<Value>Token</Value>
22+
</Value>
23+
<Value name="3">
24+
<Value>StartTimestamp</Value>
25+
</Value>
26+
<Value name="4">
27+
<Value>EndTimestamp</Value>
28+
</Value>
29+
<Value name="5">
30+
<Value>HeadRevision</Value>
31+
</Value>
32+
<Value name="6">
33+
<Value>Status</Value>
34+
</Value>
35+
</Data>
36+
<DataLocation>^SourceContro22B9.DeploymentLogD</DataLocation>
37+
<DefaultData>DeploymentLogDefaultData</DefaultData>
38+
<IdLocation>^SourceContro22B9.DeploymentLogD</IdLocation>
39+
<IndexLocation>^SourceContro22B9.DeploymentLogI</IndexLocation>
40+
<StreamLocation>^SourceContro22B9.DeploymentLogS</StreamLocation>
41+
<Type>%Storage.Persistent</Type>
42+
}
43+
44+
}

cls/SourceControl/Git/PullEventHandler.cls

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,22 @@ Method OnPull() As %Status [ Abstract ]
2424
/// <var>pullEventClass</var>: if defined, override the configured pull event class
2525
ClassMethod ForModifications(ByRef files, pullEventClass As %String) As %Status
2626
{
27+
set log = ##class(SourceControl.Git.DeploymentLog).%New()
28+
set log.HeadRevision = ##class(SourceControl.Git.Utils).GetCurrentRevision()
29+
set log.StartTimestamp = $zdatetime($ztimestamp,3)
30+
do log.%Save()
2731
set event = $classmethod(
2832
$select(
2933
$data(pullEventClass)#2: pullEventClass,
3034
1: ##class(SourceControl.Git.Utils).PullEventClass())
3135
,"%New")
3236
set event.LocalRoot = ##class(SourceControl.Git.Utils).TempFolder()
3337
merge event.ModifiedFiles = files
34-
quit event.OnPull()
38+
set st = event.OnPull()
39+
set log.EndTimestamp = $zdatetime($ztimestamp,3)
40+
set log.Status = st
41+
do log.%Save()
42+
quit st
3543
}
3644

3745
/// <var>InternalName</var> may be a comma-delimited string or $ListBuild list

0 commit comments

Comments
 (0)