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

Application-level Goss checks #349

Draft
wants to merge 6 commits into
base: main
Choose a base branch
from
Draft

Application-level Goss checks #349

wants to merge 6 commits into from

Conversation

MichaelThamm
Copy link
Contributor

@MichaelThamm MichaelThamm commented Oct 3, 2024

This PR provides more complexity and explores the capabilities of Goss rather than usage workflows and architecure discussed in the solution-level Goss checks PR.

PR Highlights

  • application-level Goss checks.
    • The goss.yaml files exist in the same location as the application i.e. grafana-k8s-operator
  • fetch goss files from decentralised locations.
    • Allows for dynamically combining goss checks for deployments and applications.
    • For example:
      1. start with an empty dir
      2. fetch-subdir solution-level checks
      3. fetch-subdir multiple application-level checks
      4. goss validate

Workflow

Fetching a sub-directory with Git is not a simple one-line command and is simplified with this fetch-subdir.sh script. This script can be executed anywhere with context to git and is not limited to this PR. We will use this script for the following examples:

Note:
<arbitrary_dir> = any dir,
<grafana_dir> = this cloned repo

Note: <grafana_dir>/fetch-subdir.sh exists in this PR for demo purposes but in the final solution will be included in the Juju plugin or juju-doctor snap.

  1. cd <arbitrary_dir>
  2. org="https://github.com/canonical"; repo="grafana-k8s-operator"; branch="feature/goss"; dir="goss"
  3. source <grafana_dir>/goss/fetch-subdir.sh "$org" "$repo" "$branch" "$dir"

Run application-level checks

  1. goss -g "$repo/goss/goss.yaml" --vars-inline '{"goss_dir": "'"$repo/goss"'"}' validate -f documentation

Expected result: Count: 6, Failed: 0, Skipped: 0

Inherit goss checks and run all

Note: These steps assume you already have some goss-*.yaml files in the <arbitrary_dir>/goss dir and the associated juju deployment. If not, use cos-lite-bundle as an example.

  1. cp -ru $repo/goss/* goss/
  2. goss -g goss/goss.yaml --vars-inline '{"goss_dir": "goss"}' validate -f documentation

Expected result: Count: >6, Failed: 0, Skipped: 0

@MichaelThamm MichaelThamm changed the title Feat: Goss application-level checks application-level Goss checks Oct 4, 2024
@MichaelThamm MichaelThamm changed the title application-level Goss checks Application-level Goss checks Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant