Use a script block to skip the clean up of the repos if resumed.
This commit is contained in:
parent
6d12c91f49
commit
9734f1d9f2
|
@ -165,28 +165,31 @@ pipeline {
|
||||||
}
|
}
|
||||||
stage('initialize local repository') {
|
stage('initialize local repository') {
|
||||||
steps {
|
steps {
|
||||||
|
script {
|
||||||
|
if (resume) {
|
||||||
|
sh '''
|
||||||
|
echo "REMOVE_LOCAL_REPO: ${REMOVE_LOCAL_REPO}"
|
||||||
|
echo "CLEANUP_GCUBE_REPO: ${CLEANUP_GCUBE_REPO}"
|
||||||
|
if [ "$CLEANUP_GCUBE_REPO" = "true" ]; then
|
||||||
|
echo "Remove gCube artifacts from local repository"
|
||||||
|
rm -rf $MAVEN_LOCAL_REPO/org/gcube
|
||||||
|
fi
|
||||||
|
if [ "$REMOVE_LOCAL_REPO" = "true" ]; then
|
||||||
|
echo "Create a fresh local repository"
|
||||||
|
rm -rf $MAVEN_LOCAL_REPO
|
||||||
|
mkdir -p $MAVEN_LOCAL_REPO
|
||||||
|
fi
|
||||||
|
'''
|
||||||
|
}
|
||||||
|
}
|
||||||
sh '''
|
sh '''
|
||||||
echo "RESUME_FROM: ${RESUME_FROM}"
|
mv "${AGENT_ROOT_FOLDER}/settings.xml" "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}"
|
||||||
if [ -z "$RESUME_FROM" ]; then
|
cp "${AGENT_ROOT_FOLDER}/${MAVEN_SETTINGS_FILE}" "${AGENT_ROOT_FOLDER}/settings.xml"
|
||||||
echo "REMOVE_LOCAL_REPO: ${REMOVE_LOCAL_REPO}"
|
echo "Done with local repository and settings"
|
||||||
echo "CLEANUP_GCUBE_REPO: ${CLEANUP_GCUBE_REPO}"
|
|
||||||
if [ "$CLEANUP_GCUBE_REPO" = "true" ]; then
|
|
||||||
echo "Remove gCube artifacts from local repository"
|
|
||||||
rm -rf $MAVEN_LOCAL_REPO/org/gcube
|
|
||||||
fi
|
|
||||||
if [ "$REMOVE_LOCAL_REPO" = "true" ]; then
|
|
||||||
echo "Create a fresh local repository"
|
|
||||||
rm -rf $MAVEN_LOCAL_REPO
|
|
||||||
mkdir -p $MAVEN_LOCAL_REPO
|
|
||||||
fi
|
|
||||||
fi
|
|
||||||
mv "${AGENT_ROOT_FOLDER}/settings.xml" "${AGENT_ROOT_FOLDER}/settings.${PIPELINE_BUILD_NUMBER}"
|
|
||||||
cp "${AGENT_ROOT_FOLDER}/${MAVEN_SETTINGS_FILE}" "${AGENT_ROOT_FOLDER}/settings.xml"
|
|
||||||
echo "Done with local repository and settings"
|
|
||||||
|
|
||||||
'''
|
'''
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// the maven-parent needs to be built (once) at each execution
|
// the maven-parent needs to be built (once) at each execution
|
||||||
stage('build maven-parent') {
|
stage('build maven-parent') {
|
||||||
steps {
|
steps {
|
||||||
|
|
Loading…
Reference in New Issue