Skip to content

Commit

Permalink
Merge branch 'master' into lint_ci
Browse files Browse the repository at this point in the history
  • Loading branch information
aelsabbahy committed May 21, 2024
2 parents 46d2de8 + 784c3c2 commit 466d824
Show file tree
Hide file tree
Showing 13 changed files with 65 additions and 42 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ on:
pull_request:
paths:
- mkdocs.yml
- docs/
- docs/**
- README.md
- LICENSE
- extras/**/README.md
Expand All @@ -20,10 +20,13 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: DavidAnson/markdownlint-cli2-action@v13
- uses: DavidAnson/markdownlint-cli2-action@v16
with:
globs: |
docs/**/*.md
README.md
extras/**/README.md
.github/CONTRIBUTING.md
build:
runs-on: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview-docs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ on:
- opened
paths:
- mkdocs.yml
- docs/
- docs/**
- README.md
- LICENSE
- extras/**/README.md
Expand Down
38 changes: 19 additions & 19 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,12 +62,12 @@ GLOBAL OPTIONS:
## Commands

Commands are the actions goss can run.
- [add](#add): add a single test for a resource
- [autoadd](#autoadd): automatically add multiple tests for a resource
- [render](#render): renders and outputs the gossfile, importing all included gossfiles
- [serve](#serve): serves the gossfile validation as an HTTP endpoint on a specified address and port,
* [add](#add): add a single test for a resource
* [autoadd](#autoadd): automatically add multiple tests for a resource
* [render](#render): renders and outputs the gossfile, importing all included gossfiles
* [serve](#serve): serves the gossfile validation as an HTTP endpoint on a specified address and port,
so you can use your gossfile as a health report for the host
- [validate](#validate): runs the goss test suite on your server
* [validate](#validate): runs the goss test suite on your server

### `add`

Expand Down Expand Up @@ -123,22 +123,22 @@ A sub-command *resource type* has to be provided when running `add`.
Automatically [adds](#add) all **existing** resources matching the provided argument.

Will automatically add the following matching resources:
- `file` - only if argument contains `/`
- `group`
- `package`
- `port`
- `process` - Also adding any ports it's listening to (if run as root)
- `service`
- `user`
* `file` - only if argument contains `/`
* `group`
* `package`
* `port`
* `process` - Also adding any ports it's listening to (if run as root)
* `service`
* `user`

Will **NOT** automatically add:
- `addr`
- `command` - for safety
- `dns`
- `http`
- `interface`
- `kernel-param`
- `mount`
* `addr`
* `command` - for safety
* `dns`
* `http`
* `interface`
* `kernel-param`
* `mount`

!!! example
```console
Expand Down
1 change: 1 addition & 0 deletions docs/containers/docker-compose.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- markdownlint-disable-next-line -->
--8<-- "extras/dcgoss/README.md"
1 change: 1 addition & 0 deletions docs/containers/docker.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- markdownlint-disable-next-line -->
--8<-- "extras/dgoss/README.md"
1 change: 1 addition & 0 deletions docs/containers/kubernetes.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- markdownlint-disable-next-line -->
--8<-- "extras/kgoss/README.md"
1 change: 1 addition & 0 deletions docs/contributing.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- markdownlint-disable-next-line -->
--8<-- ".github/CONTRIBUTING.md"
1 change: 1 addition & 0 deletions docs/license.md
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
<!-- markdownlint-disable-next-line -->
--8<-- "LICENSE"
4 changes: 2 additions & 2 deletions docs/migrations.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ user:
- root
```

Goss v0.4.x, will fail with the above as group "root" is only in the slice once. However, with goss v0.4.x the array may contain
matchers. The test below is valid for v0.4.x but not valid for v0.3.x
Goss v0.4.x, will fail with the above as group "root" is only in the slice once. However, with goss v0.4.x the array may
contain matchers. The test below is valid for v0.4.x but not valid for v0.3.x

```yaml
user:
Expand Down
4 changes: 2 additions & 2 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
mkdocs-material==9.5.3
mkdocs-material==9.5.23
mkdocs-macros-plugin==1.0.5
mkdocs-awesome-pages-plugin==2.9.2
mkdocs-exclude==1.0.2
mdx-breakless-lists==1.0.1
pygments==2.17.2
pygments==2.18.0
19 changes: 12 additions & 7 deletions extras/dcgoss/README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,17 @@
# dcgoss

dcgoss is a convenience wrapper around goss that aims to bring the simplicity of goss to docker-compose managed containers. It is based on `dgoss`.
dcgoss is a convenience wrapper around goss that aims to bring the simplicity of goss to docker-compose managed
containers. It is based on `dgoss`.

## Usage

`dcgoss [run|edit] <docker_run_params>`

### Run

Run is used to validate a docker container defined in `docker-compose.yml`. It expects both a `docker-compose.yml` and `goss.yaml` file to exist in the directory it was invoked from. Container configuration is used from the compose file, for example:
Run is used to validate a docker container defined in `docker-compose.yml`. It expects both a `docker-compose.yml`
and `goss.yaml` file to exist in the directory it was invoked from. Container configuration is used from the
compose file, for example:

**run:**

Expand Down Expand Up @@ -43,7 +46,7 @@ The following environment variables can be set to change the behavior of dcgoss.
#### DEBUG

Enables debug output of `dcgoss`.

When running in debug mode, the tmp dir with the container output will not be cleaned up.

**Default:** empty
Expand All @@ -54,7 +57,7 @@ When running in debug mode, the tmp dir with the container output will not be cl

#### GOSS_PATH

Location of the goss binary to use.
Location of the goss binary to use.

**Default:** `$(which goss)`

Expand Down Expand Up @@ -104,8 +107,9 @@ If unset (or empty), the `--vars` flag is omitted, which is the normal behavior.

#### GOSS_FILES_STRATEGY

Strategy used for copying goss files into the docker container.
If set to `'mount'` a volume with goss files is mounted and log output is streamed into the container as `/goss/docker_output.log` file.
Strategy used for copying goss files into the docker container.
If set to `'mount'` a volume with goss files is mounted and log output is streamed into the container as
`/goss/docker_output.log` file.
Other strategy is `'cp'` which uses `'docker cp'` command to copy goss files into docker container.
With the `'cp'` strategy you lose the ability to write tests or waits against the docker output.
The `'cp'` strategy is required especially when docker daemon is not on the local machine.
Expand All @@ -114,7 +118,8 @@ The `'cp'` strategy is required especially when docker daemon is not on the loca

## Debugging test runs

When debugging test execution its beneficual to set both `DEBUG=true` and `GOSS_WAIT_OPTS=-r 60s -s 5s` (without the redirect to `/dev/null`).
When debugging test execution its beneficual to set both `DEBUG=true` and `GOSS_WAIT_OPTS=-r 60s -s 5s`
(without the redirect to `/dev/null`).

**Example:**

Expand Down
24 changes: 17 additions & 7 deletions extras/dgoss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,11 @@ dgoss is a convenience wrapper around goss that aims to bring the simplicity of

## Examples and Tutorials

* [blog tutorial](https://medium.com/@aelsabbahy/tutorial-how-to-test-your-docker-image-in-half-a-second-bbd13e06a4a9) - Introduction to dgoss tutorial
* [blog tutorial](https://medium.com/@aelsabbahy/tutorial-how-to-test-your-docker-image-in-half-a-second-bbd13e06a4a9) -
Introduction to dgoss tutorial
* [video tutorial](https://youtu.be/PEHz5EnZ-FM) - Same as above, but in video format
* [dgoss-examples](https://github.com/aelsabbahy/dgoss-examples) - Repo containing examples of using dgoss to validate docker images
* [dgoss-examples](https://github.com/aelsabbahy/dgoss-examples) - Repo containing examples of using dgoss to validate
docker images

## Installation

Expand Down Expand Up @@ -43,7 +45,7 @@ dgoss run ...

### Run

Run is used to validate a docker container.
Run is used to validate a docker container.
It expects a `./goss.yaml` file to exist in the directory it was invoked from.
In most cases one can just substitute the docker command for the dgoss command, for example:

Expand All @@ -65,7 +67,9 @@ In most cases one can just substitute the docker command for the dgoss command,

### Edit

Edit will launch a docker container, install goss, and drop the user into an interactive shell. Once the user quits the interactive shell, any `goss.yaml` or `goss_wait.yaml` are copied out into the current directory. This allows the user to leverage the `goss add|autoadd` commands to write tests as they would on a regular machine.
Edit will launch a docker container, install goss, and drop the user into an interactive shell.
Once the user quits the interactive shell, any `goss.yaml` or `goss_wait.yaml` are copied out into the current directory.
This allows the user to leverage the `goss add|autoadd` commands to write tests as they would on a regular machine.

**Example:**

Expand Down Expand Up @@ -121,17 +125,23 @@ If unset (or empty), the `--vars` flag is omitted, which is the normal behavior.

#### GOSS_FILES_STRATEGY

Strategy used for copying goss files into the docker container. If set to `'mount'` a volume with goss files is mounted and log output is streamed into the container as `/goss/docker_output.log` file. Other strategy is `'cp'` which uses `'docker cp'` command to copy goss files into docker container. With the `'cp'` strategy you lose the ability to write tests or waits against the docker output. The `'cp'` strategy is required especially when docker daemon is not on the local machine.
Strategy used for copying goss files into the docker container. If set to `'mount'` a volume with goss files is mounted
and log output is streamed into the container as `/goss/docker_output.log` file. Other strategy is `'cp'` which uses
`'docker cp'` command to copy goss files into docker container. With the `'cp'` strategy you lose the ability to write
tests or waits against the docker output. The `'cp'` strategy is required especially when docker daemon is not on the
local machine.
(Default `'mount'`)

#### CONTAINER_LOG_OUTPUT

Location of the file that contains tested container logs. Logs are retained only if the variable is set to a non-empty string. (Default `''`)
Location of the file that contains tested container logs. Logs are retained only if the variable is set to a non-empty
string. (Default `''`)

#### DGOSS_TEMP_DIR

Location of the temporary directory used by dgoss. (Default `'$(mktemp -d /tmp/tmp.XXXXXXXXXX)'`)

#### CONTAINER_RUNTIME

Container runtime to use - `docker` or `podman`. Defaults to `docker`. Note that `podman` requires a run command to keep the container running. This defaults to `sleep infinity` in case only an image is passed to `dgoss` commands.
Container runtime to use - `docker` or `podman`. Defaults to `docker`. Note that `podman` requires a run command to keep
the container running. This defaults to `sleep infinity` in case only an image is passed to `dgoss` commands.
4 changes: 2 additions & 2 deletions extras/kgoss/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,10 +23,10 @@ You can manually install kgoss and goss by going through the Web UI, getting
the files and putting them in the right path. To get each of them:

* **kgoss**: Run `curl -sSLO
https://raw.githubusercontent.com/goss-org/goss/master/extras/kgoss/kgoss`.
https://raw.githubusercontent.com/goss-org/goss/master/extras/kgoss/kgoss`.
* **goss**: Download the `goss-linux-amd64` asset from
<https://github.com/goss-org/goss/releases> and rename it `goss`. Place it
in your HOME directory, e.g. C:\\Users\\<username> on Windows; or set the
in your HOME directory, e.g. `C:\Users\<username>` on Windows; or set the
environment variable `GOSS_PATH` to its path.

### Automatic / CLI
Expand Down

0 comments on commit 466d824

Please sign in to comment.