Explorar el Código

Docker: Add PULL and FETCH parameters

Bastien Sevajol (Algoo) hace 7 años
padre
commit
87745181f5
Se han modificado 2 ficheros con 22 adiciones y 0 borrados
  1. 5 0
      README.md
  2. 17 0
      docker/Debian_Tests/entrypoint.sh

+ 5 - 0
README.md Ver fichero

@@ -478,6 +478,11 @@ To run tests on specific branch or commit, use ``CHECKOUT`` parameter, eg:
478 478
 
479 479
     docker run -e TEST_DATABASE_ENGINE=postgresql -e CHECKOUT=<branch_or_commit_name> tracim:tests
480 480
 
481
+##### Other parameters (environment variables)
482
+
483
+* FETCH: (0 or 1) Apply a ``git fetch origin`` on tracim repository
484
+* PULL: (0 or 1) Apply a ``git pull origin master`` on tracim repository to set tracim on latest master branch
485
+
481 486
 #### Run Prod/dev containers
482 487
 
483 488
 Environment variables are:

+ 17 - 0
docker/Debian_Tests/entrypoint.sh Ver fichero

@@ -5,8 +5,25 @@
5 5
 #
6 6
 # * TEST_DATABASE_ENGINE (values: postgresql, mysql, sqlite)
7 7
 # * CHECKOUT (values: a commit or branch name)
8
+# * PULL (values: 0 or 1)
9
+# * FETCH (values: 0 or 1)
8 10
 #
9 11
 
12
+# Default values
13
+FETCH=${FETCH:=1}
14
+PULL=${PULL:=1}
15
+
16
+# If PULL is set, change repository HEAD
17
+if [ "$FETCH" = 1 ]; then
18
+    cd /tracim && git fetch origin
19
+fi
20
+
21
+
22
+# If PULL is set, change repository HEAD
23
+if [ "$PULL" = 1 ]; then
24
+    cd /tracim && git pull origin master
25
+fi
26
+
10 27
 # If CHECKOUT is set, change repository HEAD
11 28
 if [ -n "$CHECKOUT" ]; then
12 29
     cd /tracim && git checkout ${CHECKOUT}