Skip to content

v1.163.0

Latest
Compare
Choose a tag to compare
@cloudposse-releaser cloudposse-releaser released this 20 Feb 20:52
· 1 commit to refs/heads/main since this release
2d1bfac
Add examples and tests for `!include` Atmos YAML function @aknysh (#1080)

what

  • Add examples and tests for !include Atmos YAML function
  • Update atmos terraform commands that require processing of Go templates and Atmos YAML functions

why

  • Test Atmos YAML function !include and show usage examples

  • The following atmos terraform commands require processing of Go templates and Atmos YAML functions in Atmos manifests:

init
plan
apply
deploy
destroy
generate
output
clean
shell
write
force-unlock
import
refresh
show
taint
untaint
validate
state list
state mv
state pull
state push
state replace-provider
state rm
state show
Add more lint rules @osterman (#1082)

What

This PR adds and updates several golangci-lint rules to enforce stricter code quality and maintainability standards. Specifically, it:

  • Enhances structured logging validation by configuring loggercheck to support charmbracelet/log, ensuring key-value pairs are formatted correctly.
  • Forbids goto statements by enabling the banned-characters rule.
  • Disallows multi-line errors (\n in error messages) using error-strings to improve error readability.
  • Limits function length (function-length) to prevent overly large and unreadable functions.
  • Restricts file size using file-length-limit to encourage modularity.
  • Enforces cognitive complexity limits (cognitive-complexity) to prevent functions from becoming too complex.
  • Checks cyclomatic complexity (cyclomatic) to encourage simpler, more maintainable logic.
  • Prevents deeply nested if statements (nestif) to improve readability.
  • Standardizes import ordering with gci.
  • Ensures consistent comment formatting (godot).

Why

  • Improved maintainability: Enforcing function size, file size, and complexity limits helps keep code more modular and readable.
  • Better logging practices: By adding loggercheck rules for charmbracelet/log, we ensure structured logging best practices are followed.
  • Stronger error handling: Disallowing multi-line errors improves error message parsing and readability.
  • More readable control structures: By limiting goto and nested if statements, we prevent overly complex code paths.
  • Standardized formatting: Enforcing import ordering and comment formatting ensures consistency across the codebase.
  • Early detection of potential issues: These additional lint rules help catch problematic patterns before they become technical debt.
Rename GolangCI GHA Job, add lint target to `Makefile` @osterman (#1081)

what

  • Add a lint target to the Makefile
  • Pass GITHUB_SECRET explicitly
  • Only comment on code additions
  • Format job name with [lint] prefix
  • Updated Dockerfile job name too match
  • Set limits for the maximum statements per function and maximum functions per file

why

  • Job name didn't match other linting jobs
  • Make target is easier to run locally
  • Our files are too large, which leads to more and more merge conflicts
  • Our functions are too large, which increases the cognitive load required to understand what's going on
Add GolangCI Lint Configuration for Better Code Quality @osterman (#1078)

what

This PR improves our golangci-lint configuration to enforce better coding standards, catch common mistakes, and ensure consistency in our Go codebase.

  • Function Length Enforcement (funlen)

    • Limits functions to 50 lines to improve readability and maintainability.
  • Forbidden Function Calls (forbidigo)

    • Allows blocking specific function calls (e.g., deprecated logging functions).
  • Enabling Additional Linters

    • gocritic: Adds several static analysis checks for code quality.
    • errcheck: Ensures all errors are properly handled.
    • gofumpt: Standardizes formatting beyond gofmt.
    • govet: Detects suspicious constructs.
    • staticcheck: Flags performance and correctness issues.
    • revive: A configurable linter for Go.
    • misspell: Detects common spelling mistakes.
  • Custom gocritic Checks

    • Enables key rules such as:
      • rangeValCopy: Detects unnecessary copies in range loops.
      • hugeParam: Warns on large parameters that should be passed by reference.
      • commentedOutCode: Finds commented-out code blocks.
      • nestingReduce: Suggests ways to reduce nesting complexity.
      • preferFilepathJoin: Enforces using filepath.Join() instead of manual concatenation.
  • Excludes Test Files from Function Length Check (funlen)

    • Test files (_test.go) are ignored for function length enforcement.
  • Output Formatting Improved

    • Uses colored-line-number format for better readability in logs.

why

  • Prevents oversized functions, making code easier to read and refactor.
  • Ensures error handling is not skipped, improving reliability.
  • Standardizes code formatting across the team.
  • Detects common pitfalls like unnecessary copies, deep nesting, and improper path handling.
Fix exit codes for Atmos command @samtholiya (#1065)

what

  • Fix exit codes for Atmos command

why

  • Improved User Experience: It provides more accurate feedback to the user, reflecting the success or failure of the desired program.

  • Better Integration with Other Tools: Many CI/CD systems, monitoring tools, or scripts rely on exit codes to determine whether a task has succeeded or failed. Matching the exit codes allows seamless integration with existing workflows.

  • Debugging and Troubleshooting: By matching exit codes, users and developers can more easily trace issues and understand which program (or specific execution) caused the failure.

  • This change helps ensure the CLI behaves more predictably and conforms to standard practices for handling exit codes.

Add shared configuration for RunsOn GHA runners @Nuru (#1075)

what

  • Add shared configuration for RunsOn GHA runners

why

  • Allow use of simple runner configuration labels like "large"

references

Document Atmos Development Conventions @osterman (#793)

what

  • Explain when to display help vs usage, and their respective behaviors
  • Explain when to use various log levels

why

  • Improve code consistency as the dev team expands
Expose env variables `ATMOS_CLI_CONFIG_PATH` and `ATMOS_BASE_PATH` before running terraform and helm commands @haitham911 (#1072)

What

  • Expose env variables ATMOS_CLI_CONFIG_PATH and ATMOS_BASE_PATH before running terraform and helm commands

image

Why

  • The ENV variables ATMOS_CLI_CONFIG_PATH and ATMOS_BASE_PATH can be used in the Terraform and Helmfile components
Update Smoke Tests to Check for Stale Atmos Binary @osterman (#1063)

what

  • Error if the atmos binary is older than the .go files
  • Error if the atmos binary discovered from the PATH is not within the repository
  • Introduce charmbracelet logger

why

  • Smoketests run the atmos binary from the build
  • We didn't check that the binary was stale, so an out of date binary could be used
  • We didn't check that atmos from the build was in the PATH
  • Logging wasn't easy because the test model isn't accessible everywhere, so using the charmbracelet logger is easy
  • Developers frequently missed pertient log messages; color logs make it easier to see what's going on

screenshots

General info

image

Wrong atmos binary

image

Stale atmos binary

image
Fixed an issue with `vendor.yaml` source failing to accept `git::ssh` URI @elsayedmt (#1054)

what

  • Modified the validation code to accept URL style SSH addresses accepted by go-getter

why

  • Allow to checkout a bitbucket repo using an SSH key