Skip to content

chore: Screengrabs #1239

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

Open
wants to merge 11 commits into
base: main
Choose a base branch
from
Open

chore: Screengrabs #1239

wants to merge 11 commits into from

Conversation

milldr
Copy link
Member

@milldr milldr commented May 6, 2025

what

  • Added dispatch workflow to generate screengrabs for docs

why

  • Use this workflow to generate a PR will a formatted screengrab
  • We want to use these screengrabs for docs

references

Summary by CodeRabbit

  • Chores
    • Introduced a new workflow to automate the generation and updating of screengrabs for Atmos documentation, streamlining the process via a manual trigger and automated pull requests.
    • Improved cross-platform compatibility for screengrab generation scripts, enhancing support for both macOS and Linux environments.
    • Updated screengrab installation path capitalization and disabled output paging for smoother terminal display.

@milldr milldr requested a review from a team as a code owner May 6, 2025 21:02
@github-actions github-actions bot added the size/s label May 6, 2025
Copy link

mergify bot commented May 6, 2025

Important

Cloud Posse Engineering Team Review Required

This pull request modifies files that require Cloud Posse's review. Please be patient, and a core maintainer will review your changes.

To expedite this process, reach out to us on Slack in the #pr-reviews channel.

@mergify mergify bot added the needs-cloudposse Needs Cloud Posse assistance label May 6, 2025
@milldr milldr added the no-release Do not create a new release (wait for additional code changes) label May 6, 2025
Copy link
Contributor

coderabbitai bot commented May 6, 2025

📝 Walkthrough

"""

Walkthrough

A new GitHub Actions workflow named "Screengrabs" was added to automate fetching the latest Atmos release, building screengrabs, and creating or updating a pull request with the changes. Minor updates were also made to demo screengrab scripts and the Makefile to improve cross-platform compatibility and output handling.

Changes

File(s) Change Summary
.github/workflows/screengrabs.yaml Added a new workflow to automate screengrab generation, Atmos version fetching, build, and PR creation.
demo/screengrabs/Makefile Capitalized screengrabs install directory name; removed trailing space after target colon.
demo/screengrabs/build-all.sh Made sed and script usage cross-platform compatible; disabled output pagination; added extra filtering in postprocessing.
demo/screengrabs/scripts/demo-stacks/.demo.rc Modified bat alias to disable paging by adding --paging=never.

Sequence Diagram(s)

sequenceDiagram
    participant User
    participant GitHub Actions
    participant GitHub API
    participant Make
    participant Git
    participant PR

    User->>GitHub Actions: Trigger "Screengrabs" workflow (workflow_dispatch)
    GitHub Actions->>GitHub API: Fetch latest Atmos release version
    GitHub Actions->>Make: Build and install screengrabs (from demo directory)
    Make->>Git: Stage all changes
    GitHub Actions->>PR: Create or update PR with screengrab changes
Loading

Suggested reviewers

  • aknysh
    """

Tip

⚡️ Faster reviews with caching
  • CodeRabbit now supports caching for code and dependencies, helping speed up reviews. This means quicker feedback, reduced wait times, and a smoother review experience overall. Cached data is encrypted and stored securely. This feature will be automatically enabled for all accounts on May 16th. To opt out, configure Review - Disable Cache at either the organization or repository level. If you prefer to disable all data retention across your organization, simply turn off the Data Retention setting under your Organization Settings.

Enjoy the performance boost—your workflow just got faster.


📜 Recent review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 78d7f75 and 2b57f7d.

📒 Files selected for processing (1)
  • .github/workflows/screengrabs.yaml (1 hunks)
🚧 Files skipped from review as they are similar to previous changes (1)
  • .github/workflows/screengrabs.yaml
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Generate unit testing code for this file.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai generate unit testing code for this file.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and generate unit testing code.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary or @auto-summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai or @auto-title anywhere in the PR title to generate the title automatically.

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 3

🧹 Nitpick comments (3)
.github/workflows/screengrabs.yaml (3)

20-23: Enhance error handling in version fetch

