Merge pull request #4403 from dokku/lint-on-pr

Llint files during CI
This commit is contained in:
Jose Diaz-Gonzalez
2021-02-15 03:16:43 -05:00
committed by GitHub
38 changed files with 295 additions and 191 deletions

View File

@@ -1,3 +1,4 @@
---
version: 2.1
jobs:

View File

@@ -1,5 +1,6 @@
---
exclude_paths:
- vendor/**/*
- tests/**/*
- "**_test.go"
- contrib/*
- vendor/**/*
- tests/**/*
- "**_test.go"
- contrib/*

10
.github/linters/.markdown-lint.yml vendored Normal file
View File

@@ -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

5
.github/linters/.yamllint.yml vendored Normal file
View File

@@ -0,0 +1,5 @@
---
extends: default
rules:
line-length: disable

View File

@@ -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

View File

@@ -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
- 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: 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
- 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: 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: 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

View File

@@ -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

74
.github/workflows/lint.yml vendored Normal file
View File

@@ -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'

View File

@@ -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 \

View File

@@ -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
<a href="https://opencollective.com/dokku/sponsor/28/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/28/avatar.svg"></a>
<a href="https://opencollective.com/dokku/sponsor/29/website" target="_blank"><img src="https://opencollective.com/dokku/sponsor/29/avatar.svg"></a>
## Backers
Support us with a monthly donation and help us continue our activities. [[Become a backer](https://opencollective.com/dokku#backer)]

View File

@@ -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 ''

View File

@@ -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"

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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
}

View File

@@ -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

View File

@@ -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 ''

View File

@@ -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"

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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
}

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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

View File

@@ -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 ''

View File

@@ -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

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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 ''

View File

@@ -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"

View File

@@ -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 "$@"

View File

@@ -77,7 +77,7 @@ install_dokku() {
build_dokku
fi
cat << EOF | sudo debconf-set-selections
cat <<EOF | sudo debconf-set-selections
dokku dokku/hostname string dokku.me
dokku dokku/key_file string /root/.ssh/id_rsa.pub
dokku dokku/nginx_enable boolean true

View File

@@ -62,7 +62,7 @@ teardown() {
build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "http://test.dokku.me"
}
@test "(core) urls (app ssl)" {
@@ -71,7 +71,7 @@ teardown() {
build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://test.dokku.me"
}
@test "(core) url (app ssl)" {
@@ -87,9 +87,9 @@ teardown() {
build_nginx_config
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me"
add_domain "test.dokku.me"
assert_urls "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://${TEST_APP}.dokku.me" "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://test.dokku.me"
add_domain "dokku.example.com"
assert_urls "http://dokku.example.com" "http://test.dokku.me" "http://${TEST_APP}.dokku.me" "https://dokku.example.com" "https://test.dokku.me" "https://${TEST_APP}.dokku.me"
assert_urls "http://dokku.example.com" "http://${TEST_APP}.dokku.me" "https://dokku.example.com" "https://${TEST_APP}.dokku.me" "https://test.dokku.me" "http://test.dokku.me"
}
@test "(core) git-remote (off-port)" {

View File

@@ -258,7 +258,7 @@ assert_nonssl_domain() {
assert_app_domain() {
local domain=$1
run /bin/bash -c "dokku domains:report $TEST_APP --domains-app-vhosts | tr \" \" \"\n\" | grep -xF ${domain}"
echo "app domains: $(dokku domains:report "$TEST_APP" --domains-app-vhosts | tr \" \" \"\n\")"
echo "app domains: $(dokku domains:report "$TEST_APP" --domains-app-vhosts)"
echo "output: $output"
echo "status: $status"
assert_output "${domain}"
@@ -290,7 +290,7 @@ assert_not_external_port() {
}
assert_url() {
url=$1
url="$1"
run /bin/bash -c "dokku url $TEST_APP"
echo "output: $output"
echo "status: $status"
@@ -299,12 +299,13 @@ assert_url() {
}
assert_urls() {
urls=$@
run /bin/bash -c "dokku urls $TEST_APP"
# shellcheck disable=SC2124
urls="$@"
run /bin/bash -c "dokku urls $TEST_APP | xargs"
echo "output: $output"
echo "status: $status"
echo "urls:" "$(tr ' ' '\n' <<<"${urls}" | sort)"
assert_output < <(tr ' ' '\n' <<<"${urls}" | sort)
echo "urls:" "$urls"
assert_output "$urls"
}
deploy_app() {
@@ -510,14 +511,14 @@ add_release_command() {
local APP="$1"
local APP_REPO_DIR="$2"
[[ -z "$APP" ]] && local APP="$TEST_APP"
echo "release: touch /app/release.test" >> "$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() {