Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
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 repoNote:
<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.cd <arbitrary_dir>
org="https://github.com/canonical"; repo="grafana-k8s-operator"; branch="feature/goss"; dir="goss"
source <grafana_dir>/goss/fetch-subdir.sh "$org" "$repo" "$branch" "$dir"
Run application-level checks
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.cp -ru $repo/goss/* goss/
goss -g goss/goss.yaml --vars-inline '{"goss_dir": "goss"}' validate -f documentation
Expected result:
Count: >6, Failed: 0, Skipped: 0