0

我想在 Jenkins 构建结束时执行一个脚本,该脚本将登录到 Windows 机器并按顺序运行 .exe 文件。

我要做的是:

def remote = [:]
remote.name = "Test Machine"
remote.host = "[test_machine_IP]"
remote.allowAnyHosts = true

node {
        remote.user = '[username]'
        remote.password = '[password]'

        stage("test") {
            steps {
                bat 'notepad.exe'
            }
    }
}

这导致java.lang.NoSuchMethodError: No such DSL method 'steps' found among steps.

我也尝试过withCredentials([usernamePassword(credentialsId: '[id]', passwordVariable: '[password]', usernameVariable: '[username]')]),但它出错了credentialsId,我不知道如何获取该变量。

有人可以帮忙吗?我会对任何低级解决方案感到满意,最好没有插件(我在这里没有对 Jenkins 的管理员访问权限)。谢谢。

4

0 回答 0