Skip to content

Commit

Permalink
Fix Shellcheck tips
Browse files Browse the repository at this point in the history
  • Loading branch information
Victoremepunto committed Oct 19, 2023
1 parent c8f81df commit 9c4d3b5
Show file tree
Hide file tree
Showing 6 changed files with 21 additions and 4 deletions.
8 changes: 5 additions & 3 deletions src/load_module.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

# https://stackoverflow.com/a/246128
if [ -z "$CICD_LOADER_SCRIPTS_DIR" ]; then
readonly CICD_LOADER_SCRIPTS_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &> /dev/null && pwd)"
CICD_LOADER_SCRIPTS_DIR="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" &>/dev/null && pwd)"
fi

readonly CICD_LOADER_SCRIPTS_DIR

if ! source "${CICD_LOADER_SCRIPTS_DIR}/shared/loader.sh"; then
echo "Error loading 'loader' module!"
exit 1
echo "Error loading 'loader' module!"
exit 1
fi

# TODO: undo all loader module stuff
Expand Down
2 changes: 2 additions & 0 deletions src/shared/common.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# Common functions that are shared across the different modules

if [[ -n "$CICD_COMMON_MODULE_LOADED" ]]; then
Expand Down
2 changes: 2 additions & 0 deletions src/shared/container.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# container engine helper functions to handle both podman and docker commands

if [[ -n "$CICD_CONTAINER_MODULE_LOADED" ]]; then
Expand Down
2 changes: 2 additions & 0 deletions src/shared/image_builder.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
#!/bin/bash

# helper functions to build container images

if [[ -n "$CICD_IMAGE_BUILDER_MODULE_LOADED" ]]; then
Expand Down
7 changes: 6 additions & 1 deletion src/shared/loader.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

# Internal module to provide module loading helper functions

CICD_LOADER_MODULE_LOADED=${CICD_LOADER_MODULE_LOADED:-1}

if [[ "$CICD_LOADER_MODULE_LOADED" -eq 0 ]]; then
Expand All @@ -11,6 +15,7 @@ if [[ -z "$CICD_LOADER_SCRIPTS_DIR" ]]; then
return 1
fi

# shellcheck source=src/shared/log.sh
if ! source "${CICD_LOADER_SCRIPTS_DIR}/shared/log.sh"; then
echo "Error loading 'log' module!"
return 1
Expand Down Expand Up @@ -44,7 +49,7 @@ cicd::loader::_load_all() {
}

cicd::loader::_load_log_module() {
# shellcheck source=src/shared/common.sh
# shellcheck source=src/shared/log.sh
source "${CICD_LOADER_SCRIPTS_DIR}/shared/log.sh"
}

Expand Down
4 changes: 4 additions & 0 deletions src/shared/log.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
#!/bin/bash

# logging helper funtions

CICD_LOG_DEBUG=${CICD_LOG_DEBUG:-}

if [[ -n "$CICD_LOG_MODULE_LOADED" ]]; then
Expand Down

0 comments on commit 9c4d3b5

Please sign in to comment.