-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for multiple ping targets. (#28)
- Loading branch information
1 parent
0c9c88a
commit 61bd79d
Showing
32 changed files
with
1,951 additions
and
214 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
name: Testing Pull Request | ||
on: | ||
pull_request: | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
test-app: | ||
name: Test Goreleaser Application | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Clone repository | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
- name: Set up Go | ||
uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: go.mod | ||
- name: Test application | ||
run: go test ./... | ||
- name: Set up QEMU | ||
uses: docker/setup-qemu-action@v3 | ||
- name: Dry-run goreleaser application | ||
uses: goreleaser/goreleaser-action@v6 | ||
with: | ||
distribution: goreleaser | ||
version: ~> v2 | ||
args: release --snapshot --skip=publish --clean |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1,2 @@ | ||
dist/ | ||
wait-for |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
MIT License | ||
|
||
Copyright (c) 2024 Patrick D'appollonio | ||
|
||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
|
||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
|
||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
# Configuring `wait-for` with a configuration file | ||
|
||
`wait-for` supports reading configuration from a file from a file called `targets.yaml` (configurable with `--config`). This is useful when you have a lot of hosts to check and you don't want to pass them all as command-line arguments. | ||
|
||
The following is an example YAML configuration file: | ||
|
||
```yaml | ||
# file: targets.yaml | ||
hosts: | ||
- "tcp://localhost:8080" | ||
- "udp://localhost:53" | ||
timeout: 30s | ||
every: 2s | ||
verbose: true | ||
``` | ||
This is equal to calling the CLI with the following arguments: | ||
```bash | ||
wait-for \ | ||
--host "tcp://localhost:8080" \ | ||
--host "udp://localhost:53" \ | ||
--timeout 30s \ | ||
--every 2s \ | ||
--verbose | ||
``` | ||
|
||
You can mix-and-match hosts: any hosts provided via the configuration file will be merged with the hosts provided via the command line argument `--host` or `-s`, for example, the following config file and the following command will ping all endpoints (both from the config file and the command line): | ||
|
||
```bash | ||
$ cat targets.yaml | ||
# file: targets.yaml | ||
hosts: | ||
- "tcp://localhost:8080" | ||
- "udp://localhost:53" | ||
timeout: 30s | ||
every: 2s | ||
verbose: true | ||
|
||
$ wait-for \ | ||
--host "localhost:80" \ | ||
--host "localhost:81" \ | ||
--timeout 10s | ||
``` | ||
|
||
The above command will ping the following hosts by merging the two sources (configuration file and command-line flags): | ||
|
||
```text | ||
tcp://localhost:8080 | ||
udp://localhost:53 | ||
tcp://localhost:80 | ||
tcp://localhost:81 | ||
``` | ||
|
||
A host present both in the command-line arguments and in the configuration file will be pinged twice. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
# HTTP & HTTPS | ||
|
||
The HTTP and HTTPS probes are used to send an HTTP or HTTPS `GET` request to a server and check the response. A request is successful not only if the HTTP server was able to provide a connection but also if the response status code is within the range of 200 to 299. If the request responds within this range, the probe will exit successfully. | ||
|
||
If the connection cannot be established or the response status code is outside the range of 200 to 299, the probe will retry until either the timeout is reached or the resource becomes available. | ||
|
||
An example request to `http://localhost:80` would look like this: | ||
|
||
```bash | ||
wait-for --host "http://localhost:80" | ||
``` | ||
|
||
An example request to `https://localhost:443` would look like this: | ||
|
||
```bash | ||
wait-for --host "https://localhost:443" | ||
``` | ||
|
||
## Certificate Validation | ||
|
||
The HTTPS probe (that is, where a target host is configured to use `https://` protocol) will attempt to validate the certificate chain and the hostname. If the certificate chain is invalid or the hostname doesn't match, the probe will exit with an error and the resource will be considered unavailable. | ||
|
||
A valid HTTPS request on resources with custom certificates will require you to provide the CA certificate to the probe. By default, any certs stored in `/etc/ssl/certs/ca-certificates.crt` will be used to validate the connection. |
Oops, something went wrong.