mirror of
https://github.com/super-linter/super-linter.git
synced 2024-11-21 16:21:00 -05:00
fix: github actions debug logging (#5288)
Enable debug logging when one (or more) of the following conditions is true: - ACTIONS_RUNNER_DEBUG is set to true - ACTIONS_STEPS_DEBUG is set to true - RUNNER_DEBUG is set to 1
This commit is contained in:
parent
f59a3bd7f2
commit
ed27c0146d
6 changed files with 63 additions and 19 deletions
|
@ -1,5 +1,5 @@
|
||||||
ACTIONS_RUNNER_DEBUG=true
|
|
||||||
DEFAULT_BRANCH=main
|
DEFAULT_BRANCH=main
|
||||||
DEFAULT_WORKSPACE=/workspaces/super-linter
|
DEFAULT_WORKSPACE=/workspaces/super-linter
|
||||||
ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true
|
ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true
|
||||||
|
LOG_LEVEL=DEBUG
|
||||||
RUN_LOCAL=true
|
RUN_LOCAL=true
|
||||||
|
|
2
.github/workflows/ci.yml
vendored
2
.github/workflows/ci.yml
vendored
|
@ -105,7 +105,7 @@ jobs:
|
||||||
- name: Test Local Action (debug log)
|
- name: Test Local Action (debug log)
|
||||||
uses: ./
|
uses: ./
|
||||||
env:
|
env:
|
||||||
ACTIONS_RUNNER_DEBUG: true
|
LOG_LEVEL: DEBUG
|
||||||
CREATE_LOG_FILE: true
|
CREATE_LOG_FILE: true
|
||||||
VALIDATE_ALL_CODEBASE: false
|
VALIDATE_ALL_CODEBASE: false
|
||||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
|
|
53
Makefile
53
Makefile
|
@ -4,7 +4,7 @@
|
||||||
all: info docker test ## Run all targets.
|
all: info docker test ## Run all targets.
|
||||||
|
|
||||||
.PHONY: test
|
.PHONY: test
|
||||||
test: info validate-container-image-labels test-lib inspec lint-codebase test-default-config-files test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-log-level test-linters-expect-failure-log-level-notice test-linters ## Run the test suite
|
test: info validate-container-image-labels test-lib inspec lint-codebase test-default-config-files test-actions-runner-debug test-actions-steps-debug test-runner-debug test-find lint-subset-files test-custom-ssl-cert test-non-default-workdir test-git-flags test-non-default-home-directory test-log-level test-linters-expect-failure-log-level-notice test-linters ## Run the test suite
|
||||||
|
|
||||||
# if this session isn't interactive, then we don't want to allocate a
|
# if this session isn't interactive, then we don't want to allocate a
|
||||||
# TTY, which would fail, but if it is interactive, we do want to attach
|
# TTY, which would fail, but if it is interactive, we do want to attach
|
||||||
|
@ -134,11 +134,44 @@ validate-container-image-labels: ## Validate container image labels
|
||||||
|
|
||||||
# For some cases, mount a directory that doesn't have too many files to keep tests short
|
# For some cases, mount a directory that doesn't have too many files to keep tests short
|
||||||
|
|
||||||
|
.PHONY: test-actions-runner-debug
|
||||||
|
test-actions-runner-debug: ## Run super-linter with ACTIONS_RUNNER_DEBUG=true
|
||||||
|
docker run \
|
||||||
|
-e ACTIONS_RUNNER_DEBUG=true \
|
||||||
|
-e RUN_LOCAL=true \
|
||||||
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
|
-e DEFAULT_BRANCH=main \
|
||||||
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
|
.PHONY: test-actions-steps-debug
|
||||||
|
test-actions-steps-debug: ## Run super-linter with ACTIONS_STEPS_DEBUG=true
|
||||||
|
docker run \
|
||||||
|
-e ACTIONS_STEPS_DEBUG=true \
|
||||||
|
-e RUN_LOCAL=true \
|
||||||
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
|
-e DEFAULT_BRANCH=main \
|
||||||
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
|
.PHONY: test-runner-debug
|
||||||
|
test-runner-debug: ## Run super-linter with RUNNER_DEBUG=1
|
||||||
|
docker run \
|
||||||
|
-e RUNNER_DEBUG=1 \
|
||||||
|
-e RUN_LOCAL=true \
|
||||||
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
|
-e DEFAULT_BRANCH=main \
|
||||||
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
-v "$(CURDIR)/.github":/tmp/lint/.github \
|
||||||
|
$(SUPER_LINTER_TEST_CONTAINER_URL)
|
||||||
|
|
||||||
.phony: test-find
|
.phony: test-find
|
||||||
test-find: ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
|
test-find: ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
@ -151,8 +184,7 @@ test-find: ## Run super-linter on a subdirectory with USE_FIND_ALGORITHM=true
|
||||||
test-non-default-workdir: ## Run super-linter with DEFAULT_WORKSPACE set
|
test-non-default-workdir: ## Run super-linter with DEFAULT_WORKSPACE set
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e ERROR_ON_MISSING_EXEC_BIT=true \
|
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e DEFAULT_WORKSPACE=/tmp/not-default-workspace \
|
-e DEFAULT_WORKSPACE=/tmp/not-default-workspace \
|
||||||
|
@ -165,8 +197,7 @@ test-non-default-workdir: ## Run super-linter with DEFAULT_WORKSPACE set
|
||||||
test-git-flags: ## Run super-linter with different git-related flags
|
test-git-flags: ## Run super-linter with different git-related flags
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e ERROR_ON_MISSING_EXEC_BIT=true \
|
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
|
@ -180,7 +211,7 @@ test-git-flags: ## Run super-linter with different git-related flags
|
||||||
lint-codebase: ## Lint the entire codebase
|
lint-codebase: ## Lint the entire codebase
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
||||||
|
@ -199,7 +230,7 @@ lint-subset-files: lint-subset-files-enable-only-one-type lint-subset-files-enab
|
||||||
lint-subset-files-enable-only-one-type: ## Lint a small subset of files in the codebase by enabling only one linter
|
lint-subset-files-enable-only-one-type: ## Lint a small subset of files in the codebase by enabling only one linter
|
||||||
time docker run \
|
time docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
||||||
|
@ -212,7 +243,7 @@ lint-subset-files-enable-only-one-type: ## Lint a small subset of files in the c
|
||||||
lint-subset-files-enable-expensive-io-checks: ## Lint a small subset of files in the codebase and keep expensive I/O operations to check file types enabled
|
lint-subset-files-enable-expensive-io-checks: ## Lint a small subset of files in the codebase and keep expensive I/O operations to check file types enabled
|
||||||
time docker run \
|
time docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
-e FILTER_REGEX_EXCLUDE=".*(/test/linters/|CHANGELOG.md).*" \
|
||||||
|
@ -270,7 +301,7 @@ test-validation: ## Test validation
|
||||||
test-default-config-files: ## Test default configuration files loading
|
test-default-config-files: ## Test default configuration files loading
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
@ -281,7 +312,7 @@ test-default-config-files: ## Test default configuration files loading
|
||||||
test-custom-ssl-cert: ## Test the configuration of a custom SSL/TLS certificate
|
test-custom-ssl-cert: ## Test the configuration of a custom SSL/TLS certificate
|
||||||
docker run \
|
docker run \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
-e ENABLE_GITHUB_ACTIONS_GROUP_TITLE=true \
|
||||||
-e DEFAULT_BRANCH=main \
|
-e DEFAULT_BRANCH=main \
|
||||||
-e USE_FIND_ALGORITHM=true \
|
-e USE_FIND_ALGORITHM=true \
|
||||||
|
|
|
@ -187,7 +187,6 @@ You can configure super-linter using the following environment variables:
|
||||||
|
|
||||||
| **Environment variable** | **Default Value** | **Description** |
|
| **Environment variable** | **Default Value** | **Description** |
|
||||||
|-------------------------------------------------|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
|-------------------------------------------------|---------------------------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
|
||||||
| **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.readthedocs.io/projects/lint/configuring/) (ex: `.ansible-lint`, `.ansible-lint.yml`) |
|
| **ANSIBLE_CONFIG_FILE** | `.ansible-lint.yml` | Filename for [Ansible-lint configuration](https://ansible.readthedocs.io/projects/lint/configuring/) (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_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`. |
|
||||||
| **BASH_SEVERITY** | `style` | Specify the minimum severity of errors to consider in shellcheck. Valid values in order of severity are error, warning, info and style. |
|
| **BASH_SEVERITY** | `style` | Specify the minimum severity of errors to consider in shellcheck. Valid values in order of severity are error, warning, info and style. |
|
||||||
|
@ -407,7 +406,7 @@ super-linter from a shell:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run \
|
docker run \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-v /path/to/local/codebase:/tmp/lint \
|
-v /path/to/local/codebase:/tmp/lint \
|
||||||
ghcr.io/super-linter/super-linter:latest
|
ghcr.io/super-linter/super-linter:latest
|
||||||
|
|
|
@ -9,7 +9,7 @@ You can run the container locally with the following configuration options to ru
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
docker run \
|
docker run \
|
||||||
-e ACTIONS_RUNNER_DEBUG=true \
|
-e LOG_LEVEL=DEBUG \
|
||||||
-e RUN_LOCAL=true \
|
-e RUN_LOCAL=true \
|
||||||
-v /path/to/local/codebase:/tmp/lint \
|
-v /path/to/local/codebase:/tmp/lint \
|
||||||
--rm \
|
--rm \
|
||||||
|
|
|
@ -4,9 +4,18 @@
|
||||||
# Debug Vars #
|
# Debug Vars #
|
||||||
# Define these early, so we can use debug logging ASAP if needed #
|
# Define these early, so we can use debug logging ASAP if needed #
|
||||||
##################################################################
|
##################################################################
|
||||||
|
# GitHub Actions variables to enable workflow debug logging
|
||||||
|
# Ref: https://docs.github.com/en/actions/monitoring-and-troubleshooting-workflows/enabling-debug-logging
|
||||||
|
# Ref: https://github.com/actions/runner/pull/253
|
||||||
declare -l ACTIONS_RUNNER_DEBUG
|
declare -l ACTIONS_RUNNER_DEBUG
|
||||||
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-"false"}" # Boolean to see even more info (debug)
|
ACTIONS_RUNNER_DEBUG="${ACTIONS_RUNNER_DEBUG:-"false"}"
|
||||||
IMAGE="${IMAGE:-standard}" # Version of the Super-linter (standard,slim,etc)
|
declare -l ACTIONS_STEPS_DEBUG
|
||||||
|
ACTIONS_STEPS_DEBUG="${ACTIONS_STEPS_DEBUG:-"false"}"
|
||||||
|
declare -i RUNNER_DEBUG
|
||||||
|
RUNNER_DEBUG="${RUNNER_DEBUG:-0}"
|
||||||
|
|
||||||
|
# Version of the Super-linter (standard,slim,etc)
|
||||||
|
IMAGE="${IMAGE:-standard}"
|
||||||
|
|
||||||
##################################################################
|
##################################################################
|
||||||
# Log Vars #
|
# Log Vars #
|
||||||
|
@ -17,7 +26,12 @@ LOG_LEVEL="${LOG_LEVEL:-"INFO"}"
|
||||||
declare -l CREATE_LOG_FILE
|
declare -l CREATE_LOG_FILE
|
||||||
CREATE_LOG_FILE="${CREATE_LOG_FILE:-"false"}"
|
CREATE_LOG_FILE="${CREATE_LOG_FILE:-"false"}"
|
||||||
|
|
||||||
if [[ ${ACTIONS_RUNNER_DEBUG} == true ]]; then LOG_LEVEL="DEBUG"; fi
|
if [[ ${ACTIONS_RUNNER_DEBUG} == true ]] ||
|
||||||
|
[[ ${ACTIONS_STEPS_DEBUG} == true ]] ||
|
||||||
|
[[ ${RUNNER_DEBUG} -eq 1 ]]; then
|
||||||
|
LOG_LEVEL="DEBUG"
|
||||||
|
echo "ACTIONS_RUNNER_DEBUG: ${ACTIONS_RUNNER_DEBUG}. ACTIONS_STEPS_DEBUG: ${ACTIONS_STEPS_DEBUG}. RUNNER_DEBUG: ${RUNNER_DEBUG}. Setting LOG_LEVEL to: ${LOG_LEVEL}"
|
||||||
|
fi
|
||||||
# Boolean to see debug logs
|
# Boolean to see debug logs
|
||||||
LOG_DEBUG=$(if [[ ${LOG_LEVEL} == "DEBUG" || ${LOG_LEVEL} == "TRACE" ]]; then echo "true"; fi)
|
LOG_DEBUG=$(if [[ ${LOG_LEVEL} == "DEBUG" || ${LOG_LEVEL} == "TRACE" ]]; then echo "true"; fi)
|
||||||
export LOG_DEBUG
|
export LOG_DEBUG
|
||||||
|
|
Loading…
Reference in a new issue