Loading README.md +7 −0 Original line number Diff line number Diff line Loading @@ -68,3 +68,10 @@ or through a basic `environment_url.txt` file, then the Bruno test will automati :warning: all our deployment templates implement this design. Therefore even purely dynamic environments (such as review environments) will automatically be propagated to your Bruno tests. ### Hook scripts The Bruno template supports _optional_ **hook scripts** from your project, located in the root directory to perform additional project-specific logic: * `pre-bruno.sh` is executed **before** running Bruno, * `post-bruno.sh` is executed **after** running Bruno (whichever the tests status). templates/gitlab-ci-bruno.yml +19 −9 Original line number Diff line number Diff line Loading @@ -330,7 +330,10 @@ stages: done } function exec_hook() { function maybe_exec_hook() { if [[ -f "$1" ]] then log_info "\\e[33;1m$1\\e[0m hook found: execute" if [[ ! -x "$1" ]] && ! chmod +x "$1" then log_warn "... could not make \\e[33;1m${1}\\e[0m executable: please do it (chmod +x)" Loading @@ -339,6 +342,7 @@ stages: else "$1" fi fi } # retrieve server url to test from upstream artifacts ($environment_url variable or 'environment_url.txt' file) Loading Loading @@ -366,6 +370,7 @@ stages: eval_all_secrets # ENDSCRIPT # The main job that starts acceptance tests tool # on master branch: automatically started after staging deployment # on non-master branch: manually started after review env deployment (requires $REVIEW_ENABLED to be set) Loading @@ -390,10 +395,12 @@ bruno: - npm install -g @usebruno/cli script: - mkdir -p -m 777 reports # maybe execute pre hook - maybe_exec_hook "./pre-bruno.sh" # run tests - | for collection in $BRU_COLLECTIONS do rc=0 if [[ -d "$collection" ]] && [[ -f "$collection/bruno.json" ]] then cd $collection Loading @@ -403,13 +410,16 @@ bruno: if ! bru run -r --output "$junit_report" --format junit $cacerts_opt ${BRU_BASE_URL:+--env-var "base_url=$BRU_BASE_URL"} $BRU_EXTRA_ARGS then log_error "Collection \\e[33;1m./${collection}\\e[0m failed" rc=1 rc=127 fi cd $CI_PROJECT_DIR else log_warn "Matched path is not a Bruno collection: \\e[33;1m./${collection}\\e[0m" fi done # maybe execute post hook - maybe_exec_hook "./post-bruno.sh" # exit with return code - exit $rc artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" Loading Loading
README.md +7 −0 Original line number Diff line number Diff line Loading @@ -68,3 +68,10 @@ or through a basic `environment_url.txt` file, then the Bruno test will automati :warning: all our deployment templates implement this design. Therefore even purely dynamic environments (such as review environments) will automatically be propagated to your Bruno tests. ### Hook scripts The Bruno template supports _optional_ **hook scripts** from your project, located in the root directory to perform additional project-specific logic: * `pre-bruno.sh` is executed **before** running Bruno, * `post-bruno.sh` is executed **after** running Bruno (whichever the tests status).
templates/gitlab-ci-bruno.yml +19 −9 Original line number Diff line number Diff line Loading @@ -330,7 +330,10 @@ stages: done } function exec_hook() { function maybe_exec_hook() { if [[ -f "$1" ]] then log_info "\\e[33;1m$1\\e[0m hook found: execute" if [[ ! -x "$1" ]] && ! chmod +x "$1" then log_warn "... could not make \\e[33;1m${1}\\e[0m executable: please do it (chmod +x)" Loading @@ -339,6 +342,7 @@ stages: else "$1" fi fi } # retrieve server url to test from upstream artifacts ($environment_url variable or 'environment_url.txt' file) Loading Loading @@ -366,6 +370,7 @@ stages: eval_all_secrets # ENDSCRIPT # The main job that starts acceptance tests tool # on master branch: automatically started after staging deployment # on non-master branch: manually started after review env deployment (requires $REVIEW_ENABLED to be set) Loading @@ -390,10 +395,12 @@ bruno: - npm install -g @usebruno/cli script: - mkdir -p -m 777 reports # maybe execute pre hook - maybe_exec_hook "./pre-bruno.sh" # run tests - | for collection in $BRU_COLLECTIONS do rc=0 if [[ -d "$collection" ]] && [[ -f "$collection/bruno.json" ]] then cd $collection Loading @@ -403,13 +410,16 @@ bruno: if ! bru run -r --output "$junit_report" --format junit $cacerts_opt ${BRU_BASE_URL:+--env-var "base_url=$BRU_BASE_URL"} $BRU_EXTRA_ARGS then log_error "Collection \\e[33;1m./${collection}\\e[0m failed" rc=1 rc=127 fi cd $CI_PROJECT_DIR else log_warn "Matched path is not a Bruno collection: \\e[33;1m./${collection}\\e[0m" fi done # maybe execute post hook - maybe_exec_hook "./post-bruno.sh" # exit with return code - exit $rc artifacts: name: "$CI_JOB_NAME artifacts from $CI_PROJECT_NAME on $CI_COMMIT_REF_SLUG" Loading