mirror of
https://github.com/super-linter/super-linter.git
synced 2024-12-22 12:42:09 -05:00
Change directory to ANSIBLE_DIRECTORY before running ansible-lint and enable autodetection (#3350)
* Change directory to ANSIBLE_DIRECTORY before running ansible-lint * move log so we see it * Don't pass the directory to enable autodetection
This commit is contained in:
parent
66a08db2b3
commit
2d7b73b7b9
3 changed files with 5 additions and 9 deletions
|
@ -283,7 +283,6 @@ But if you wish to select or exclude specific linters, we give you full control
|
|||
| **ACTIONS_RUNNER_DEBUG** | `false` | Flag to enable additional information about the linter, versions, and additional output. |
|
||||
| **ANSIBLE_CONFIG_FILE** | `.ansible-lint.yml` | Filename for [Ansible-lint configuration](https://ansible-lint.readthedocs.io/en/latest/configuring.html#configuration-file) (ex: `.ansible-lint`, `.ansible-lint.yml`) |
|
||||
| **ANSIBLE_DIRECTORY** | `/ansible` | Flag to set the root directory for Ansible file location(s), relative to `DEFAULT_WORKSPACE`. Set to `.` to use the top-level of the `DEFAULT_WORKSPACE`. |
|
||||
| **ANSIBLE_ROLES_PATH** | `${ANSIBLE_DIRECTORY}/roles` | Path to the Ansible roles directory. |
|
||||
| **CSS_FILE_NAME** | `.stylelintrc.json` | Filename for [Stylelint configuration](https://github.com/stylelint/stylelint) (ex: `.stylelintrc.yml`, `.stylelintrc.yaml`) |
|
||||
| **DEFAULT_BRANCH** | `master` | The name of the repository default branch. |
|
||||
| **DEFAULT_WORKSPACE** | `/tmp/lint` | The location containing files to lint if you are running locally. |
|
||||
|
|
|
@ -194,10 +194,12 @@ function LintCodebase() {
|
|||
# Check for ansible #
|
||||
#####################
|
||||
if [[ ${FILE_TYPE} == "ANSIBLE" ]]; then
|
||||
debug "ANSIBLE_DIRECTORY: ${ANSIBLE_DIRECTORY}, LINTER_COMMAND:${LINTER_COMMAND}, FILE: ${FILE}"
|
||||
LINT_CMD=$(
|
||||
debug "ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}, LINTER_COMMAND:${LINTER_COMMAND}, FILE: ${FILE}"
|
||||
cd "${WORKSPACE_PATH}" || exit
|
||||
ANSIBLE_ROLES_PATH=${ANSIBLE_ROLES_PATH} ${LINTER_COMMAND} "${FILE}" 2>&1
|
||||
cd "${ANSIBLE_DIRECTORY}" || exit
|
||||
# Don't pass the file to lint to enable ansible-lint autodetection mode.
|
||||
# See https://ansible-lint.readthedocs.io/usage for details
|
||||
${LINTER_COMMAND} 2>&1
|
||||
)
|
||||
####################################
|
||||
# Corner case for pwsh subshell #
|
||||
|
|
|
@ -853,11 +853,6 @@ export DEFAULT_TEST_CASE_ANSIBLE_DIRECTORY
|
|||
############################
|
||||
GetValidationInfo
|
||||
|
||||
# Now ANSIBLE_DIRECTORY is set
|
||||
ANSIBLE_ROLES_PATH="${ANSIBLE_ROLES_PATH:-"${ANSIBLE_DIRECTORY}/roles"}"
|
||||
debug "Setting ANSIBLE_ROLES_PATH to: ${ANSIBLE_ROLES_PATH}..."
|
||||
export ANSIBLE_ROLES_PATH
|
||||
|
||||
#################################
|
||||
# Get the linter rules location #
|
||||
#################################
|
||||
|
|
Loading…
Reference in a new issue