[ci]: restructure repo clean up to make it robust (#6716)

restructure repo clean up to make it robust

Signed-off-by: Guohan Lu <lguohan@gmail.com>
This commit is contained in:
lguohan 2021-02-08 08:06:36 -08:00 committed by GitHub
parent de51ee33df
commit d843d6ed12
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 11 deletions

View File

@ -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

View File

@ -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"