Jenkins setup: I don’t have sufficient permission to get the Jenkins setup. But I could see my Jenkins version is 2.387.1 from right bottom of the Jenkins web console.
I have a two questions related to parameter setup in Jenkinsfile with Groovy script.
-
Is there any way to specify the default value in a drop-down list parameter instead of the first choice in the drop-down list as the default value?
-
I would like to set up the defaultValue for a string type parameter. However, this defaultValue is not a static constant, but a dynamic variable, which comes from another parameter value selected by the current user who is building this pipeline with parameters. For example, in the below code, I would like the “SubnetGroupName” defaultValue to come from the “DeploymentAccount” parameter value with string concatenation. However, as per my testing result, I could see the “SubnetGroupName” defaultValue comes from the “DeploymentAccount” of last build instead of the current selection of this “to-be” build.
choice(
description: “The AWS account where the ElastiCache Redis will be deployed.”,
name: ‘DeploymentAccount’,
choices: [‘RSACN’,‘RSBCN’,‘RSICN’,‘RSIDCN’,‘RCCCN’]
),
string(
name: ‘SubnetGroupName’,
description: “Please specify the ElastiCache Subnet group name. By default it is "DeploymentAccount-vpc-elasticachesubnetgrp". For example, "rsbcn-vpc-elasticachesubnetgrp".”,
defaultValue: “${params.DeploymentAccount.toLowerCase()}-vpc-elasticachesubnetgrp”
)