diff --git a/.circleci/config.yml b/.circleci/config.yml index 8eb926125a4..967c2fb8e0e 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -1,3 +1,4 @@ +--- version: 2.1 jobs: diff --git a/.codacy.yml b/.codacy.yml index 8f684149122..47af1b0d464 100644 --- a/.codacy.yml +++ b/.codacy.yml @@ -1,5 +1,6 @@ +--- exclude_paths: -- vendor/**/* -- tests/**/* -- "**_test.go" -- contrib/* + - vendor/**/* + - tests/**/* + - "**_test.go" + - contrib/* diff --git a/.github/linters/.markdown-lint.yml b/.github/linters/.markdown-lint.yml new file mode 100644 index 00000000000..2b7650bb297 --- /dev/null +++ b/.github/linters/.markdown-lint.yml @@ -0,0 +1,10 @@ +--- +default: true + +# Line length +# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md013 +MD013: false + +# Inline HTML +# https://github.com/DavidAnson/markdownlint/blob/main/doc/Rules.md#md033 +MD033: false diff --git a/.github/linters/.yamllint.yml b/.github/linters/.yamllint.yml new file mode 100644 index 00000000000..75da2b7021e --- /dev/null +++ b/.github/linters/.yamllint.yml @@ -0,0 +1,5 @@ +--- +extends: default + +rules: + line-length: disable diff --git a/.github/workflows/bump-formula.yml b/.github/workflows/bump-formula.yml index 13d4ae3bfc5..c3e2e5ceab4 100644 --- a/.github/workflows/bump-formula.yml +++ b/.github/workflows/bump-formula.yml @@ -1,23 +1,26 @@ +--- name: bump-formula + +# yamllint disable-line rule:truthy on: push: - tags: - - '*' + tags: + - '*' jobs: bump-formula: runs-on: macos-latest steps: - - name: Checkout repository - uses: actions/checkout@v2 - - name: Get version - id: get_version - run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} - - name: Bump Brew - env: - HOMEBREW_GITHUB_USERNAME: ${{ secrets.HOMEBREW_GITHUB_USERNAME }} - HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} - run: | - git config --global user.name 'Dokku Bot' - git config --global user.email no-reply@dokku.com - brew tap dokku/repo "https://$HOMEBREW_GITHUB_USERNAME:$HOMEBREW_GITHUB_API_TOKEN@github.com/dokku/homebrew-repo.git" - brew bump-formula-pr -f --no-browse --no-audit --no-fork --url "https://github.com/dokku/dokku/archive/${{ steps.get_version.outputs.version }}.tar.gz" dokku/repo/dokku + - name: Checkout repository + uses: actions/checkout@v2 + - name: Get version + id: get_version + run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//} + - name: Bump Brew + env: + HOMEBREW_GITHUB_USERNAME: ${{ secrets.HOMEBREW_GITHUB_USERNAME }} + HOMEBREW_GITHUB_API_TOKEN: ${{ secrets.HOMEBREW_GITHUB_API_TOKEN }} + run: | + git config --global user.name 'Dokku Bot' + git config --global user.email no-reply@dokku.com + brew tap dokku/repo "https://$HOMEBREW_GITHUB_USERNAME:$HOMEBREW_GITHUB_API_TOKEN@github.com/dokku/homebrew-repo.git" + brew bump-formula-pr -f --no-browse --no-audit --no-fork --url "https://github.com/dokku/dokku/archive/${{ steps.get_version.outputs.version }}.tar.gz" dokku/repo/dokku diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdb4f331b4a..ed0f7c8aa78 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,5 +1,7 @@ +--- name: CI +# yamllint disable-line rule:truthy on: pull_request: branches: @@ -18,23 +20,23 @@ jobs: fail-fast: true steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: build package - run: ./tests/ci/setup.sh build + - name: build package + run: ./tests/ci/setup.sh build - - name: set matrix for build - id: set-matrix - run: | - json=$(python .github/commands/matrix) - echo $json - echo "::set-output name=matrix::$(echo "$json")" + - name: set matrix for build + id: set-matrix + run: | + json=$(python .github/commands/matrix) + echo $json + echo "::set-output name=matrix::$(echo "$json")" - - name: upload packages - uses: actions/upload-artifact@v2 - with: - name: build - path: build + - name: upload packages + uses: actions/upload-artifact@v2 + with: + name: build + path: build unit-tests: name: unit.${{ matrix.index }} @@ -45,30 +47,30 @@ jobs: matrix: ${{fromJson(needs.build.outputs.matrix)}} steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: download packages - uses: actions/download-artifact@v1 - with: - name: build + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build - - name: ci-setup - run: ./.github/commands/ci-setup + - name: ci-setup + run: ./.github/commands/ci-setup - # - name: start ssh session - # uses: luchihoratiu/debug-via-ssh@main - # with: - # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} - # SSH_PASS: ${{ secrets.SSH_PASS }} + # - name: start ssh session + # uses: luchihoratiu/debug-via-ssh@main + # with: + # NGROK_AUTH_TOKEN: ${{ secrets.NGROK_AUTH_TOKEN }} + # SSH_PASS: ${{ secrets.SSH_PASS }} - - name: run ci - timeout-minutes: 30 - run: sudo -E ./.github/commands/ci-run ${{ matrix.index }} + - name: run ci + timeout-minutes: 30 + run: sudo -E ./.github/commands/ci-run ${{ matrix.index }} - - uses: actions/upload-artifact@v2 - with: - name: test-results-${{ matrix.index }} - path: test-results + - uses: actions/upload-artifact@v2 + with: + name: test-results-${{ matrix.index }} + path: test-results docker-deploy-tests: name: docker @@ -78,22 +80,22 @@ jobs: fail-fast: false steps: - - uses: actions/checkout@v2 + - uses: actions/checkout@v2 - - name: download packages - uses: actions/download-artifact@v1 - with: - name: build + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build - - name: ci-setup - run: ./.github/commands/ci-setup + - name: ci-setup + run: ./.github/commands/ci-setup - - name: test docker deploys - shell: bash - timeout-minutes: 20 - run: | - ./tests/ci/setup.sh docker - DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker + - name: test docker deploys + shell: bash + timeout-minutes: 20 + run: | + ./tests/ci/setup.sh docker + DOKKU_SSH_PORT=3022 sudo -E make -e test-ci-docker go-tests: name: go.${{ matrix.index }} @@ -107,33 +109,33 @@ jobs: GITHUB_NODE_INDEX: ${{ matrix.index }} steps: - - uses: actions/checkout@v2 - - - name: download packages - uses: actions/download-artifact@v1 - with: - name: build - - - name: ci-setup - run: ./.github/commands/ci-setup - - - name: run go tests - run: | - export CIRCLE_SHA1=$GITHUB_SHA - echo "CODACY_TOKEN=$CODACY_TOKEN" - if [ "$CODACY_TOKEN" != "" ]; then - echo "Detected value for CODACY_TOKEN" - fi - case $GITHUB_NODE_INDEX in - 0) sudo -E make -e lint-ci go-tests ci-go-coverage ;; - 1) sudo -E make -e deploy-test-checks-root deploy-test-config ;; - 2) sudo -E make -e deploy-test-multi ;; - 3) sudo -E make -e deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;; - esac - - uses: actions/upload-artifact@v2 - with: - name: coverage.${{ matrix.index }} - path: test-results/coverage + - uses: actions/checkout@v2 + + - name: download packages + uses: actions/download-artifact@v1 + with: + name: build + + - name: ci-setup + run: ./.github/commands/ci-setup + + - name: run go tests + run: | + export CIRCLE_SHA1=$GITHUB_SHA + echo "CODACY_TOKEN=$CODACY_TOKEN" + if [ "$CODACY_TOKEN" != "" ]; then + echo "Detected value for CODACY_TOKEN" + fi + case $GITHUB_NODE_INDEX in + 0) sudo -E make -e lint-ci go-tests ci-go-coverage ;; + 1) sudo -E make -e deploy-test-checks-root deploy-test-config ;; + 2) sudo -E make -e deploy-test-multi ;; + 3) sudo -E make -e deploy-test-go-fail-predeploy deploy-test-go-fail-postdeploy ;; + esac + - uses: actions/upload-artifact@v2 + with: + name: coverage.${{ matrix.index }} + path: test-results/coverage publish-test-results: name: publish-test-results @@ -143,15 +145,15 @@ jobs: if: success() || failure() steps: - - name: download test-results - uses: actions/download-artifact@v2 - with: - path: test-results - - - name: Publish Unit Test Results - uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6 - with: - check_name: Unit Test Results - github_token: ${{ secrets.GITHUB_TOKEN }} - files: test-results/**/*.xml - comment_on_pr: false + - name: download test-results + uses: actions/download-artifact@v2 + with: + path: test-results + + - name: Publish Unit Test Results + uses: docker://ghcr.io/enricomi/publish-unit-test-result-action:v1.6 + with: + check_name: Unit Test Results + github_token: ${{ secrets.GITHUB_TOKEN }} + files: test-results/**/*.xml + comment_on_pr: false diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 879c9406fa5..a0cdd6d1a5a 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -1,3 +1,4 @@ +--- # For most projects, this workflow file will not need changing; you simply need # to commit it to your repository. # @@ -12,12 +13,13 @@ name: "CodeQL" +# yamllint disable-line rule:truthy on: push: - branches: [ master ] + branches: [master] pull_request: # The branches below must be a subset of the branches above - branches: [ master ] + branches: [master] schedule: - cron: '18 22 * * 2' @@ -29,40 +31,40 @@ jobs: strategy: fail-fast: false matrix: - language: [ 'go' ] + language: ['go'] # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ] # Learn more: # https://docs.github.com/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed steps: - - name: Checkout repository - uses: actions/checkout@v2 + - name: Checkout repository + uses: actions/checkout@v2 - # Initializes the CodeQL tools for scanning. - - name: Initialize CodeQL - uses: github/codeql-action/init@v1 - with: - languages: ${{ matrix.language }} - # If you wish to specify custom queries, you can do so here or in a config file. - # By default, queries listed here will override any specified in a config file. - # Prefix the list here with "+" to use these queries and those in the config file. - # queries: ./path/to/local/query, your-org/your-repo/queries@main + # Initializes the CodeQL tools for scanning. + - name: Initialize CodeQL + uses: github/codeql-action/init@v1 + with: + languages: ${{ matrix.language }} + # If you wish to specify custom queries, you can do so here or in a config file. + # By default, queries listed here will override any specified in a config file. + # Prefix the list here with "+" to use these queries and those in the config file. + # queries: ./path/to/local/query, your-org/your-repo/queries@main - # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). - # If this step fails, then you should remove it and run the build manually (see below) - - name: Autobuild - uses: github/codeql-action/autobuild@v1 + # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). + # If this step fails, then you should remove it and run the build manually (see below) + - name: Autobuild + uses: github/codeql-action/autobuild@v1 - # â„šī¸ Command-line programs to run using the OS shell. - # 📚 https://git.io/JvXDl + # â„šī¸ Command-line programs to run using the OS shell. + # 📚 https://git.io/JvXDl - # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines - # and modify them (or add more) to build your code if your project - # uses a compiled language + # âœī¸ If the Autobuild fails above, remove it and uncomment the following three lines + # and modify them (or add more) to build your code if your project + # uses a compiled language - #- run: | - # make bootstrap - # make release + # - run: | + # make bootstrap + # make release - - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v1 + - name: Perform CodeQL Analysis + uses: github/codeql-action/analyze@v1 diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000000..2bc8a8937f9 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,74 @@ +--- +name: 'lint' + +# yamllint disable-line rule:truthy +on: + pull_request: + branches: + - '*' + push: + branches: + - 'master' + +jobs: + hadolint: + name: hadolint + runs-on: ubuntu-20.04 + steps: + - name: Clone + uses: actions/checkout@v2 + - name: Run hadolint + uses: brpaz/hadolint-action@1623ba61710b974b55ba455930e6f2c8ef919778 + # v1.3.1 => 1623ba61710b974b55ba455930e6f2c8ef919778 + + markdown-lint: + name: markdown-lint + runs-on: ubuntu-20.04 + steps: + - name: Clone + uses: actions/checkout@v2 + - name: Run markdown-lint + uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb + # v1.5.0 => 04d43ee9191307b50935a753da3b775ab695eceb + with: + config: '.github/linters/.markdown-lint.yml' + args: './README.md' + + shellcheck: + name: shellcheck + runs-on: ubuntu-20.04 + steps: + - name: Clone + uses: actions/checkout@v2 + - name: Run shellcheck + uses: ludeeus/action-shellcheck@d586102c117f97e63d7e3b56629d269efc9a7c60 + # 1.0.0 => d586102c117f97e63d7e3b56629d269efc9a7c60 + env: + # keep in sync with tests/shellcheck-exclude + SHELLCHECK_OPTS: -e SC1001 -e SC1003 -e SC1090 -e SC1091 -e SC1117 -e SC2029 -e SC2034 -e SC2046 -e SC2064 -e SC2068 -e SC2086 -e SC2119 -e SC2120 -e SC2128 -e SC2148 -e SC2153 -e SC2154 -e SC2155 -e SC2162 -e SC2174 -e SC2179 -e SC2191 -e SC2199 -e SC2207 -e SC2219 -e SC2220 -e SC2230 -e SC2231 -e SC2235 + + shfmt: + name: shfmt + runs-on: ubuntu-20.04 + steps: + - name: Clone + uses: actions/checkout@v2 + - name: Run shfmt + uses: luizm/action-sh-checker@442951059cb22d260c6e69309ae59cb7bb2334b8 + # v0.1.12 => 442951059cb22d260c6e69309ae59cb7bb2334b8 + env: + SHFMT_OPTS: -l -bn -ci -i 2 -d + with: + sh_checker_shellcheck_disable: true + + yamllint: + name: yamllint + runs-on: ubuntu-20.04 + steps: + - name: Clone + uses: actions/checkout@v2 + - name: Run yamllint + uses: ibiqlik/action-yamllint@b2aeacc1b7eeb8c23e84bba320d04fb5d6a323ee + # v3.0.0 => b2aeacc1b7eeb8c23e84bba320d04fb5d6a323ee + with: + config_file: '.github/linters/.yamllint.yml' diff --git a/Dockerfile b/Dockerfile index 5abcd612674..fc7621f6a09 100644 --- a/Dockerfile +++ b/Dockerfile @@ -15,6 +15,9 @@ RUN addgroup --gid $DOKKU_GID dokku \ COPY ./tests/dhparam.pem /tmp/dhparam.pem COPY ./build/dokku.deb /tmp/dokku.deb + +SHELL ["/bin/bash", "-o", "pipefail", "-c"] +# hadolint ignore=DL3005,DL3008 RUN echo "dokku dokku/hostname string $DOKKU_HOSTNAME" | debconf-set-selections \ && echo "dokku dokku/skip_key_file boolean $DOKKU_SKIP_KEY_FILE" | debconf-set-selections \ && echo "dokku dokku/vhost_enable boolean $DOKKU_VHOST_ENABLE" | debconf-set-selections \ diff --git a/README.md b/README.md index 70cde6e6c98..6ba83d85eb9 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Dokku + [![Build Status](https://github.com/dokku/dokku/workflows/CI/badge.svg)](https://github.com/dokku/dokku/actions?query=workflow%3ACI) [![Ubuntu Package](https://img.shields.io/badge/package-ubuntu-brightgreen.svg?style=flat-square "Ubuntu Package")](https://packagecloud.io/dokku/dokku) [![Arch Package](https://img.shields.io/badge/package-arch-brightgreen.svg?style=flat-square "Arch Package")](https://aur.archlinux.org/packages/dokku/) @@ -46,7 +47,6 @@ Become a sponsor and get your logo on our README on Github with a link to your s - ## Backers Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/dokku#backer)] diff --git a/plugins/20_events/help-functions b/plugins/20_events/help-functions index 610242adabf..a9fcfe7ab8a 100755 --- a/plugins/20_events/help-functions +++ b/plugins/20_events/help-functions @@ -8,8 +8,8 @@ cmd-events-help() { local plugin_name="events" local plugin_description="Manage event logging" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/builder-cnb/builder-build b/plugins/builder-cnb/builder-build index 8ef42adfab6..22f98900f9f 100755 --- a/plugins/builder-cnb/builder-build +++ b/plugins/builder-cnb/builder-build @@ -13,7 +13,6 @@ trigger-builder-cnb-builder-build() { return fi - local stack="$(plugn trigger buildpack-stack-name "$APP")" if [[ -z "$stack" ]]; then DOKKU_CNB_STACK="$stack" @@ -32,7 +31,7 @@ trigger-builder-cnb-builder-build() { local TMP_FILE=$(mktemp "/tmp/dokku-${DOKKU_PID}-${FUNCNAME[0]}.XXXXXX") trap "rm -rf '$TMP_FILE' >/dev/null" RETURN INT TERM - config_export app "$APP" --format envfile --merged > "$TMP_FILE" + config_export app "$APP" --format envfile --merged >"$TMP_FILE" plugn trigger pre-build-cnb "$APP" "$SOURCECODE_WORK_DIR" diff --git a/plugins/certs/help-functions b/plugins/certs/help-functions index 0aefc2a0bbd..1a676c4dc33 100755 --- a/plugins/certs/help-functions +++ b/plugins/certs/help-functions @@ -8,8 +8,8 @@ cmd-certs-help() { local plugin_name="certs" local plugin_description="Manage SSL (TLS) certs" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/checks/help-functions b/plugins/checks/help-functions index d01d0c64d43..b5328dbafb5 100755 --- a/plugins/checks/help-functions +++ b/plugins/checks/help-functions @@ -8,8 +8,8 @@ cmd-checks-help() { local plugin_name="checks" local plugin_description="Manage zero-downtime settings" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/common/functions b/plugins/common/functions index b5838af23d0..97aeef6757d 100755 --- a/plugins/common/functions +++ b/plugins/common/functions @@ -148,14 +148,14 @@ dokku_log_exit() { dokku_log_fail_quiet() { declare desc="log fail formatter" if [[ -z "$DOKKU_QUIET_OUTPUT" ]]; then - echo " ! $@" 1>&2 + echo " ! $*" 1>&2 fi exit 1 } dokku_log_fail() { declare desc="log fail formatter" - echo " ! $@" 1>&2 + echo " ! $*" 1>&2 exit 1 } @@ -917,7 +917,7 @@ get_app_urls() { if [[ -n "$urls" ]]; then echo "$urls" | sort else - internal_get_app_urls "$URL_TYPE" "$APP" + internal_get_app_urls "$URL_TYPE" "$APP" | sort fi } diff --git a/plugins/docker-options/functions b/plugins/docker-options/functions index 716e901779c..e28e78f47a1 100755 --- a/plugins/docker-options/functions +++ b/plugins/docker-options/functions @@ -23,6 +23,7 @@ get_phase_file_path() { get_phases() { declare desc="returns array of passed passes if all are in allowed array" local passed_phases_list="$1" + # shellcheck disable=SC2001 local -r phases_allowed=$(sed -e 's/ /\|/g' <<<"${AVAILABLE_PHASES[@]}") local phase local passed_phases diff --git a/plugins/docker-options/help-functions b/plugins/docker-options/help-functions index 3635b8c3c99..71d8c427a51 100755 --- a/plugins/docker-options/help-functions +++ b/plugins/docker-options/help-functions @@ -8,8 +8,8 @@ cmd-docker-options-help() { local plugin_name="docker-options" local plugin_description="Manage docker options for an app" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/domains/functions b/plugins/domains/functions index 64bfcdea7d9..4c2874f08df 100755 --- a/plugins/domains/functions +++ b/plugins/domains/functions @@ -54,7 +54,7 @@ domains_add() { done for DOMAIN in "$@"; do - if grep -x --line-regexp --fixed-strings "$DOMAIN" "$APP_VHOST_PATH" 2> /dev/null; then + if grep -x --line-regexp --fixed-strings "$DOMAIN" "$APP_VHOST_PATH" 2>/dev/null; then dokku_log_info1 "Skipping: $DOMAIN already added to $APP" else echo "$DOMAIN" >>"$APP_VHOST_PATH" @@ -149,7 +149,7 @@ domains_add_global() { done for DOMAIN in "$@"; do - if grep -q --line-regexp --fixed-strings "$DOMAIN" "$GLOBAL_VHOST_PATH" 2> /dev/null; then + if grep -q --line-regexp --fixed-strings "$DOMAIN" "$GLOBAL_VHOST_PATH" 2>/dev/null; then dokku_log_info1 "Skipping $DOMAIN: already added" else echo "$DOMAIN" >>"$GLOBAL_VHOST_PATH" diff --git a/plugins/domains/help-functions b/plugins/domains/help-functions index 1221ccf06de..0f66a8734b8 100755 --- a/plugins/domains/help-functions +++ b/plugins/domains/help-functions @@ -8,8 +8,8 @@ cmd-domains-help() { local plugin_name="domains" local plugin_description="Manage domains used by the proxy" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/enter/help-functions b/plugins/enter/help-functions index 3df2892e5ee..71ffdbe1d99 100755 --- a/plugins/enter/help-functions +++ b/plugins/enter/help-functions @@ -8,8 +8,8 @@ cmd-enter-help() { local plugin_name="enter" local plugin_description="Enter running app containers" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/git/help-functions b/plugins/git/help-functions index 72d075bf3be..35841f06215 100755 --- a/plugins/git/help-functions +++ b/plugins/git/help-functions @@ -8,8 +8,8 @@ cmd-git-help() { local plugin_name="git" local plugin_description="Manage app deploys via git" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/git/internal-functions b/plugins/git/internal-functions index 95af4eeca81..74df9a47608 100755 --- a/plugins/git/internal-functions +++ b/plugins/git/internal-functions @@ -11,7 +11,7 @@ cmd-git-allow-host() { declare HOST="$1" [[ -z "$HOST" ]] && dokku_log_fail "Please supply a git host" - ssh-keyscan -t rsa "$HOST" >> "$DOKKU_ROOT/.ssh/known_hosts" + ssh-keyscan -t rsa "$HOST" >>"$DOKKU_ROOT/.ssh/known_hosts" dokku_log_info1 "$HOST added to known hosts" } @@ -215,19 +215,19 @@ fn-git-fetch() { fi DOKKU_DEPLOY_BRANCH="$(fn-git-deploy-branch "$APP")" - if ! git -C "$APP_ROOT" check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then + if ! git -C "$APP_ROOT" check-ref-format --branch "$DOKKU_DEPLOY_BRANCH" >/dev/null 2>&1; then echo $'\e[1G\e[K'"-----> WARNING: Invalid branch name '$DOKKU_DEPLOY_BRANCH' specified via DOKKU_DEPLOY_BRANCH." echo $'\e[1G\e[K'"-----> For more details, please see the man page for 'git-check-ref-format.'" return fi - git -C "$APP_ROOT" remote rm remote > /dev/null 2>&1 || true - git -C "$APP_ROOT" remote add --mirror=fetch --no-tags remote "$GIT_REMOTE" + git -C "$APP_ROOT" remote rm remote >/dev/null 2>&1 || true + git -C "$APP_ROOT" remote add --mirror=fetch --no-tags remote "$GIT_REMOTE" if [[ -z "$GIT_REF" ]]; then - git -C "$APP_ROOT" fetch --update-head-ok remote "$DOKKU_DEPLOY_BRANCH" + git -C "$APP_ROOT" fetch --update-head-ok remote "$DOKKU_DEPLOY_BRANCH" else - git -C "$APP_ROOT" fetch --update-head-ok remote - git -C "$APP_ROOT" update-ref "refs/heads/$DOKKU_DEPLOY_BRANCH" "$GIT_REF" + git -C "$APP_ROOT" fetch --update-head-ok remote + git -C "$APP_ROOT" update-ref "refs/heads/$DOKKU_DEPLOY_BRANCH" "$GIT_REF" fi } diff --git a/plugins/nginx-vhosts/help-functions b/plugins/nginx-vhosts/help-functions index ad8ba634bfb..f34f32b024d 100755 --- a/plugins/nginx-vhosts/help-functions +++ b/plugins/nginx-vhosts/help-functions @@ -8,8 +8,8 @@ cmd-nginx-vhosts-help() { local plugin_name="nginx" local plugin_description="Manage the nginx proxy" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/plugin/help-functions b/plugins/plugin/help-functions index b30b86660f9..90904561266 100755 --- a/plugins/plugin/help-functions +++ b/plugins/plugin/help-functions @@ -8,8 +8,8 @@ cmd-plugin-help() { local plugin_name="plugin" local plugin_description="Manage installed plugins" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/scheduler-docker-local/check-deploy b/plugins/scheduler-docker-local/check-deploy index c44355704f9..b8d80c472e5 100755 --- a/plugins/scheduler-docker-local/check-deploy +++ b/plugins/scheduler-docker-local/check-deploy @@ -209,6 +209,7 @@ trigger-scheduler-docker-local-check-deploy() { # shellcheck disable=SC2086 if OUTPUT=$(curl -# $CURL_ARGS 2>&1); then # OUTPUT contains the HTTP response + # shellcheck disable=SC2076 if [[ "$OUTPUT" =~ "$EXPECTED" ]]; then SUCCESS=1 break diff --git a/plugins/scheduler-docker-local/help-functions b/plugins/scheduler-docker-local/help-functions index cdfa2d3ba8d..97f67800de3 100755 --- a/plugins/scheduler-docker-local/help-functions +++ b/plugins/scheduler-docker-local/help-functions @@ -8,8 +8,8 @@ cmd-scheduler-docker-local-help() { local plugin_name="scheduler-docker-local" local plugin_description="Manage the docker-local scheduler integration for an app" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/scheduler-docker-local/pre-deploy b/plugins/scheduler-docker-local/pre-deploy index 04683217ffc..d9c2ef518ed 100755 --- a/plugins/scheduler-docker-local/pre-deploy +++ b/plugins/scheduler-docker-local/pre-deploy @@ -37,6 +37,7 @@ scheduler-docker-local-pre-deploy-chown-app() { CONTAINER_PATHS=$(echo "$APP_PATHS" | awk -F ':' '{ print $2 }' | xargs) DOCKER_ARGS=$(: | plugn trigger docker-args-deploy "$APP" "$IMAGE_TAG") # strip --restart args from DOCKER_ARGS + # shellcheck disable=SC2001 DOCKER_ARGS=$(sed -e "s/--restart=[[:graph:]]\+[[:blank:]]\?//g" <<<"$DOCKER_ARGS") eval "ARG_ARRAY=($DOCKER_ARGS)" fi diff --git a/plugins/shell/help-functions b/plugins/shell/help-functions index 9530cce290a..ea717ddd54c 100755 --- a/plugins/shell/help-functions +++ b/plugins/shell/help-functions @@ -8,8 +8,8 @@ cmd-shell-help() { local plugin_name="shell" local plugin_description="Interactive dokku prompt" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/ssh-keys/help-functions b/plugins/ssh-keys/help-functions index c26d3c196a0..262fb9e1c6b 100755 --- a/plugins/ssh-keys/help-functions +++ b/plugins/ssh-keys/help-functions @@ -8,8 +8,8 @@ cmd-ssh-keys-help() { local plugin_name="ssh-keys" local plugin_description="Manage public ssh keys used for deployment" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/storage/help-functions b/plugins/storage/help-functions index b34df5296a5..ac324d47ba2 100755 --- a/plugins/storage/help-functions +++ b/plugins/storage/help-functions @@ -8,8 +8,8 @@ cmd-storage-help() { local plugin_name="storage" local plugin_description="Manage mounted volumes" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/tags/help-functions b/plugins/tags/help-functions index dbb013ecf97..412df03d00b 100755 --- a/plugins/tags/help-functions +++ b/plugins/tags/help-functions @@ -8,8 +8,8 @@ cmd-tags-help() { local plugin_name="tags" local plugin_description="Manage docker image tags" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/tar/help-functions b/plugins/tar/help-functions index 7418c7a3302..8ed7191c5c4 100755 --- a/plugins/tar/help-functions +++ b/plugins/tar/help-functions @@ -8,8 +8,8 @@ cmd-tar-help() { local plugin_name="tar" local plugin_description="Manage app deploys via tar" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/plugins/trace/help-functions b/plugins/trace/help-functions index 32a21e97fbd..8c3a35b4d8c 100755 --- a/plugins/trace/help-functions +++ b/plugins/trace/help-functions @@ -8,8 +8,8 @@ cmd-trace-help() { local plugin_name="trace" local plugin_description="Manage trace mode" - if [[ "$CMD" == "$plugin_name:help" ]]; then - echo -e "Usage: dokku $plugin_name[:COMMAND]" + if [[ "$CMD" == "${plugin_name}:help" ]]; then + echo -e "Usage: dokku ${plugin_name}[:COMMAND]" echo '' echo "$plugin_description" echo '' diff --git a/tests/apps/.websocket.disabled/check_deploy b/tests/apps/.websocket.disabled/check_deploy index 892f4708298..71e75979b9e 100755 --- a/tests/apps/.websocket.disabled/check_deploy +++ b/tests/apps/.websocket.disabled/check_deploy @@ -1,5 +1,5 @@ #!/usr/bin/env bash set -e output="$(curl -s -S -i -N -H \"Connection: Upgrade\" -H \"Upgrade: websocket\" -H \"Host: $1\" -H \"Origin: $1\" $1 -m 2)" -echo $output +echo "$output" test "$output" == "bazingaa" diff --git a/tests/apps/dockerfile-entrypoint/entrypoint b/tests/apps/dockerfile-entrypoint/entrypoint index 1b4625f4f45..680d30a2031 100755 --- a/tests/apps/dockerfile-entrypoint/entrypoint +++ b/tests/apps/dockerfile-entrypoint/entrypoint @@ -2,7 +2,7 @@ set -o pipefail if [[ "$1" == touch* ]]; then - echo "entrypoint script started with arguments $@" + echo "entrypoint script started with arguments $*" touch "$(echo $@ | awk '{print $2}')" else exec "$@" diff --git a/tests/ci/setup.sh b/tests/ci/setup.sh index aff1e503e99..1ce8ddc3694 100755 --- a/tests/ci/setup.sh +++ b/tests/ci/setup.sh @@ -77,7 +77,7 @@ install_dokku() { build_dokku fi - cat << EOF | sudo debconf-set-selections + cat <> "$APP_REPO_DIR/Procfile" + echo "release: touch /app/release.test" >>"$APP_REPO_DIR/Procfile" } add_requirements_txt() { local APP="$1" local APP_REPO_DIR="$2" [[ -z "$APP" ]] && local APP="$TEST_APP" - echo "flask" >> "$APP_REPO_DIR/requirements.txt" + echo "flask" >>"$APP_REPO_DIR/requirements.txt" } build_nginx_config() {