@@ -412,18 +412,24 @@ workflowWithCopyright(
412
412
)
413
413
executeActionStep = usesSelfAfterSuccess(
414
414
name = " Set wsl-bash wrapper to use user test by default" ,
415
+ // part of work-around for https://bugs.kali.org/view.php?id=8921
416
+ conditionTransformer = { executeActionStep.successNotOnKaliCondition },
415
417
action = executeAction.copy(
416
418
additionalPackages = listOf (" sudo" ),
417
419
wslShellCommand = """ bash -c "sudo -u test bash --noprofile --norc -euo pipefail "\"""
418
420
)
419
421
)
420
422
verifyCommandResult(
421
423
name = " Test - wsl-bash should use test as default user" ,
424
+ // part of work-around for https://bugs.kali.org/view.php?id=8921
425
+ conditionTransformer = { executeActionStep.successNotOnKaliCondition },
422
426
actualCommand = " whoami" ,
423
427
expected = " test"
424
428
)
425
429
executeActionStep = usesSelfAfterSuccess(
426
430
name = " Set wsl-bash wrapper to use user test by default with inline script usage" ,
431
+ // part of work-around for https://bugs.kali.org/view.php?id=8921
432
+ conditionTransformer = { executeActionStep.successNotOnKaliCondition },
427
433
action = executeAction.copy(
428
434
wslShellCommand = """ bash -c "sudo -u test bash --noprofile --norc -euo pipefail '{0}'""""
429
435
)
@@ -774,8 +780,8 @@ workflowWithCopyright(
774
780
// work-around for https://bugs.kali.org/view.php?id=6672
775
781
// and https://bugs.launchpad.net/ubuntu/+source/systemd/+bug/2069555
776
782
condition = """
777
- (matrix.distribution.user-id != 'kali-linux ')
778
- && (matrix.distribution.user-id != 'Ubuntu-24.04 ')
783
+ (matrix.distribution.user-id != '${ kali[ " user-id " ]} ')
784
+ && (matrix.distribution.user-id != '${ubuntu2404[ " user-id " ]} ')
779
785
""" .trimIndent()
780
786
)
781
787
executeActionStep = usesSelf(
@@ -861,7 +867,7 @@ workflowWithCopyright(
861
867
verifyInstalledDistribution(
862
868
name = " Test - wsl-bash_${expr(" matrix.distributions.distribution$i .user-id" )} should use the correct distribution" ,
863
869
conditionTransformer = if (distributions[i] == ubuntu2004) {
864
- { executeActionStep.getSuccessNotOnDistributionCondition(i, " Ubuntu-20.04 " ) }
870
+ { executeActionStep.getSuccessNotOnDistributionCondition(i, ubuntu2004[ " user-id " ] !! ) }
865
871
} else {
866
872
{ it }
867
873
},
@@ -873,7 +879,7 @@ workflowWithCopyright(
873
879
if (distributions[i] == ubuntu2004) {
874
880
verifyInstalledDistribution(
875
881
name = " Test - wsl-bash_${expr(" matrix.distributions.distribution$i .user-id" )} should use the correct distribution" ,
876
- conditionTransformer = { executeActionStep.getSuccessNotOnDistributionCondition(i, " Ubuntu-22.04 " ) },
882
+ conditionTransformer = { executeActionStep.getSuccessNotOnDistributionCondition(i, ubuntu2204[ " user-id " ] !! ) },
877
883
shell = Shell .Custom (" wsl-bash_${distributions[i][" user-id" ]} {0}" ),
878
884
expectedPatternExpression = " matrix.distributions.distribution$i .match-pattern"
879
885
)
@@ -941,11 +947,12 @@ fun JobBuilder<*>.commonTests() {
941
947
942
948
fun JobBuilder <* >.usesSelfAfterSuccess (
943
949
name : String = "Execute action",
950
+ conditionTransformer : (String ) -> String = { it },
944
951
action : SetupWsl
945
952
) = usesSelf(
946
953
name = name,
947
954
action = action,
948
- condition = executeActionStep.successCondition
955
+ condition = conditionTransformer( executeActionStep.successCondition).trimIndent()
949
956
)
950
957
951
958
fun JobBuilder <* >.usesSelf (
@@ -1078,14 +1085,21 @@ val Step<*>.successOnAlpineCondition
1078
1085
get() = """
1079
1086
always()
1080
1087
&& (${outcome.eq(Success )} )
1081
- && (matrix.distribution.user-id == 'Alpine')
1088
+ && (matrix.distribution.user-id == '${alpine[" user-id" ]} ')
1089
+ """ .trimIndent()
1090
+
1091
+ val Step <* >.successNotOnKaliCondition
1092
+ get() = """
1093
+ always()
1094
+ && (${outcome.eq(Success )} )
1095
+ && (matrix.distribution.user-id != '${kali[" user-id" ]} ')
1082
1096
""" .trimIndent()
1083
1097
1084
1098
val Step <* >.successNotOnUbuntu2404Condition
1085
1099
get() = """
1086
1100
always()
1087
1101
&& (${outcome.eq(Success )} )
1088
- && (matrix.distribution.user-id != 'Ubuntu-24.04 ')
1102
+ && (matrix.distribution.user-id != '${ubuntu2404[ " user-id " ]} ')
1089
1103
""" .trimIndent()
1090
1104
1091
1105
fun Step <* >.getSuccessNotOnDistributionCondition (i : Int , distribution : String ) = """
0 commit comments