我有一个管道来构建我的android应用程序。在某些阶段,我有shell脚本。当我一个接一个地运行阶段时(通过评论他人),一切都很好,但是当我一起运行它们时,我会看到奇怪的行为。
看来shell脚本运行在并行中!
这是我的个人档案:
pipeline{
agent any
stages{
stage("Clean"){
agent{
node{
label 'master'
customWorkspace getMainDirectory()
}
}
steps{
sh """#!/bin/bash
rm -rf Corona
rm -rf native-corona-android
cd ..
cp -a TemplateWorkspace/. ${getCoronaBranch()}-${getNativeBrach()}
"""
}
}
stage("pull native repo"){
agent{
node{
label 'master'
customWorkspace getNativeProjectPath()
}
}
steps{
echo "pulling native"
git(
url: nativeRepositoryAddress,
credentialsId: credentialsId,
branch: getNativeBrach()
)
echo "pulling done"
}
}
stage("pull corona repo"){
agent{
node{
label 'master'
customWorkspace getCoronaProjectPath()
}
}
steps{
echo "pulling corona"
git(
url: coronaRepositoryAddress,
credentialsId: credentialsId,
branch: getCoronaBranch()
)
echo "pulling done"
}
}
stage("build"){
environment {
docDir = getMainDirectory()
ANDROID_HOME = getAndroidSDKLocation()
}
agent{
node{
label 'master'
customWorkspace getNativeProjectPath()
}
}
steps{
sh """#!/bin/bash
./gradlew clean
./gradlew changeFiles --stacktrace --no-daemon
./gradlew assembleDebug --stacktrace --no-daemon
"""
}
}
stage("move build files"){
agent{
node{
label 'master'
customWorkspace getGradleBuildLocation()
}
}
steps{
sh """#!/bin/bash
yes | cp -rf * ../../../../JenkinsBuilds/${getOutputFolder()}/
"""
}
}
}
}我只想运行步骤同步(当然还有shell脚本),我的问题是什么?
以下是我所看到的:
在“清洁”步骤中,文件夹被删除,模板文件夹的新副本被复制到工作目录中。步骤“拉本地回购”和“拉电晕回购”做他们应该做的工作。但在“构建”一步中,我可以看到,“原生-日冕-android”文件的一部分已经消失,"gradlew“脚本被删除。我也看到了整个“原生-冠-android”文件夹被删除的情况。然后,我想“清洁”步骤中的脚本又被调用了。
谢谢
发布于 2018-12-10 08:27:49
除非您使用parallel指令,否则所有步骤都应该同步运行。
你观察到了什么行为?哪些步骤是并行的?
https://stackoverflow.com/questions/53701423
复制相似问题