mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-13 20:39:33 -05:00
d2d73347d3
- Move USE_FIND_ALGORITHM and VALIDATE_ALL_CODEBASE validation in a dedicated function (ValidateFindMode). - Move ANSIBLE_DIRECTORY validation to a dedicated function (ValidateAnsibleDirectory). - Move VALIDATE_xxxx variables validation to a dedicated function (ValidateValidationVariables). - Mark ANY_SET, ANY_TRUE, ANY_FALSE as local because we don't need to reference them anywhere outside ValidateValidationVariables. - Add some debug statements in validation functions. - Merge the loops to initialize VALIDATE_xxx variables and to print enable/disable language debug messages. - Add tests for these validation functions. - Add test start message for all tests.
54 lines
1.5 KiB
Bash
Executable file
54 lines
1.5 KiB
Bash
Executable file
#!/usr/bin/env bash
|
|
|
|
set -o errexit
|
|
set -o nounset
|
|
set -o pipefail
|
|
|
|
# shellcheck disable=SC2034
|
|
CREATE_LOG_FILE=false
|
|
# Default log level
|
|
# shellcheck disable=SC2034
|
|
LOG_LEVEL="DEBUG"
|
|
|
|
# shellcheck source=/dev/null
|
|
source "lib/functions/log.sh"
|
|
|
|
GITHUB_DOMAIN="github.com"
|
|
# shellcheck disable=SC2034
|
|
GITHUB_META_URL="https://api.${GITHUB_DOMAIN}/meta"
|
|
|
|
# shellcheck source=/dev/null
|
|
source "lib/functions/setupSSH.sh"
|
|
|
|
function GetGitHubSshRsaKeyFingerprintTest() {
|
|
local FUNCTION_NAME
|
|
FUNCTION_NAME="${FUNCNAME[0]}"
|
|
info "${FUNCTION_NAME} start"
|
|
|
|
local SSH_RSA_KEY_FINGERPRINT
|
|
SSH_RSA_KEY_FINGERPRINT=$(GetGitHubSshRsaKeyFingerprint)
|
|
|
|
debug "SSH_RSA_KEY_FINGERPRINT: ${SSH_RSA_KEY_FINGERPRINT}"
|
|
local EXPECTED_GITHUB_RSA_KEY_FINGERPRINT
|
|
EXPECTED_GITHUB_RSA_KEY_FINGERPRINT="$(ssh-keygen -lf /dev/stdin <<<"$(ssh-keyscan -t rsa github.com)" | cut -d ' ' -f2)"
|
|
debug "Expected output: ${EXPECTED_GITHUB_RSA_KEY_FINGERPRINT}"
|
|
|
|
if [ "${SSH_RSA_KEY_FINGERPRINT}" != "${EXPECTED_GITHUB_RSA_KEY_FINGERPRINT}" ]; then
|
|
fatal "SSH_RSA_KEY_FINGERPRINT is not equal to ${EXPECTED_GITHUB_RSA_KEY_FINGERPRINT}: ${SSH_RSA_KEY_FINGERPRINT}"
|
|
fi
|
|
|
|
notice "${FUNCTION_NAME} PASS"
|
|
}
|
|
|
|
function SetupGithubComSshKeysTest() {
|
|
local FUNCTION_NAME
|
|
FUNCTION_NAME="${FUNCNAME[0]}"
|
|
info "${FUNCTION_NAME} start"
|
|
|
|
SSH_KEY="test_ssh_key" SSH_INSECURE_NO_VERIFY_GITHUB_KEY="false" SetupGithubComSshKeys
|
|
|
|
notice "${FUNCTION_NAME} PASS"
|
|
}
|
|
|
|
GetGitHubSshRsaKeyFingerprintTest
|
|
SetupGithubComSshKeysTest
|