Skip to content

Commit da76077

Browse files
committed
fix: clear deployment token after failed PTD deployment
1 parent 2f5aa3a commit da76077

File tree

3 files changed

+30
-2
lines changed

3 files changed

+30
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
2121
- Always set the remote as the upstream branch when pushing (#871)
2222
- Fixed import of HL7 and LUT files added at the same time as their mappings (#864)
2323
- Fixed issue where Git's interactive credential manager causes Git push/pull/fetch to hang (#235)
24+
- Failed deployment of one interoperability production item no longer causes all other production items to fail (#886)
2425

2526
## [2.13.1] - 2025-09-16
2627

cls/SourceControl/Git/Production.cls

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -154,13 +154,17 @@ ClassMethod ExportPTD(internalName As %String, nameMethod As %String) As %Status
154154
Return sc
155155
}
156156

157-
/// Imports a PTD into a produciton given an external name and produciton name
157+
/// Imports a PTD into a production given an external name and produciton name
158158
ClassMethod ImportPTD(externalName As %String, productionName As %String) As %Status
159159
{
160160
try {
161161
set ^IRIS.Temp("sscProd",$job,"bypassLock") = 1
162162
set rollbackFile = ##class(%File).TempFilename()
163163
set sc = ##class(Ens.Deployment.Deploy).DeployCode(externalName,productionName,0,rollbackFile)
164+
if $$$ISERR(sc) {
165+
set sc2 = ##class(Ens.Deployment.Deploy).ClearDeploymentInProgressFlag()
166+
if $$$ISERR(sc2) set sc = $$$ADDSC(sc, sc2)
167+
}
164168
do ##class(%File).Delete(rollbackFile)
165169
kill ^IRIS.Temp("sscProd",$job,"bypassLock")
166170
} catch err {

test/UnitTest/SourceControl/Git/ProductionDecomposition.cls

Lines changed: 24 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ Method TestEditProduction()
4949
do $System.OBJ.Delete(..#ProductionName)
5050
$$$ThrowOnError(##class(SourceControl.Git.Utils).NewBranch("branch1"))
5151
$$$ThrowOnError(##class(SourceControl.Git.Production).CreateProduction(..#ProductionName))
52-
do ##class(%Studio.SourceControl.Interface).SourceControlCreate()
52+
do ##class(%Studio.SourceControl.Interface).SourceControlCreate()
5353
$$$ThrowOnError(##class(SourceControl.Git.Utils).AddToSourceControl(..#ProductionName_".cls"))
5454

5555
do $$$LogMessage("with production decomposition enabled, the production class should not be in source control.")
@@ -99,6 +99,29 @@ Method TestEditProduction()
9999
do $$$AssertEquals(production.Items.GetAt(1).Settings.GetAt(1).Value, 61)
100100
}
101101

102+
Method TestImportItemsWithError()
103+
{
104+
new %SourceControl
105+
do $System.OBJ.Delete(..#ProductionName)
106+
$$$ThrowOnError(##class(SourceControl.Git.Production).CreateProduction(..#ProductionName))
107+
do ##class(Ens.Director).UpdateProduction()
108+
do ##class(%Studio.SourceControl.Interface).SourceControlCreate()
109+
$$$ThrowOnError(%SourceControl.OnBeforeSave(..#ProductionName_".cls"))
110+
do ..ReplaceProductionDefinition("ProductionDefinition3")
111+
do %SourceControl.OnAfterSave(..#ProductionName_".cls")
112+
do $$$AssertTrue(##class(SourceControl.Git.Utils).IsInSourceControl("UnitTest.SampleProduction||ProductionSettings-UnitTest.SampleProduction.PTD"))
113+
$$$ThrowOnError(##class(Ens.Deployment.Deploy).ClearDeploymentInProgressFlag())
114+
// make one of the items fail
115+
set filePath = ##class(SourceControl.Git.Utils).FullExternalName("UnitTest.SampleProduction||Settings-b|EnsLib.SOAP.GenericOperation.PTD")
116+
set filestream = ##class(%Stream.FileCharacter).%OpenId(filePath,,.sc)
117+
$$$ThrowOnError(filestream)
118+
do filestream.Write("this will break the xml")
119+
$$$ThrowOnError(filestream.%Save())
120+
do $$$AssertStatusNotOK(##class(SourceControl.Git.Utils).ImportItem("UnitTest.SampleProduction||Settings-b|EnsLib.SOAP.GenericOperation.PTD"))
121+
/// and this one should succeed, even though the previous one failed
122+
do $$$AssertStatusOK(##class(SourceControl.Git.Utils).ImportItem("UnitTest.SampleProduction||Settings-a|Ens.Activity.Operation.Local.PTD"))
123+
}
124+
102125
ClassMethod ReplaceProductionDefinition(pXDataName)
103126
{
104127
new %SourceControl

0 commit comments

Comments
 (0)