Skip to content
This repository has been archived by the owner on Apr 24, 2024. It is now read-only.

Commit

Permalink
Move UnequalStashexception inside if
Browse files Browse the repository at this point in the history
  • Loading branch information
4ydan committed Jul 22, 2023
1 parent c868b93 commit 0bc935b
Showing 1 changed file with 8 additions and 4 deletions.
12 changes: 8 additions & 4 deletions ci/Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ def abortPreviousRunUnlessMaster() {
*/
def runDockerWithPostgresSidecar(String command, List<String> stashsrc = [], List<String> stashdir = []) {
return {
if (stashsrc.size() != stashdir.size()) { throw new UnequalStashException() };
node('docker') {
node_info()
checkout scm
Expand All @@ -52,8 +51,13 @@ def runDockerWithPostgresSidecar(String command, List<String> stashsrc = [], Li
wait_for_db()
sh './ci/build-scripts/build-schema.sh'
sh "cd backend && ${command}"
for (int i = 0; i < stashsrc.size(); i++) {
stash includes: stashsrc[i], name: stashdir[i]
if (stashsrc && stashdir) {
if (stashsrc.size() != stashdir.size()) {
throw new UnequalStashException()
}
for (int i = 0; i < stashsrc.size(); i++) {
stash includes: stashsrc[i], name: stashdir[i]
}
}
}
}
Expand Down Expand Up @@ -273,6 +277,6 @@ class PackageLockJsonModifiedException extends Exception {

class UnequalStashException extends Exception {
UnequalStashException() {
super("You either gave too many stash sources or targets.")
super("The stashed files count in stashsrc and stashdir lists must be equal.")
}
}

0 comments on commit 0bc935b

Please sign in to comment.