-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
22 changed files
with
2,097 additions
and
15 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,104 @@ | ||
--- | ||
# generated by https://github.com/hashicorp/terraform-plugin-docs | ||
page_title: "imagetest_tests Resource - terraform-provider-imagetest" | ||
subcategory: "" | ||
description: |- | ||
--- | ||
|
||
# imagetest_tests (Resource) | ||
|
||
|
||
|
||
|
||
|
||
<!-- schema generated by tfplugindocs --> | ||
## Schema | ||
|
||
### Required | ||
|
||
- `driver` (String) The driver to use for the test suite. Only one driver can be used at a time. | ||
- `images` (Map of String) Images to use for the test suite. | ||
|
||
### Optional | ||
|
||
- `drivers` (Attributes) The resource specific driver configuration. This is merged with the provider scoped drivers configuration. (see [below for nested schema](#nestedatt--drivers)) | ||
- `name` (String) The name of the test. If one is not provided, a random name will be generated. | ||
- `tests` (Attributes List) An ordered list of test suites to run (see [below for nested schema](#nestedatt--tests)) | ||
- `timeout` (String) The maximum amount of time to wait for all tests to complete. This includes the time it takes to start and destroy the driver. | ||
|
||
### Read-Only | ||
|
||
- `id` (String) The unique identifier for the test. If a name is provided, this will be the name appended with a random suffix. | ||
|
||
<a id="nestedatt--drivers"></a> | ||
### Nested Schema for `drivers` | ||
|
||
Optional: | ||
|
||
- `docker_in_docker` (Attributes) The docker_in_docker driver (see [below for nested schema](#nestedatt--drivers--docker_in_docker)) | ||
- `k3s_in_docker` (Attributes) The k3s_in_docker driver (see [below for nested schema](#nestedatt--drivers--k3s_in_docker)) | ||
|
||
<a id="nestedatt--drivers--docker_in_docker"></a> | ||
### Nested Schema for `drivers.docker_in_docker` | ||
|
||
Optional: | ||
|
||
- `image` (String) The image reference to use for the docker-in-docker driver | ||
|
||
|
||
<a id="nestedatt--drivers--k3s_in_docker"></a> | ||
### Nested Schema for `drivers.k3s_in_docker` | ||
|
||
Optional: | ||
|
||
- `cni` (Boolean) Enable the CNI plugin | ||
- `image` (String) The image reference to use for the k3s_in_docker driver | ||
- `metrics_server` (Boolean) Enable the metrics server | ||
- `network_policy` (Boolean) Enable the network policy | ||
- `registries` (Attributes Map) A map of registries containing configuration for optional auth, tls, and mirror configuration. (see [below for nested schema](#nestedatt--drivers--k3s_in_docker--registries)) | ||
- `traefik` (Boolean) Enable the traefik ingress controller | ||
|
||
<a id="nestedatt--drivers--k3s_in_docker--registries"></a> | ||
### Nested Schema for `drivers.k3s_in_docker.registries` | ||
|
||
Optional: | ||
|
||
- `mirrors` (Attributes) A map of registries containing configuration for optional auth, tls, and mirror configuration. (see [below for nested schema](#nestedatt--drivers--k3s_in_docker--registries--mirrors)) | ||
|
||
<a id="nestedatt--drivers--k3s_in_docker--registries--mirrors"></a> | ||
### Nested Schema for `drivers.k3s_in_docker.registries.mirrors` | ||
|
||
Optional: | ||
|
||
- `endpoints` (List of String) | ||
|
||
|
||
|
||
|
||
|
||
<a id="nestedatt--tests"></a> | ||
### Nested Schema for `tests` | ||
|
||
Required: | ||
|
||
- `image` (String) The image reference to use as the base image for the test. | ||
- `name` (String) The name of the test | ||
|
||
Optional: | ||
|
||
- `cmd` (String) When specified, will override the sandbox image's CMD (oci config). | ||
- `content` (Attributes List) The content to use for the test (see [below for nested schema](#nestedatt--tests--content)) | ||
- `envs` (Map of String) Environment variables to set on the test container. These will overwrite the environment variables set in the image's config on conflicts. | ||
- `timeout` (String) The maximum amount of time to wait for the individual test to complete. This is encompassed by the overall timeout of the parent tests resource. | ||
|
||
<a id="nestedatt--tests--content"></a> | ||
### Nested Schema for `tests.content` | ||
|
||
Required: | ||
|
||
- `source` (String) The source path to use for the test | ||
|
||
Optional: | ||
|
||
- `target` (String) The target path to use for the test |
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,32 @@ | ||
terraform { | ||
required_providers { | ||
imagetest = { | ||
source = "registry.terraform.io/chainguard-dev/imagetest" | ||
} | ||
} | ||
backend "inmem" {} | ||
} | ||
|
||
locals { repo = "localhost:55232/foo" } | ||
|
||
provider "imagetest" { | ||
repo = local.repo | ||
} | ||
|
||
resource "imagetest_tests" "foo" { | ||
name = "foo" | ||
driver = "k3s_in_docker" | ||
|
||
images = { | ||
foo = "cgr.dev/chainguard/busybox:latest@sha256:b7fc3eef4303188eb295aaf8e02d888ced307d2a45090d6f673b95a41bfc033d" | ||
} | ||
|
||
tests = [ | ||
{ | ||
name = "sample" | ||
image = "cgr.dev/chainguard/kubectl:latest-dev@sha256:5751a1672a7debcc5e847bc1cc6ebfc8899aad188ff90f0445bfef194a9fa512" | ||
content = [{ source = "${path.module}/tests" }] | ||
cmd = "/imagetest/foo.sh" | ||
} | ||
] | ||
} |
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,11 @@ | ||
#!/bin/sh | ||
|
||
# Test sandbox _always_ has these set via the entrypoint wrapper | ||
# set -eux -o pipefail | ||
|
||
# Test sandbox environment is based on wolfi | ||
apk add jq | ||
|
||
# Test sandbox always has $IMAGES, which are the terraform images parsed into | ||
# their constituent parts | ||
echo "$IMAGES" | jq '.' |
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,12 @@ | ||
// dockerindocker is a driver that runs each test container in its _own_ dind | ||
// sandbox. Each test container is created as a new image, with the base layer | ||
// containing the dind image, and subsequent layers containing the test | ||
// container. Mapped out, the layers look like: | ||
// | ||
// 0: cgr.dev/chainguard-private/docker-dind:latest | ||
// 1: imagetest created layer, with the appropriate test content and apk dependencies | ||
// | ||
// Things are done this way to ensure the tests that run _feel_ like they are | ||
// simply in an environment with docker installed, while also ensuring they are | ||
// portable to other drivers, such as docker-in-a-vm. | ||
package dockerindocker |
Oops, something went wrong.