Skip to content

Commit

Permalink
Merge pull request #159 from essentialkaos/develop
Browse files Browse the repository at this point in the history
Version 7.4.0
  • Loading branch information
andyone authored Oct 4, 2023
2 parents 9b79dff + 1756a66 commit 2d57ca5
Show file tree
Hide file tree
Showing 16 changed files with 321 additions and 84 deletions.
20 changes: 10 additions & 10 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,11 @@ jobs:

strategy:
matrix:
go: [ '1.19.x', '1.20.x' ]
go: [ '1.20.x', '1.21.x' ]

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
Expand Down Expand Up @@ -75,12 +75,12 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Set up Go
uses: actions/setup-go@v4
with:
go-version: '1.19.x'
go-version: '1.20.x'

- name: Download dependencies
run: make deps
Expand All @@ -98,7 +98,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check scripts with Shellcheck
uses: essentialkaos/shellcheck-action@v1
Expand All @@ -113,7 +113,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check dockerfiles with Hadolint
uses: essentialkaos/hadolint-action@v1
Expand All @@ -128,7 +128,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Check spelling
continue-on-error: true
Expand Down Expand Up @@ -158,11 +158,11 @@ jobs:
# More info about issue: https://github.com/actions/runner/issues/491
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
if: ${{ github.event_name == 'pull_request' }}

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
env:
DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }}
if: ${{ github.event_name == 'pull_request' && env.DOCKERHUB_USERNAME != '' }}
Expand All @@ -171,7 +171,7 @@ jobs:
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
if: ${{ github.event_name == 'pull_request' }}
with:
registry: ghcr.io
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 2

Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/docker-push.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,18 +32,18 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Login to DockerHub
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
Expand Down Expand Up @@ -149,7 +149,7 @@ jobs:
- name: Build and push Docker images (Docker)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
context: .
Expand All @@ -160,7 +160,7 @@ jobs:

- name: Build and push Docker images (GHCR)
if: ${{ steps.build_check.outputs.build == 'true' }}
uses: docker/build-push-action@v4
uses: docker/build-push-action@v5
with:
push: true
context: .
Expand Down
88 changes: 58 additions & 30 deletions COOKBOOK.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<p align="center"><img src="https://gh.kaos.st/bibop-cookbook.svg"/></p>
<p align="center"><a href="#recipe-syntax"><img src="https://gh.kaos.st/bibop-cookbook.svg"/></a></p>

