Fla*_*Ned 1 linux bitbucket jenkins beagleboneblack jenkins-slave
我的系统设置为 Docker Linux PC Master/BeagleBone Linux Slave,通过 USB SSH 连接。
本质上,我正在尝试执行以下操作:
当我从 Jenkins 构建时,我的主人会克隆 repo,构建代码并存储二进制文件。但是,当我转移到从属设备上的“闪存”阶段时,它还会尝试克隆存储库(由于凭据问题而失败 - 这是一个单独的问题)。我不希望它这样做 - 相反,我希望它只获取新存储的文件并使用它来刷新连接的硬件,而不是在 repo 上查找它。
我似乎找不到防止这种情况发生的选项。我该怎么做才能使用隐藏的文件?如果无法使用 stash,是否可以在不尝试克隆 repo 的情况下以另一种方式完成?
这是我的 Jenkinsfile:
pipeline {
agent none
stages {
stage('Build') {
agent {
label 'master'
}
steps {
sh 'cd application/.../example && make'
stash includes: 'application/.../example/example.bin', name: 'Flash'
}
}
stage('Test of Flash') {
agent {
label 'test_slave'
}
steps {
unstash 'Flash'
//Flashing step here
sh 'make check || true'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
这是控制台日志,从主编译开始:
obtained Jenkinsfile from 913...
[Pipeline] stage
[Pipeline] { (Build)
[Pipeline] node
Running on Jenkins in /var/jenkins_home/...
[Pipeline] {
[Pipeline] checkout
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository git@bitbucket.org:...
//Later, the file compiles:
Generating binary and Printing size information:...
//Compiles, then:
[Pipeline] stash
Stashed 1 file(s)
[Pipeline] }
[Pipeline] // withEnv
[Pipeline] }
[Pipeline] // node
[Pipeline] }
[Pipeline] // stage
[Pipeline] stage
[Pipeline] { (Test of Flash)
[Pipeline] node
Running on test_slave in /home/debian/...
[Pipeline] {
[Pipeline] checkout //And it starts to clone the repo here!
Cloning the remote Git repository
Cloning with configured refspecs honoured and without tags
Cloning repository git@bitbucket.org:...
Run Code Online (Sandbox Code Playgroud)
我不希望它执行上述操作。
显然,同样的问题以不同的形式发布在这里:https : //devops.stackexchange.com/questions/650/set-a-jenkins-job-to-not-to-clone-the-repo-in-scm /1074
无论如何,这是如何做到的:您需要options { skipDefaultCheckout() }在第一个代理之后添加一个选项,以便在一般情况下,它不会轮询 scm(因为检查 git 的命令是 checkout scm。)
然后,在您想要检查 git 的阶段,输入checkout scm一个步骤。
这是新的 Jenkinsfile:
pipeline {
agent none
options { skipDefaultCheckout() } //THIS ONE
stages {
stage('Build') {
agent {
label 'master'
}
steps {
checkout scm //AND THIS ONE
sh 'cd application/...
}
}
stage('Test of Flash') {
agent {
label 'test_slave'
}
steps {
sh 'cd application/...
sh 'make check || true'
}
}
}
}
Run Code Online (Sandbox Code Playgroud)
(碰巧,stash 是不必要的。)
| 归档时间: |
|
| 查看次数: |
1708 次 |
| 最近记录: |