~ salmonella-environment-setup (master) 23ee2169526ee9d4965ed0ea4c42699a4206dc8b


commit 23ee2169526ee9d4965ed0ea4c42699a4206dc8b
Author:     Mario Domenech Goulart <mario@parenteses.org>
AuthorDate: Tue Apr 20 21:37:54 2021 +0200
Commit:     Mario Domenech Goulart <mario@parenteses.org>
CommitDate: Tue Apr 20 21:37:57 2021 +0200

    run-salmonella.sh: handle CHICKEN_CORE_COMMIT_HASH
    
    If the CHICKEN_CORE_COMMIT_HASH environment variable is set, pass its
    value to the --commit-hash option of salmonella-run-publish.

diff --git a/run-salmonella.sh b/run-salmonella.sh
index a3cf665..ccd6752 100755
--- a/run-salmonella.sh
+++ b/run-salmonella.sh
@@ -36,6 +36,9 @@ Configuration files will be read from:
 * $LOCAL_CONF_DIR
 
 in that order.
+
+If the enviroment variable CHICKEN_CORE_COMMIT_HASH is set, it is
+going to be passed to salmonella-run-publish.
 EOF
 }
 
@@ -145,16 +148,18 @@ run_salmonella() {
 
         run_hooks
 
-        conf_path=$SRC_CONF_DIR/${conf}.conf
+        local args
+        args=$SRC_CONF_DIR/${conf}.conf
+
         local_conf_path=$LOCAL_CONF_DIR/${conf}.conf
-        if [ -e "$local_conf_path" ]; then
-            info "Loading $conf_path"
-            info "Loading $local_conf_path"
-            "$salmonella_run_publish" "$conf_path" "$local_conf_path" >>"$log_file" 2>&1
-        else
-            info "Loading $conf_path"
-            "$salmonella_run_publish" "$conf_path" >>"$log_file" 2>&1
-        fi
+        [ -e "$local_conf_path" ] && args="$args $local_conf_path"
+
+        [ -n "$CHICKEN_CORE_COMMIT_HASH" ] &&
+            args="--commit-hash $CHICKEN_CORE_COMMIT_HASH $args"
+
+        info "Running $salmonella_run_publish $args"
+        "$salmonella_run_publish" $args >>"$log_file" 2>&1
+
         [ -d "$RUN_SALMONELLA_TMP_DIR" ] &&
             mv "$RUN_SALMONELLA_TMP_DIR" "salmonella-$conf"
     done
Trap