Reputation: 375
I am creating a property block or a map which is given below and I want to write it to a file. I couldn't find a way to writeProperties to a file from a pipeline code. Need help on figuring out on how to do it.
def props = [APPNAME = 'testaoo',
DEPLOY_ENV = stream,
DEPLOY_STREAM = stream_num,
DEPLOY_ENV_TYPE = deploy_env_type,
BUILD_JOB_ID = env.BUILD_JOB_ID,
WAS_NDM_AgentURL= getAgentURL(stream),
WAS_CLUSTER = getClusterName(stream),
DeployPublishNeeded = 'Yes'
]
Upvotes: 2
Views: 5013
Reputation: 13712
def props = [
APPNAME : 'testaoo',
DeployPublishNeeded : 'Yes'
]
def content = props.collect{entry->entry.key+"="+entry.value}.join('\n')
writeFile file: 'a.properties', text: content
Upvotes: 6