Commit 0a1f1d839327d88392ae58fd824fcf449a12755b
1 parent
38674e6e
Exists in
dev
Add file checking on git pull with PYROS_DOCKER_UPDATE
Showing
1 changed file
with
27 additions
and
3 deletions
Show diff stats
docker/PYROS_DOCKER_UPDATE
1 | 1 | #!/usr/bin/env bash |
2 | 2 | |
3 | 3 | # PRE-CONDITION : pyros container must be running |
4 | - | |
4 | +root_folder=$(pwd 2>&1) | |
5 | 5 | # If no container is running Start it |
6 | 6 | if ! [ $(docker ps | grep 'pyros' | wc -l) -eq 4 ] |
7 | 7 | then |
... | ... | @@ -12,11 +12,35 @@ fi |
12 | 12 | |
13 | 13 | # 1) Update Guitastro |
14 | 14 | echo "Updating Guitastro source code" |
15 | -(cd ../vendor/guitastro/ ; git pull) | |
15 | +cd ../vendor/guitastro/ | |
16 | +gitpull_output=$(git pull 2>&1) | |
17 | +echo $gitpull_output | |
18 | +check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
19 | +for file in "${check_files[@]}" | |
20 | +do | |
21 | + if grep -q "$file" <<< "$gitpull_output"; then | |
22 | + echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image" | |
23 | + return 1 | |
24 | + fi | |
25 | +done | |
16 | 26 | |
17 | 27 | # 2) Update PyROS |
28 | +cd $root_folder | |
18 | 29 | echo "Updating PyROS source code" |
19 | -git pull | |
30 | +gitpull_output=$(git pull 2>&1) | |
31 | +echo $gitpull_output | |
32 | +check_files=("docker-compose.yml" "Dockerfile" "install/requirements.in") | |
33 | +for file in "${check_files[@]}" | |
34 | +do | |
35 | + if grep -q "$file" <<< "$gitpull_output"; then | |
36 | + echo "WARNING : One of docker related files has been changed. You should build again the PyROS Image" | |
37 | + return 1 | |
38 | + fi | |
39 | +done | |
40 | + | |
41 | +# TODO : test if git pull worked and if git pull changed dockerfile, requirements.in, docker-compose.yml | |
42 | +# Tell user to rebuild | |
43 | + | |
20 | 44 | |
21 | 45 | # 3) Update all observatories with git repo |
22 | 46 | for dir in ../../PYROS_OBSERVATORY/* ; do | ... | ... |