Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add remote files #54

Merged
merged 1 commit into from
Nov 1, 2020
Merged

Add remote files #54

merged 1 commit into from
Nov 1, 2020

Conversation

jkroepke
Copy link
Owner

@jkroepke jkroepke commented Nov 1, 2020

No description provided.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2020

sh-checker report

shellcheck output

In scripts/install.sh line 9:
. "${SCRIPT_DIR}/lib/http.sh"
  ^-------------------------^ SC1091: Not following: lib/http.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 4:
. "${SCRIPT_DIR}/lib/file/local.sh"
  ^-- SC1091: Not following: lib/file/local.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 7:
. "${SCRIPT_DIR}/lib/file/http.sh"
  ^-- SC1091: Not following: lib/file/http.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 10:
. "${SCRIPT_DIR}/lib/file/custom.sh"
  ^-- SC1091: Not following: lib/file/custom.sh was not specified as input (see shellcheck -x).


In scripts/lib/http.sh line 1:
download() {
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In scripts/run.sh line 19:
DEC_SUFFIX="${HELM_SECRETS_DEC_SUFFIX:-.yaml.dec}"
^--------^ SC2034: DEC_SUFFIX appears unused. Verify use (or export if used externally).


In scripts/run.sh line 20:
DEC_DIR="${HELM_SECRETS_DEC_DIR:-}"
^-----^ SC2034: DEC_DIR appears unused. Verify use (or export if used externally).


In scripts/run.sh line 26:
. "${SCRIPT_DIR}/lib/file.sh"
  ^-------------------------^ SC1091: Not following: lib/file.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 29:
. "${SCRIPT_DIR}/lib/http.sh"
  ^-------------------------^ SC1091: Not following: lib/http.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 100:
        . "${SCRIPT_DIR}/commands/enc.sh"
          ^-----------------------------^ SC1091: Not following: commands/enc.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 112:
        . "${SCRIPT_DIR}/commands/dec.sh"
          ^-----------------------------^ SC1091: Not following: commands/dec.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 124:
        . "${SCRIPT_DIR}/commands/view.sh"
          ^-- SC1091: Not following: commands/view.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 136:
        . "${SCRIPT_DIR}/commands/edit.sh"
          ^-- SC1091: Not following: commands/edit.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 148:
        . "${SCRIPT_DIR}/commands/clean.sh"
          ^-- SC1091: Not following: commands/clean.sh was not specified as input (see shellcheck -x).

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2034 -- DEC_DIR appears unused. Verify us...
  https://www.shellcheck.net/wiki/SC1091 -- Not following: commands/clean.sh ...

The files above have some shellcheck issues

shfmt output
--- scripts/lib/file/custom.sh.orig
+++ scripts/lib/file/custom.sh
@@ -1,17 +1,17 @@
 #!/usr/bin/env sh
 
 _file_custom_exists() {
-    _file_custom_get "$@" > /dev/null
+    _file_custom_get "$@" >/dev/null
 }
 
 _file_custom_get() {
     _tmp_file=$(mktemp)
-    helm template "${SCRIPT_DIR}/lib/file/helm-values-getter" -f "${1}" > "${_tmp_file}"
+    helm template "${SCRIPT_DIR}/lib/file/helm-values-getter" -f "${1}" >"${_tmp_file}"
     printf '%s' "${_tmp_file}"
 }
 
 _file_custom_put() {
     echo "Can't write to remote files!"
     exit 1
 }
 
--- scripts/lib/file/http.sh.orig
+++ scripts/lib/file/http.sh
@@ -1,17 +1,17 @@
 #!/usr/bin/env sh
 
 _file_http_exists() {
-    _file_http_get "$@" > /dev/null
+    _file_http_get "$@" >/dev/null
 }
 
 _file_http_get() {
     _tmp_file=$(mktemp)
-    download "${1}" > "${_tmp_file}"
+    download "${1}" >"${_tmp_file}"
     printf '%s' "${_tmp_file}"
 }
 
 _file_http_put() {
     echo "Can't write to remote files!"
     exit 1
 }
 
--- scripts/lib/file/local.sh.orig
+++ scripts/lib/file/local.sh
@@ -1,15 +1,15 @@
 #!/usr/bin/env sh
 
 _file_local_exists() {
     [ -f "${1}" ]
 }
 
 _file_local_get() {
     _file_local_exists "$@"
     printf '%s' "${1}"
 }
 
 _file_local_put() {
-    cat - > "${1}"
+    cat - >"${1}"
 }
 
--- scripts/lib/file.sh.orig
+++ scripts/lib/file.sh
@@ -1,51 +1,51 @@
 #!/usr/bin/env sh
 
 # shellcheck source=lib/file/local.sh
 . "${SCRIPT_DIR}/lib/file/local.sh"
 
 # shellcheck source=lib/file/http.sh
 . "${SCRIPT_DIR}/lib/file/http.sh"
 
 # shellcheck source=lib/file/custom.sh
 . "${SCRIPT_DIR}/lib/file/custom.sh"
 
 _file_get_protocol() {
     case "$1" in
-        /* | \*)
-            echo "local"
-            ;;
-        http*)
-            echo "http"
-            ;;
-        *)
-            echo "custom"
-            ;;
+    /* | \*)
+        echo "local"
+        ;;
+    http*)
+        echo "http"
+        ;;
+    *)
+        echo "custom"
+        ;;
     esac
 }
 
 _file_exists() {
     file_type=$(_file_get_protocol "${1}")
 
     _file_"${file_type}"_exists "$@"
 }
 
 _file_get() {
     file_type=$(_file_get_protocol "${1}")
 
     _file_"${file_type}"_get "$@"
 }
 
 _file_put() {
     file_type=$(_file_get_protocol "${1}")
 
     _file_"${file_type}"_put "$@"
 }
 
 _file_dec_name() {
     if [ "${DEC_DIR}" != "" ]; then
         printf '%s' "${DEC_DIR}/$(basename "${1}" ".yaml")${DEC_SUFFIX}"
     else
         printf '%s' "$(dirname "${1}")/$(basename "${1}" ".yaml")${DEC_SUFFIX}"
     fi
 }
 

The files above have some formatting problems, you can use shfmt -w to fix them

To get the full details about this job

@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2020

sh-checker report

shellcheck output

In scripts/install.sh line 9:
. "${SCRIPT_DIR}/lib/http.sh"
  ^-------------------------^ SC1091: Not following: lib/http.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 4:
. "${SCRIPT_DIR}/lib/file/local.sh"
  ^-- SC1091: Not following: lib/file/local.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 7:
. "${SCRIPT_DIR}/lib/file/http.sh"
  ^-- SC1091: Not following: lib/file/http.sh was not specified as input (see shellcheck -x).


In scripts/lib/file.sh line 10:
. "${SCRIPT_DIR}/lib/file/custom.sh"
  ^-- SC1091: Not following: lib/file/custom.sh was not specified as input (see shellcheck -x).


In scripts/lib/http.sh line 1:
download() {
^-- SC2148: Tips depend on target shell and yours is unknown. Add a shebang or a 'shell' directive.


In scripts/run.sh line 19:
DEC_SUFFIX="${HELM_SECRETS_DEC_SUFFIX:-.yaml.dec}"
^--------^ SC2034: DEC_SUFFIX appears unused. Verify use (or export if used externally).


In scripts/run.sh line 20:
DEC_DIR="${HELM_SECRETS_DEC_DIR:-}"
^-----^ SC2034: DEC_DIR appears unused. Verify use (or export if used externally).


In scripts/run.sh line 26:
. "${SCRIPT_DIR}/lib/file.sh"
  ^-------------------------^ SC1091: Not following: lib/file.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 29:
. "${SCRIPT_DIR}/lib/http.sh"
  ^-------------------------^ SC1091: Not following: lib/http.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 100:
        . "${SCRIPT_DIR}/commands/enc.sh"
          ^-----------------------------^ SC1091: Not following: commands/enc.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 112:
        . "${SCRIPT_DIR}/commands/dec.sh"
          ^-----------------------------^ SC1091: Not following: commands/dec.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 124:
        . "${SCRIPT_DIR}/commands/view.sh"
          ^-- SC1091: Not following: commands/view.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 136:
        . "${SCRIPT_DIR}/commands/edit.sh"
          ^-- SC1091: Not following: commands/edit.sh was not specified as input (see shellcheck -x).


In scripts/run.sh line 148:
        . "${SCRIPT_DIR}/commands/clean.sh"
          ^-- SC1091: Not following: commands/clean.sh was not specified as input (see shellcheck -x).

For more information:
  https://www.shellcheck.net/wiki/SC2148 -- Tips depend on target shell and y...
  https://www.shellcheck.net/wiki/SC2034 -- DEC_DIR appears unused. Verify us...
  https://www.shellcheck.net/wiki/SC1091 -- Not following: commands/clean.sh ...

The files above have some shellcheck issues

shfmt output
No errors or shfmt is disabled

The files above have some formatting problems, you can use shfmt -w to fix them

To get the full details about this job

@jkroepke jkroepke force-pushed the remote-file branch 7 times, most recently from 717f47f to 9330e85 Compare November 1, 2020 13:27
@github-actions
Copy link
Contributor

github-actions bot commented Nov 1, 2020

sh-checker report

shellcheck output
No errors or shellcheck is disabled

The files above have some shellcheck issues

shfmt output
--- scripts/commands/helm.sh.orig
+++ scripts/commands/helm.sh
@@ -1,122 +1,122 @@
 #!/usr/bin/env sh
 
 set -eu
 
 # shellcheck disable=SC1090
 . "${SCRIPT_DIR}/commands/dec.sh"
 
 helm_command_usage() {
     cat <<EOF
 helm secrets $1 [ --driver <driver> | -d <driver> ] [ --quiet | -q ]
 
 This is a wrapper for "helm [command]". It will detect -f and
 --values options, and decrypt any encrypted *.yaml files before running "helm
 [command]".
 
 Example:
   $ helm secrets upgrade <HELM UPGRADE OPTIONS>
   $ helm secrets lint <HELM LINT OPTIONS>
 
 Typical usage:
   $ helm secrets upgrade i1 stable/nginx-ingress -f values.test.yaml -f secrets.test.yaml
   $ helm secrets lint ./my-chart -f values.test.yaml -f secrets.test.yaml
 
 EOF
 }
 
 _trap_hook() {
     # if variable is set and not empty combined with set -u
     # https://serverfault.com/a/382740
-    if [ -n "${decrypted_files+x}" ] && [ -n "${decrypted_files-x}" ] ; then
+    if [ -n "${decrypted_files+x}" ] && [ -n "${decrypted_files-x}" ]; then
         if [ "${QUIET}" = "false" ]; then
             echo >&2
             # shellcheck disable=SC2016
             xargs -0 -n1 sh -c 'rm "$1" && printf "[helm-secrets] Removed: %s\n" "$1"' sh >&2 <"${decrypted_files}"
         else
             xargs -0 rm >&2 <"${decrypted_files}"
         fi
 
         rm "${decrypted_files}"
     fi
 }
 
 helm_wrapper() {
     decrypted_files=$(mktemp)
 
     argc=$#
     j=0
 
     while [ $j -lt $argc ]; do
         case "$1" in
         --)
             # skip --, and what remains are the cmd args
             set -- "$1"
             shift
             break
             ;;
         -f | --values | --values=?*)
             case "$1" in
             *=*)
                 file="${1#*=}"
 
                 set -- "$@" "${1%%=*}"
                 ;;
             *)
                 file="${2}"
 
                 set -- "$@" "$1"
                 shift
                 j=$((j + 1))
                 ;;
             esac
 
             if ! real_file=$(_file_get "${file}"); then
                 printf '[helm-secrets] File does not exist: %s\n' "${file}"
                 exit 1
             fi
 
             file_dec="$(_file_dec_name "${real_file}")"
             if [ -f "${file_dec}" ]; then
                 set -- "$@" "$file_dec"
 
                 if [ "${QUIET}" = "false" ]; then
                     printf '[helm-secrets] Decrypt skipped: %s' "${file}" >&2
                 fi
             else
                 if decrypt_helper "${real_file}"; then
                     set -- "$@" "$file_dec"
                     printf '%s\0' "${file_dec}" >>"${decrypted_files}"
 
                     if [ "${QUIET}" = "false" ]; then
                         printf '[helm-secrets] Decrypt: %s' "${file}" >&2
                     fi
                 else
                     set -- "$@" "$file"
                 fi
             fi
             ;;
         *)
             set -- "$@" "$1"
             ;;
         esac
 
         shift
         j=$((j + 1))
     done
 
     if [ "${QUIET}" = "false" ]; then
         echo >&2
     fi
 
     "${HELM_BIN}" ${TILLER_HOST:+--host "$TILLER_HOST"} "$@"
 }
 
 helm_command() {
     if [ $# -lt 2 ] || is_help "$2"; then
         helm_command_usage "${1:-"[helm command]"}"
         return
     fi
 
     helm_wrapper "$@"
 }
 

The files above have some formatting problems, you can use shfmt -w to fix them

To get the full details about this job

@jkroepke jkroepke force-pushed the remote-file branch 4 times, most recently from 47130f6 to 74c9639 Compare November 1, 2020 14:47
@jkroepke jkroepke merged commit 0c5b62d into master Nov 1, 2020
@jkroepke jkroepke deleted the remote-file branch November 1, 2020 15:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant