|
ℹ️ Apologies for cross-posting as I'm not quite sure whether it's an issue or I'm missing something obvious — so posting as Q&A here with the hope for a better visibility. Original issue: #7410 I'm encountering an odd issue with Megalinter not posting comments to PR in BitBucket Cloud 😢 I followed the https://megalinter.io/latest/reporters/BitbucketCommentReporter/#configuration and created repository token and added it as repository secured var: This is what I see in pipeline logs:
# MegaLinter Bitbucket Pipelines configuration file
# More info at https://megalinter.io
---
image: atlassian/default-image:5
pipelines:
default:
- parallel:
- step:
name: Run MegaLinter
image: oxsecurity/megalinter:v9
script:
# Disable LLM Advisor for bot PRs (dependabot, renovate, etc.)
# Note: Bitbucket has limited access to PR metadata, this is a basic check
- |
if [[ "$BITBUCKET_BRANCH" =~ ^(dependabot|renovate)/ ]] ||
[[ "$BITBUCKET_PR_TITLE" =~ ^(chore|fix|deps?|bump)(\(.*\))?: ]] ||
[[ "$BITBUCKET_STEP_TRIGGERER_UUID" =~ dependabot|renovate ]]; then
export LLM_ADVISOR_ENABLED=false
else
export LLM_ADVISOR_ENABLED=true
fi
- |
[[ -z "$BITBUCKET_REPO_ACCESS_TOKEN" ]] && echo "BITBUCKET_REPO_ACCESS_TOKEN is empty" || echo "BITBUCKET_REPO_ACCESS_TOKEN is set"
- export DEFAULT_WORKSPACE=$BITBUCKET_CLONE_DIR && bash /entrypoint.sh
artifacts:
- megalinter-reports/**
# Configuration file for MegaLinter
#
# See all available variables at https://megalinter.io/latest/config-file/ and
# in linters documentation
---
# all, none, or list of linter keys
APPLY_FIXES: none
# Formatter errors will be reported as errors (not warnings) if this variable
# is set to false
FORMATTERS_DISABLE_ERRORS: false
# Directory for all linter configuration rules
LINTER_RULES_PATH: .linters
# Enable printing alpaca image to console
PRINT_ALPACA: false
# Displays all disabled linters MegaLinter could have run
SHOW_SKIPPED_LINTERS: false
# When set to false, only new or edited files will be parsed for validation
VALIDATE_ALL_CODEBASE: falseBitbucket vars reported with debug log level set: The most confusing bit is that it doesn't provide any hint on which exact required variables it can't find so I can't figure this out as all bits seem to match what's described at https://megalinter.io/latest/reporters/BitbucketCommentReporter/#configuration 😢 Any help appreciated 🙏🏻 |
Replies: 1 comment
|
So the below Bitbucket pipeline configuration results in missing […]
pipelines:
default:
- parallel:
- step:
[…]The config should be adjusted to the below to allow MegaLinter to comment on Bitbucket PRs: […]
pipelines:
pull-requests:
"**": # Run on PRs for any branch (the source branch of the pull request)
- parallel:
- step:
[…]For clarity these are the Bitbucket env vars required for Megalinter's Bitbucket Comment Reporter (ref) |






So the below Bitbucket pipeline configuration results in missing
BITBUCKET_PR_IDenv var, which is available only inpull-requestspipelines:The config should be adjusted to the below to allow MegaLinter to comment on Bitbucket PRs:
For clarity these are the Bitbucket env vars required for Megalinter's Bitbucket Comment Reporter (ref)