Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running Github Action with only one include_tag set throws error about size of Markdown results #607

Open
MattWhite-personal opened this issue Jan 2, 2025 · 1 comment

Comments

@MattWhite-personal
Copy link

MattWhite-personal commented Jan 2, 2025

When running a Maester using the Github Action with a view to only run the Entra ID SCA tests the job runs but at the end of the run the upload fails with an error due to the size of the Markdown file

Github Actions output snippet

WARNING: The version '5.6.1' of module 'Pester' is currently in use. Retry the operation after closing the applications.
Pester verbosity level set to: None
Running tests with tags: EIDSCA
███╗   ███╗ █████╗ ███████╗███████╗████████╗███████╗██████╗     ██╗   ██╗ ██╗    ██████╗
████╗ ████║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗    ██║   ██║███║   ██╔═████╗
██╔████╔██║███████║█████╗  ███████╗   ██║   █████╗  ██████╔╝    ██║   ██║╚██║   ██║██╔██║
██║╚██╔╝██║██╔══██║██╔══╝  ╚════██║   ██║   ██╔══╝  ██╔══██╗    ╚██╗ ██╔╝ ██║   ████╔╝██║
██║ ╚═╝ ██║██║  ██║███████╗███████║   ██║   ███████╗██║  ██║     ╚████╔╝  ██║██╗╚██████╔╝
╚═╝     ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝      ╚═══╝   ╚═╝╚═╝ ╚═════╝
🔥 Maester test report generated at test-results/test-results.html
Tests Passed ✅: 63, Failed ❌: 15, Skipped ⚫: 9
Script execution Complete
Error: $GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 7872k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary

I have recently switched from using the original v0.1 github action to the published one which has resulted in the error.

The code used in the Github Action yml is as follows

name: Entra ID Secure Config Analyser

on:
  #push:
  #  branches: ["main"]
  # Run once a day at midnight
  schedule:
    - cron: "0 0 * * *"
  # Allows to run this workflow manually from the Actions tab
  workflow_dispatch:

permissions:
      id-token: write
      contents: read
      checks: write

jobs:
  run-maester-tests:
    name: Run Maester Tests
    runs-on: ubuntu-latest
    steps:
    - name: Run Maester action
      uses: maester365/maester@main
      with:
        client_id: ${{ secrets.AZURE_CLIENT_ID }}
        tenant_id: ${{ secrets.AZURE_TENANT_ID }}
        include_tags: "EIDSCA"
        include_public_tests: true

By comparison I have the original Maester tests using a separate action

name: Maester Daily Tests

on:
  #push:
  #  branches: ["main"]
  # Run once a day at midnight
  schedule:
    - cron: "0 0 * * *"
  # Allows to run this workflow manually from the Actions tab
  workflow_dispatch:

permissions:
      id-token: write
      contents: read
      checks: write

jobs:
  run-maester-tests:
    name: Run Maester Tests
    runs-on: ubuntu-latest
    steps:
    - name: Run Maester action
      uses: maester365/maester@main
      with:
        client_id: ${{ secrets.AZURE_CLIENT_ID }}
        tenant_id: ${{ secrets.AZURE_TENANT_ID }}
        include_tags: "Maester"
        include_public_tests: false

The only changes being the with section has different include_tags and include_public_tests but changing the second from true to false doesn't resolve the issue just produce a smaller output file.

Looking at the contents of the Markdown that is published it is now much larger and is adding the Test Results summary multiple times at the end of the MD file (125 times when running include_tags: EIDSCA and include_public_tests: true and 52 tiles with include_public_tests: false). By comparison the logic for include_tags: Maester does not appear to produce the same errors

Reverting to the original GithubAction where all the code is run from the yml in my repo it completes without issue

name: Entra ID Secure Config

on:
  #push:
  #  branches: ["main"]
  # Run once a day at midnight
  schedule:
    - cron: "0 0 * * *"
  # Allows to run this workflow manually from the Actions tab
  workflow_dispatch:

permissions:
      id-token: write
      contents: read
      checks: write

