Jenkins Pipeline replaceAll和Deploy

时间:2019-08-14 23:14:22

标签: jenkins jenkins-pipeline

我对詹金斯很陌生,希望能得到一些帮助。我构建了一个管道脚本,该脚本从git repo调用文件,读取文件,并打印文件内容,然后将所有“ text1”替换为参数化的“ $ {text2}”。控制台输出反映了更改。

对于bat命令,我映射了服务器,并希望能够将更新的文件内容部署到Windows服务器。但是发生的事情是它将原始文件而不是更新的文件部署到服务器。如何才能部署更新的文件?谢谢。

stage(’name’)       
     node("commercial-windows-agents")
     {
       git([url: ‘git url’, branch: 'master'])
       echo “${text2}”
       String filePath = "${Workspace}"
       println filePath
       def fileContents = readFile("${Workspace}\\filename”)
       println fileContents
       println fileContents.replaceAll(“text1”, “${text2}”)

       bat('''
       (
       net use T: \\\\server\\c$ %Password% /user:%Username%
       xcopy "%WORKSPACE%\\filename” “T:\\filepath\\” /e /y
       )
       net use T: /d /y
       ''')
     }

1 个答案:

答案 0 :(得分:0)

尝试使用AntBuilder():

<ListView
    android:id="@+id/levelOneListView"
    android:layout_width="0dp"
    android:layout_height="0dp"
    android:layout_marginStart="8dp"
    android:layout_marginLeft="8dp"
    android:layout_marginTop="60dp"
    android:layout_marginEnd="8dp"
    android:layout_marginEnd="8dp"
    android:layout_marginBottom="8dp"
    app:layout_constraintBottom_toBottomOf="parent"
    app:layout_constraintEnd_toEndOf="parent"
    app:layout_constraintStart_toStartOf="parent"
    app:layout_constraintTop_toBottomOf="@+id/textView2" />