如何从 jenkins 脚本化管道创建属性文件

moi*_*134 1 jenkins-pipeline

我正在创建下面给出的属性块或地图,我想将其写入文件。我找不到从管道代码将属性写入文件的方法。需要帮助来弄清楚如何去做。

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'
            ]
Run Code Online (Sandbox Code Playgroud)

yon*_*ong 5

def props = [
    APPNAME : 'testaoo',
    DeployPublishNeeded : 'Yes'
]

def content = props.collect{entry->entry.key+"="+entry.value}.join('\n')

writeFile file: 'a.properties', text: content
Run Code Online (Sandbox Code Playgroud)