* [Recipe Syntax](#recipe-syntax)
* [Comments](#comments)
Expand Down Expand Up @@ -47,6 +47,7 @@
* [`mkdir`](#mkdir)
* [`remove`](#remove)
* [`chmod`](#chmod)
* [`chown`](#chown)
* [`truncate`](#truncate)
* [`cleanup`](#cleanup)
* [`backup`](#backup)
Expand Down Expand Up @@ -681,7 +682,7 @@ Checks file or directory mode bits.

```yang
command "-" "Check environment"
mode "/home/user/file.log" 644
mode /home/user/file.log 644
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -704,9 +705,9 @@ Checks file or directory owner.

```yang
command "-" "Check environment"
owner "/home/john/file.log" "john"
owner "/home/john/file1.log" ":sysadmins"
owner "/home/john/file1.log" "john:sysadmins"
owner /home/john/file.log john
owner /home/john/file1.log :sysadmins
owner /home/john/file1.log john:sysadmins
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -727,7 +728,7 @@ Checks if file or directory exist.

```yang
command "-" "Check environment"
exist "/home/john/file.log"
exist /home/john/file.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -749,7 +750,7 @@ Checks if link points on given file or directory. Action follows all links until

```yang
command "-" "Check environment"
link "/etc/myapp.conf" "/srv/myapp/common/myapp.conf"
link /etc/myapp.conf /srv/myapp/common/myapp.conf
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -771,7 +772,7 @@ Checks if file or directory is readable for some user.

```yang
command "-" "Check environment"
readable john "/home/john/file.log"
readable john /home/john/file.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -793,7 +794,7 @@ Checks if file or directory is writable for some user.

```yang
command "-" "Check environment"
writable john "/home/john/file.log"
writable john /home/john/file.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -815,7 +816,7 @@ Checks if file or directory is executable for some user.

```yang
command "-" "Check environment"
executable john "/usr/bin/myapp"
executable john /usr/bin/myapp
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -836,7 +837,7 @@ Checks if given target is directory.

```yang
command "-" "Check environment"
dir "/home/john/abcd"
dir /home/john/abcd
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -856,7 +857,7 @@ Checks if file is empty.
**Example:**

```yang
command "-" "Check environment"
command "-" "Check if log file is empty"
empty "/home/john/file.log"
```

Expand All @@ -877,7 +878,7 @@ Checks if directory is empty.
**Example:**

```yang
command "-" "Check environment"
command "-" "Check for empty directory"
empty-dir /var/log/my-app
```

Expand All @@ -899,8 +900,8 @@ Checks file SHA256 checksum.
**Example:**

```yang
command "-" "Check environment"
checksum "/home/john/file.log" "88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589"
command "-" "Check configuration checksum"
checksum /etc/myapp/myapp.conf 88D4266FD4E6338D13B845FCF289579D209C897823B9217DA3E161936F031589
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -921,8 +922,9 @@ Checks file SHA256 checksum and writes it into the variable.
**Example:**

```yang
command "-" "Check environment"
checksum-read "/home/john/file.log" log_checksum
command "-" "Get configuration checksum"
checksum-read /etc/myapp/myapp.conf log_checksum
checksum /etc/myapp/myapp.conf {log_checksum}
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -943,8 +945,8 @@ Checks if file contains some substring.
**Example:**

```yang
command "-" "Check environment"
file-contains "/home/john/file.log" "abcd"
command "-" "Check logs for data"
file-contains /home/john/file.log "ERROR: "
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -965,8 +967,8 @@ Makes copy of file or directory.
**Example:**

```yang
command "-" "Check environment"
copy "/home/john/file.log" "/home/john/file2.log"
command "-" "Create copy of log file"
copy /home/john/file.log /home/john/file2.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -988,7 +990,7 @@ Moves file or directory.

```yang
command "-" "Check environment"
move "/home/john/file.log" "/home/john/file2.log"
move /home/john/file.log /home/john/file2.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1009,7 +1011,7 @@ Changes file timestamps.

```yang
command "-" "Check environment"
touch "/home/john/file.log"
touch /home/john/file.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1030,7 +1032,7 @@ Creates a directory.

```yang
command "-" "Check environment"
mkdir "/home/john/abcd"
mkdir /home/john/abcd
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1053,7 +1055,7 @@ Removes file or directory.

```yang
command "-" "Check environment"
remove "/home/john/abcd"
remove /home/john/abcd
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1074,8 +1076,34 @@ Changes file mode bits.
**Example:**

```yang
command "-" "Check environment"
chmod "/home/john/abcd" 755
command "-" "Change mode for directory"
chmod /home/john/abcd 755
chmod /home/john/abcd.txt 644
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>

##### `chown`

Changes file or directory owner.

**Syntax:** `chown <path> <user>:<group>`

**Arguments:**

* `path` - Path to file or directory (_String_)
* `user` - User name (_String_)
* `group` - Group name (_String_)

**Negative form:** No

**Example:**

```yang
command "-" "Set owner for files"
chown /home/john/file.log john
chown /home/john/file1.log :sysadmins
chown /home/john/file1.log john:sysadmins
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1096,7 +1124,7 @@ Changes the size of the file to zero.

```yang
command "-" "Clear log file"
truncate "/var/log/my-app/app.log"
truncate /var/log/my-app/app.log
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand All @@ -1117,8 +1145,8 @@ Removes all directories and files in the given directory.

```yang
command "-" "Remove app data"
cleanup "/srv/myapp/data"
cleanup "/srv/myapp/backups"
cleanup /srv/myapp/data
cleanup /srv/myapp/backups
```

<a href="#"><img src="https://gh.kaos.st/separator.svg"/></a>
Expand Down
Loading

0 comments on commit 2d57ca5

Please sign in to comment.