Skip to content

Markdown template overrides not working despite correct configuration #5736

@SaberSHO

Description

@SaberSHO

Community Note

  • Please vote on this issue by adding a 👍 reaction to the original issue to help the community and maintainers prioritize this request.
  • Please do not leave "+1" or other comments that do not add relevant new information or questions, they generate extra noise for issue followers and do not help prioritize the request.
  • If you are interested in working on this issue or have submitted a pull request, please leave a comment.

Overview of the Issue

The --markdown-template-overrides-dir flag appears to be non-functional. Despite having correctly configured custom markdown templates with proper file structure, permissions, and content, Atlantis continues to use the built-in default templates instead of the custom overrides.

I have verified:

  • ✅ The flag is correctly set and appears in the process arguments
  • ✅ Template files exist at the specified path with correct permissions (644, owned by atlantis:atlantis)
  • ✅ All template dependencies are included (no missing template references)
  • ✅ Template syntax is valid (exact copies of default templates with minimal modifications)
  • ✅ Files are regular files (not symlinks) to avoid any parsing issues
  • ✅ All 39 templates are present (complete override set)

The custom templates are never used, and there are no error messages in the logs indicating template parsing failures.

Reproduction Steps

  1. Configure Atlantis with custom template directory:

    atlantis server --markdown-template-overrides-dir="/home/atlantis/templates"
  2. Create custom templates with test content:

    # Example: single_project_plan_success.tmpl
    {{ define "singleProjectPlanSuccess" -}}
    TEST TEMPLATE WORKING
    {{ $result := index .Results 0 -}}
    Walked {{ .Command }} for {{ if $result.ProjectName }}project: `{{ $result.ProjectName }}` {{ end }}dir: `{{ $result.RepoRelDir }}` workspace: `{{ $result.Workspace }}`
    # ... rest of template identical to default
  3. Verify template files are accessible:

    # Files exist and are readable
    $ ls -la /home/atlantis/templates/
    -rw-r--r-- 1 atlantis atlantis 641 single_project_plan_success.tmpl
    # ... 38 other templates
    
    # Content is correct
    $ head -3 /home/atlantis/templates/single_project_plan_success.tmpl
    {{ define "singleProjectPlanSuccess" -}}
    TEST TEMPLATE WORKING
    {{ $result := index .Results 0 -}}
  4. Trigger Atlantis plan command

  5. Expected: See "TEST TEMPLATE WORKING" in the output
    Actual: Default template is used, no custom content appears

Logs

Atlantis Server Startup Logs
{"level":"info","ts":"2025-08-26T00:45:23.697Z","caller":"server/server.go:342","msg":"Supported VCS Hosts: Github","json":{}}
{"level":"info","ts":"2025-08-26T00:45:23.969Z","caller":"server/server.go:503","msg":"Utilizing BoltDB","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.020Z","caller":"vcs/git_cred_writer.go:29","msg":"wrote git credentials to /home/atlantis/.git-credentials","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.023Z","caller":"vcs/git_cred_writer.go:71","msg":"successfully ran git config --global credential.helper store","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.026Z","caller":"vcs/git_cred_writer.go:77","msg":"successfully ran git config --global url.https://[email protected] ssh://[email protected]","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.026Z","caller":"policy/conftest_client.go:168","msg":"failed to get default conftest version. Will attempt request scoped lazy loads DEFAULT_CONFTEST_VERSION not set","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.027Z","caller":"scheduled/executor_service.go:51","msg":"Scheduled Executor Service started","json":{}}
{"level":"info","ts":"2025-08-26T00:45:24.027Z","caller":"server/server.go:1111","msg":"Atlantis started - listening on port 4141","json":{}}
Process Arguments Verification
$ ps aux | grep atlantis
atlantis server --disable-markdown-folding --markdown-template-overrides-dir="/home/atlantis/templates"
Template Directory Contents
$ ls -la /home/atlantis/templates/ | wc -l
39  # All 39 templates present

$ find /home/atlantis/templates -name "*.tmpl" | wc -l  
39  # All files have .tmpl extension

$ grep -c "define \"" /home/atlantis/templates/*.tmpl | wc -l
39  # All templates have valid define statements

Notable: No template-related error messages appear in logs when using grep -i "template\|error\|fail\|parse".

Environment details

  • Atlantis version: v0.35.1 (commit: e987e33) (build date: 2025-07-31T00:30:00.639Z)
  • Deployment method: Kubernetes/Helm
  • Running latest version: Yes (v0.35.1)
  • Atlantis flags: --disable-markdown-folding --markdown-template-overrides-dir="/home/atlantis/templates"

Atlantis server-side config file:

# Using Helm chart with extraArgs configuration
extraArgs:
  - --disable-markdown-folding
  - --markdown-template-overrides-dir="/home/atlantis/templates"

# Additional settings
enableDiffMarkdownFormat: true
hidePrevPlanComments: false

Repo atlantis.yaml file:

# No repo-level configuration (using global defaults)

Additional deployment details:

  • Kubernetes cluster on Linux
  • Templates mounted via initContainer copying from ConfigMap to emptyDir volume
  • Files verified as regular files (not symlinks) with correct ownership
  • No storage constraints or permission issues

Additional Context

Investigation performed:

  1. Verified template loading code in server/events/markdown_renderer.go lines 158-162
  2. Confirmed feature exists via PR #2647 (merged Nov 2022)
  3. Tested multiple approaches: minimal templates, comprehensive templates, different mount strategies
  4. Verified all dependencies: included all 39 templates to prevent silent parsing failures
  5. Added test strings to ALL plan-related templates: Added "TEST TEMPLATE WORKING" messages to singleProjectPlanSuccess, planSuccessUnwrapped, planSuccessWrapped, singleProjectPlanUnsuccessful, multiProjectPlan, multiProjectHeader, and multiProjectPlanFooter templates to definitively test if ANY template overrides work - none appeared in output

Code analysis suggests the issue may be:

  • Silent failure in template.ParseGlob() on line 159 of markdown_renderer.go
  • No error logging when template parsing fails
  • Fallback to embedded templates without indication

Related issues/PRs:

The lack of any error messages or debug output makes it difficult to determine if templates are being parsed at all or if there's a silent failure in the override mechanism.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions