Skip to content

Commit 294e0ed

Browse files
fix(pipelineStage): Rendering with a warning with the pipelineParameters are defined as a SpeL expression (#10168)
1 parent 2740ed5 commit 294e0ed

File tree

2 files changed

+23
-5
lines changed

2 files changed

+23
-5
lines changed

packages/core/src/pipeline/config/stages/pipeline/pipelineStage.html

+11
Original file line numberDiff line numberDiff line change
@@ -104,6 +104,17 @@ <h4 class="text-left">Pipeline Parameters</h4>
104104
<button class="self-right passive" ng-click="pipelineStageCtrl.removeInvalidParameters()">Remove all</button>
105105
</div>
106106
</div>
107+
<div ng-if="hasSpeLDefinedParameterBlock()" class="horizontal center sp-margin-l-top" style="width: 100%">
108+
<div class="warning-text alert-info vertical">
109+
<p>
110+
<i class="fa fa-exclamation-triangle"></i>
111+
The pipelineParameters is defined as a SpeL expression and will be fully evaluated on Runtime.
112+
</p>
113+
<p>
114+
<code ng-bind-html="stage.pipelineParameters"></code>
115+
</p>
116+
</div>
117+
</div>
107118
</div>
108119
<stage-config-field label="Skip downstream output" help-key="pipeline.skipDownstreamOutput">
109120
<input type="checkbox" class="input-sm" name="skipDownstreamOutput" ng-model="stage.skipDownstreamOutput" />

packages/core/src/pipeline/config/stages/pipeline/pipelineStage.js

+12-5
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,12 @@ module(CORE_PIPELINE_CONFIG_STAGES_PIPELINE_PIPELINESTAGE, [])
7070
$scope.applications = _.map(applications, 'name').sort();
7171
initializeMasters();
7272
});
73-
73+
const isExpression =
74+
$scope.stage.pipelineParameters !== undefined &&
75+
$scope.stage.pipelineParameters !== null &&
76+
typeof $scope.stage.pipelineParameters === 'string'
77+
? $scope.stage.pipelineParameters.startsWith('${') && $scope.stage.pipelineParameters.endsWith('}')
78+
: false;
7479
function initializeMasters() {
7580
if ($scope.stage.application && !$scope.stage.application.includes('${')) {
7681
PipelineConfigService.getPipelinesForApplication($scope.stage.application).then(function (pipelines) {
@@ -130,12 +135,14 @@ module(CORE_PIPELINE_CONFIG_STAGES_PIPELINE_PIPELINESTAGE, [])
130135
(value, name) => !acceptedPipelineParams.includes(name),
131136
);
132137
}
133-
134-
$scope.hasInvalidParameters = () => Object.keys($scope.invalidParameters || {}).length;
138+
$scope.hasSpeLDefinedParameterBlock = () => isExpression;
139+
$scope.hasInvalidParameters = () => Object.keys(($scope.invalidParameters && !isExpression) || {}).length;
135140
$scope.useDefaultParameters = {};
136141
_.each($scope.pipelineParameters, function (property) {
137-
if (!(property.name in $scope.stage.pipelineParameters) && property.default !== null) {
138-
$scope.useDefaultParameters[property.name] = true;
142+
if (!isExpression) {
143+
if (!(property.name in $scope.stage.pipelineParameters) && property.default !== null) {
144+
$scope.useDefaultParameters[property.name] = true;
145+
}
139146
}
140147
});
141148
} else {

0 commit comments

Comments
 (0)