Skip to content

Commit

Permalink
[ci]: restructure repo clean up to make it robust (#6716)
Browse files Browse the repository at this point in the history
restructure repo clean up to make it robust

Signed-off-by: Guohan Lu <lguohan@gmail.com>
  • Loading branch information
lguohan committed Feb 8, 2021
1 parent de51ee3 commit d843d6e
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 11 deletions.
9 changes: 8 additions & 1 deletion .azure-pipelines/build-template.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,10 +61,17 @@ jobs:
displayName: ${{ parameters.platform }}
timeoutInMinutes: ${{ parameters.timeout }}
steps:
- template: cleanup.yml
- checkout: self
clean: true
submodules: recursive
displayName: 'Checkout code'
- template: cleanup.yml
- script: |
git submodule foreach --recursive 'git clean -xfdf || true'
git submodule foreach --recursive 'git reset --hard || true'
git submodule foreach --recursive 'git remote update || true'
git submodule update --init --recursive
displayName: 'Reset submodules'
- script: |
set -e
sudo modprobe overlay
Expand Down
17 changes: 7 additions & 10 deletions .azure-pipelines/cleanup.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
steps:
- script: |
sudo kill -9 `sudo cat /var/run/march/docker.pid` || true
sudo rm -f /var/run/march/docker.pid || true
sudo rm -rf fsroot || true
git clean -xfdf || true
git reset --hard || true
git submodule foreach --recursive 'git clean -xfdf || true' || true
git submodule foreach --recursive 'git reset --hard || true' || true
git submodule foreach --recursive 'git remote update || true' || true
git submodule update --init --recursive || true
if sudo [ -f /var/run/march/docker.pid ] ; then
pid=`sudo cat /var/run/march/docker.pid` ; sudo kill $pid
fi
sudo rm -f /var/run/march/docker.pid
sudo rm -rf /data/march/docker
# clean native docker build
if sudo [ -f dockerfs/var/run/docker.pid ] ; then
pid=`sudo cat dockerfs/var/run/docker.pid` ; sudo kill $pid
fi
sudo rm -rf /data/march/docker
sudo rm -rf dockerfs
sudo rm -rf fsroot
displayName: "Clean Workspace"

0 comments on commit d843d6e

Please sign in to comment.