jobs:
  run-maester-tests:
    name: Run Maester Tests
    runs-on: ubuntu-latest
    steps:
    - uses: actions/checkout@v4
    - name: Set current date as env variable
      run: echo "NOW=$(date +'%Y-%m-%d-T%H%M%S')" >> $GITHUB_ENV
    - name: 'Az CLI login'
      uses: azure/login@v2
      with:
          tenant-id: ${{ secrets.AZURE_TENANT_ID }}
          client-id: ${{ secrets.AZURE_CLIENT_ID }}
          allow-no-subscriptions: true
    - name: Run Maester
      uses: azure/powershell@v2
      with:
        inlineScript: |
          # Get Token
          $token = az account get-access-token --resource-type ms-graph

          # Connect to Microsoft Graph
          $accessToken = ($token | ConvertFrom-Json).accessToken | ConvertTo-SecureString -AsPlainText -Force
          Connect-MgGraph -AccessToken $accessToken

          # Install Maester
          Install-Module Maester -Force

          # Configure test results
          $PesterConfiguration = New-PesterConfiguration
          $PesterConfiguration.Output.Verbosity = 'None'

          # Run Maester tests
          $results = Invoke-Maester -Path tests/EIDSCA/ -PesterConfiguration $PesterConfiguration -OutputFolder test-results -OutputFolderFileName "test-results" -PassThru

          # Add step summary
          $summary = Get-Content test-results/test-results.md
          Add-Content -Path $env:GITHUB_STEP_SUMMARY -Value $summary

          # Flag status to GitHub - Uncomment the block below to fail the build if tests fail
          #if ($results.Result -ne 'Passed'){
          #  Write-Error "Status = $($results.Result): See Maester Test Report below for details."
          #}
        azPSVersion: "latest"

    - name: Archive Maester Html Report
      uses: actions/upload-artifact@v4
      if: always()
      with:
        name: maester-test-results-${{ env.NOW }}
        path: test-results

I can't see why the logic should fail when the tests are being run from the public repo rather than locally and when EIDSCA is used as the tag

@MattWhite-personal
Copy link
Author

Interestingly trying to use the same logic on the CIS E3 tag I get an even bigger error when the upload is attempted

WARNING: The version '5.6.1' of module 'Pester' is currently in use. Retry the operation after closing the applications.
Pester verbosity level set to: None
Running tests with tags: CIS E3
███╗   ███╗ █████╗ ███████╗███████╗████████╗███████╗██████╗     ██╗   ██╗ ██╗    ██████╗
████╗ ████║██╔══██╗██╔════╝██╔════╝╚══██╔══╝██╔════╝██╔══██╗    ██║   ██║███║   ██╔═████╗
██╔████╔██║███████║█████╗  ███████╗   ██║   █████╗  ██████╔╝    ██║   ██║╚██║   ██║██╔██║
██║╚██╔╝██║██╔══██║██╔══╝  ╚════██║   ██║   ██╔══╝  ██╔══██╗    ╚██╗ ██╔╝ ██║   ████╔╝██║
██║ ╚═╝ ██║██║  ██║███████╗███████║   ██║   ███████╗██║  ██║     ╚████╔╝  ██║██╗╚██████╔╝
╚═╝     ╚═╝╚═╝  ╚═╝╚══════╝╚══════╝   ╚═╝   ╚══════╝╚═╝  ╚═╝      ╚═══╝   ╚═╝╚═╝ ╚═════╝
WARNING: Skipping eligible roles as required Graph permission 'RoleEligibilitySchedule.ReadWrite.Directory' was not present.
WARNING: Skipping eligible roles as required Graph permission 'RoleEligibilitySchedule.ReadWrite.Directory' was not present.
🔥 Maester test report generated at test-results/test-results.html
Tests Passed ✅: 2, Failed ❌: 2, Skipped ⚫: 14
Script execution Complete
Error: $GITHUB_STEP_SUMMARY upload aborted, supports content up to a size of 1024k, got 10557k. For more information see: https://docs.github.com/actions/using-workflows/workflow-commands-for-github-actions#adding-a-markdown-summary

@MattWhite-personal MattWhite-personal changed the title Running Github Action with only one test set throws error about size of Markdown results Running Github Action with only one include_tag set throws error about size of Markdown results Jan 2, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant