diff --git a/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.html b/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.html index 64453f9d382..202b748f20c 100644 --- a/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.html +++ b/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.html @@ -170,6 +170,20 @@

Job Parameters

+
+
+

+ + The following parameters are not accepted by the jenkins job but are still set in the stage configuration: +

+ + +
+
diff --git a/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.js b/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.js index c3704f4332a..390f0e85cbc 100644 --- a/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.js +++ b/app/scripts/modules/core/src/pipeline/config/stages/jenkins/jenkinsStage.js @@ -105,6 +105,7 @@ module.exports = angular function updateJobConfig() { let stage = $scope.stage, view = $scope.viewState; + if (stage && stage.master && stage.job && !view.masterIsParameterized && !view.jobIsParameterized) { IgorService.getJobConfig($scope.stage.master, $scope.stage.job).then(config => { config = config || {}; @@ -114,6 +115,14 @@ module.exports = angular $scope.jobParams = config.parameterDefinitionList; $scope.userSuppliedParameters = $scope.stage.parameters; $scope.useDefaultParameters = {}; + + if ($scope.jobParams) { + const acceptedJobParameters = $scope.jobParams.map(param => param.name); + $scope.invalidParameters = Object.keys($scope.userSuppliedParameters).filter( + paramName => !acceptedJobParameters.includes(paramName), + ); + } + let params = $scope.jobParams || []; params.forEach(property => { if (!(property.name in $scope.stage.parameters) && property.defaultValue !== null) { @@ -136,6 +145,15 @@ module.exports = angular } }; + this.removeInvalidParameters = function() { + $scope.invalidParameters.forEach(param => { + if ($scope.stage.parameters[param] !== 'undefined') { + delete $scope.stage.parameters[param]; + } + }); + $scope.invalidParameters = []; + }; + initializeMasters(); $scope.$watch('stage.master', updateJobsList);