Jenkinsfile管道从git运行PS1脚本

时间:2019-12-04 09:44:41

标签: powershell jenkins-pipeline

我真的为此感到挣扎,我似乎只能找到要运行的cmdlet而不是从Git存储库克隆的脚本的示例。我有以下内容:

管道{

environment {
        JOB_BASE_NAME="org-onprem-2016"
        VERSION="$BUILD_NUMBER"
        teamsColorRed="C50E2E"
        teamsColorGreen="7FBA00"
}
// Helper function to run PowerShell Commands

agent {
    node {
        label 'Windows'
    }
}

stages {
    stage('Checkout SCM') {
        steps {
        step([$class: 'WsCleanup'])
            dir ('inv_onprem_2016') {
            git url: 'https://github.local/org-cit/org_onprem_2016.git', credentialsId: 'svc-tokenauth'
            }
        }
    }
    stage('Initiate Build Variables') {
        steps {
            powerShell('scripts\\2012\\initiatevars.ps1')
            }
    }        

我在步骤位尝试了多次迭代,但是始终在找不到路径等周围遇到某种形式的错误。我认为我缺少应该如何处理工作空间的方法,但是在前面尝试了$ ENV:WORKSPACE并得到了相同的结果(围绕未定义“ ENV”的错误)。有人可以帮我指引正确的方向吗?

0 个答案:

没有答案