Skip to content

Commit

Permalink
[ci] docker improvements (HarbourMasters#1101)
Browse files Browse the repository at this point in the history
  • Loading branch information
sholdee authored Aug 8, 2022
1 parent c803ff6 commit 5453c68
Showing 1 changed file with 9 additions and 5 deletions.
14 changes: 9 additions & 5 deletions Jenkinsfile
Original file line number Diff line number Diff line change
Expand Up @@ -67,8 +67,8 @@ pipeline {
move "_packages\\*.zip" "soh.zip"
"""
archiveArtifacts artifacts: 'soh.zip', followSymlinks: false, onlyIfSuccessful: true
}
archiveArtifacts artifacts: 'soh.zip', followSymlinks: false, onlyIfSuccessful: true
}
post {
always {
Expand All @@ -91,6 +91,7 @@ pipeline {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
unstash 'assets'
sh '''
if docker ps -aq --filter "name=sohcont" | grep -q .; then docker rm -f sohcont; fi
docker build . -t soh
docker run --name sohcont -dit --rm -v $(pwd):/soh soh /bin/bash
docker exec sohcont scripts/linux/appimage/build.sh
Expand All @@ -102,11 +103,12 @@ pipeline {
'''
}
sh 'sudo docker container stop sohcont'
archiveArtifacts artifacts: 'soh-linux.7z', followSymlinks: false, onlyIfSuccessful: true
}
post {
always {
sh 'sudo docker container stop sohcont'
sh 'docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi' // Clean dangling docker images
step([$class: 'WsCleanup']) // Clean workspace
}
}
Expand Down Expand Up @@ -159,9 +161,10 @@ pipeline {
catchError(buildResult: 'FAILURE', stageResult: 'FAILURE') {
unstash 'assets'
sh '''
if docker ps -aq --filter "name=sohswitchcont" | grep -q .; then docker rm -f sohswitchcont; fi
docker build . -t sohswitch
docker run --name sohcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash
docker exec sohcont scripts/switch/build.sh
docker run --name sohswitchcont -dit --rm -v $(pwd):/soh sohswitch /bin/bash
docker exec sohswitchcont scripts/switch/build.sh
mv build-switch/soh/*.nro soh.nro
mv README.md readme.txt
Expand All @@ -170,11 +173,12 @@ pipeline {
'''
}
sh 'sudo docker container stop sohcont'
archiveArtifacts artifacts: 'soh-switch.7z', followSymlinks: false, onlyIfSuccessful: true
}
post {
always {
sh 'sudo docker container stop sohswitchcont'
sh 'docker images --quiet --filter=dangling=true | xargs --no-run-if-empty docker rmi' // Clean dangling docker images
step([$class: 'WsCleanup']) // Clean workspace
}
}
Expand Down

0 comments on commit 5453c68

Please sign in to comment.