If the GitHub API call fails, you’ll end up with an empty VERSION and the workflow will continue. Add set -euo pipefail to catch failures early:

 run: |
-  VERSION=$(curl -s https://api.github.com/repos/cloudposse/atmos/releases/latest | jq -r .tag_name)
+  set -euo pipefail
+  VERSION=$(curl -s https://api.github.com/repos/cloudposse/atmos/releases/latest | jq -r .tag_name)
   echo "version=$VERSION" >> $GITHUB_OUTPUT

33-36: Optimize dependency installation

Combine update and install, minimize image size, and disable prompts:

-run: |
-  sudo apt-get update
-  sudo apt-get install -y aha util-linux make jq bat
-  sudo ln -s /usr/bin/batcat /usr/bin/bat
+run: |
+  sudo DEBIAN_FRONTEND=noninteractive apt-get update && \
+  sudo DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends aha util-linux make jq bat && \
+  sudo ln -sf /usr/bin/batcat /usr/bin/bat

37-38: Clarify step name for Windows line endings

Typographical fix: capitalize “Windows” and clarify intent:

-name: Set Git Preferences for windows
+name: Set Git preferences for Windows line endings
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between c87cd51 and 781b2ad.

📒 Files selected for processing (1)
  • .github/workflows/screengrabs.yaml (1 hunks)
🧰 Additional context used
🪛 actionlint (1.7.4)
.github/workflows/screengrabs.yaml

2-2: unexpected key "description" for "workflow" section. expected one of "concurrency", "defaults", "env", "jobs", "name", "on", "permissions", "run-name"

(syntax-check)

⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Summary

Copy link

codecov bot commented May 6, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 33.56%. Comparing base (f26dfe1) to head (2b57f7d).

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #1239   +/-   ##
=======================================
  Coverage   33.56%   33.56%           
=======================================
  Files         226      226           
  Lines       24219    24219           
=======================================
  Hits         8130     8130           
  Misses      14875    14875           
  Partials     1214     1214           
Flag Coverage Δ
unittests 33.56% <ø> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@github-actions github-actions bot added size/m and removed size/s labels May 7, 2025
Copy link
Contributor

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (5)
demo/screengrabs/build-all.sh (5)

20-23: Avoid masking return codes in local assignments
ShellCheck SC2155 warns about local var=$(cmd) masking the exit status of cmd. Consider splitting declaration and assignment, and quote variables to prevent word-splitting:

-local output_base_file=artifacts/$(echo "$command" | …)
+local output_base_file
+output_base_file=$(echo "$command" | …)

-local output_dir=$(dirname $output_base_file)
+local output_dir
+output_dir=$(dirname "$output_base_file")
🧰 Tools
🪛 Shellcheck (0.10.0)

[warning] 20-20: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 23-23: Declare and assign separately to avoid masking return values.

(SC2155)


26-27: Quote variables when cleaning up
Unquoted $output_ansi may break if the path ever contains spaces. For safety, wrap it in quotes:

-rm -f $output_ansi
+rm -f "$output_ansi"

28-42: DRY up OS checks and script invocation
The nested uname calls and repetition of script logic can be simplified by computing the OS once and abstracting common flags:

OS=$(uname)
if [ "$OS" = "Darwin" ]; then
  SCRIPT_BASE=(script -q)
else
  SCRIPT_BASE=(script -q -a)
fi

# later...
"${SCRIPT_BASE[@]}" "$output_ansi" -c "$command" > /dev/null

This reduces duplication and makes maintenance easier.


55-71: Combine sed invocations for readability and performance
You’re calling $SED once per pattern. Consider merging them with multiple -e flags (or a heredoc script) to reduce process overhead:

-postprocess_ansi() {
-  $SED '/- Finding latest version of/d' $file
-  $SED '/- Installed hashicorp/d'           $file
-  … (many lines)
+postprocess_ansi() {
+  $SED -e '/- Finding latest version of/d' \
+       -e '/- Installed hashicorp/d'       \
+       -e '/- Installing hashicorp/d'      \
+       -e '/Terraform has created a lock file/d' \
+       …                                \
+      "$file"

This keeps the function concise and faster.


83-84: Write usage message to stderr
Usage prompts should go to stderr in CLI tools so they don’t pollute stdout streams:

-   echo "Usage: $0 <manifest>"
+   echo "Usage: $0 <manifest>" >&2
    exit 1
📜 Review details

Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 8a6d1cc and 78d7f75.

📒 Files selected for processing (3)
  • demo/screengrabs/Makefile (1 hunks)
  • demo/screengrabs/build-all.sh (1 hunks)
  • demo/screengrabs/scripts/demo-stacks/.demo.rc (1 hunks)
✅ Files skipped from review due to trivial changes (2)
  • demo/screengrabs/Makefile
  • demo/screengrabs/scripts/demo-stacks/.demo.rc
🧰 Additional context used
🪛 Shellcheck (0.10.0)
demo/screengrabs/build-all.sh

[warning] 20-20: Declare and assign separately to avoid masking return values.

(SC2155)


[warning] 23-23: Declare and assign separately to avoid masking return values.

(SC2155)

⏰ Context from checks skipped due to timeout of 90000ms (5)
  • GitHub Check: Analyze (go)
  • GitHub Check: Build (windows-latest, windows)
  • GitHub Check: Build (ubuntu-latest, linux)
  • GitHub Check: Lint (golangci)
  • GitHub Check: Summary
🔇 Additional comments (4)
demo/screengrabs/build-all.sh (4)

5-6: Disable pagination for consistent output
Exporting LESS=-X is a solid move to prevent any pager from interrupting the capture process on both macOS and Linux.


16-19: Scope variables locally in record
Good use of local for demo, command, extension, and demo_path to avoid polluting the global namespace.


43-46: Post-processing and cleanup look solid
Calling postprocess_ansi, converting with aha, then postprocess_html followed by removing the ANSI file is clear and effective.


75-77: HTML postprocessing updates look correct
The color substitutions (blue#005f87, #183691#005f87) align with your branding update. Nice and straightforward.

Comment on lines +8 to +13
# Determine the correct sed syntax based on the operating system
if [ "$(uname)" = "Darwin" ]; then
SED="$SED" # macOS requires '' for in-place editing
else
SED="sed -i" # Linux does not require ''
fi
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue

Fix macOS sed in-place syntax
The assignment SED="$SED" is a no-op and won’t invoke sed correctly on Darwin. You need to include the empty string argument for BSD sed’s -i flag.

Apply this patch:

-if [ "$(uname)" = "Darwin" ]; then
-    SED="$SED" # macOS requires '' for in-place editing
+if [ "$(uname)" = "Darwin" ]; then
+    SED="sed -i ''"  # BSD sed: in-place requires an explicit empty suffix
 else
-    SED="sed -i"    # Linux does not require ''
+    SED="sed -i"     # GNU sed: in-place works without suffix
 fi
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Determine the correct sed syntax based on the operating system
if [ "$(uname)" = "Darwin" ]; then
SED="$SED" # macOS requires '' for in-place editing
else
SED="sed -i" # Linux does not require ''
fi
# Determine the correct sed syntax based on the operating system
if [ "$(uname)" = "Darwin" ]; then
SED="sed -i ''" # BSD sed: in-place requires an explicit empty suffix
else
SED="sed -i" # GNU sed: in-place works without suffix
fi
🤖 Prompt for AI Agents (early access)
In demo/screengrabs/build-all.sh around lines 8 to 13, the macOS sed in-place
editing syntax is incorrect because the assignment SED="$SED" does nothing. Fix
this by setting SED to "sed -i ''" for Darwin to correctly use BSD sed's
in-place editing with an empty string argument, while keeping the Linux case as
"sed -i".

milldr and others added 3 commits May 8, 2025 17:50
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Co-authored-by: Erik Osterman (CEO @ Cloud Posse) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
needs-cloudposse Needs Cloud Posse assistance no-release Do not create a new release (wait for additional code changes) size/m
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants