Skip to content

Commit

Permalink
automated commit
Browse files Browse the repository at this point in the history
Signed-off-by: Public copy <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
github-actions[bot] committed Oct 27, 2024
1 parent ac3b1ce commit 0641463
Show file tree
Hide file tree
Showing 3 changed files with 80 additions and 9 deletions.
15 changes: 14 additions & 1 deletion images/prometheus-cloudwatch-exporter/config/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,18 @@ variable "extra_packages" {
description = "The additional packages to install"
}

variable "entrypoint" {
description = "The entrypoint to use for the container"
type = string
default = "/usr/bin/java -jar /usr/share/java/cloudwatch_exporter/cloudwatch_exporter.jar 9106"
}

variable "extra_environments" {
description = "The additional environment variables to set"
type = map(string)
default = {}
}

output "config" {
value = jsonencode({
"contents" : {
Expand All @@ -25,10 +37,11 @@ output "config" {
"packages" : distinct(concat(local.baseline_packages, var.extra_packages))
},
"entrypoint" : {
"command" : "/usr/bin/java -jar /usr/share/java/cloudwatch_exporter/cloudwatch_exporter.jar 9106"
"command" : var.entrypoint
},
"cmd" : "/config/config.yml",
"accounts" : module.accts.block
environment = var.extra_environments
})
}

67 changes: 63 additions & 4 deletions images/prometheus-cloudwatch-exporter/tests/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@ variable "digest" {
description = "The image digest to run tests over."
}

variable "extra_testassertlogs" {
description = "Extra test assert logs"
type = list(string)
default = []
}

locals { parsed = provider::oci::parse(var.digest) }

data "oci_exec_test" "cloudwatch-runs" {
Expand All @@ -27,10 +33,9 @@ resource "imagetest_harness_k3s" "k3s" {
module "helm" {
source = "../../../tflib/imagetest/helm"

name = "prometheus-cloudwatch-exporter"
repo = "https://prometheus-community.github.io/helm-charts"
chart = "prometheus-cloudwatch-exporter"
namespace = "prometheus-cloudwatch-exporter"
name = "prometheus-cloudwatch-exporter"
repo = "https://prometheus-community.github.io/helm-charts"
chart = "prometheus-cloudwatch-exporter"

values = {
image = {
Expand All @@ -50,6 +55,60 @@ resource "imagetest_feature" "basic" {
name = "Install prometheus-cloudwatch-exporter"
cmd = module.helm.install_cmd
},
{
name = "Check expected logs"
cmd = <<EOF
logs_to_expect="
org.eclipse.jetty.server.Server doStart
Started Server
$(echo "${join("\n", var.extra_testassertlogs)}")
"
logs=$(kubectl logs deployment/prometheus-cloudwatch-exporter --all-containers)
echo "$logs_to_expect" | while IFS= read -r log; do
log=$(echo "$log" | xargs)
if [ -z "$log" ]; then
continue
fi
if ! echo "$logs" | grep -F -i "$log" > /dev/null; then
echo "Current logs: $logs"
echo "Expected log not found: $log"
exit 1
fi
done
EOF
},
{
name = "Check unexpected logs"
cmd = <<EOF
logs_to_not_expect="
connection refused
unable to load
ERROR
FAIL
FATAL
Traceback.*most.recent.call
Exception in thread
java.lang.NullPointerException
java.lang.RuntimeException
"
logs=$(kubectl logs deployment/prometheus-cloudwatch-exporter --all-containers)
echo "$logs_to_not_expect" | while IFS= read -r log; do
log=$(echo "$log" | xargs)
if [ -z "$log" ]; then
continue
fi
if echo "$logs" | grep -F -i "$log"; then
echo "Current logs: $logs"
echo "Unexpected log found: $log"
exit 1
fi
done
EOF
}
]

labels = {
Expand Down
7 changes: 3 additions & 4 deletions tflib/publisher/main.tf
Original file line number Diff line number Diff line change
Expand Up @@ -85,15 +85,14 @@ locals {

module "this" {
source = "chainguard-dev/apko/publisher"
version = "0.0.15"
version = "0.0.16"

target_repository = var.target_repository
config = yamlencode(local.updated_config)
extra_packages = var.extra_packages

check_sbom = var.check-sbom
sbom_checker = "cgr.dev/chainguard/ntia-conformance-checker:latest@sha256:75c1f8dcdf53d365bf30cdd630f800fa7a3b5d572ffc58346da6e5f1360e0787"
spdx_image = "cgr.dev/chainguard/spdx-tools:latest@sha256:cc4c0272f70ea9e8083c360787793fc7f847917942b49e80ed90d03199df0a55"
check_sbom = var.check-sbom
spdx_image = "cgr.dev/chainguard/spdx-tools:latest@sha256:cc4c0272f70ea9e8083c360787793fc7f847917942b49e80ed90d03199df0a55"
}

module "this-dev" {
Expand Down

0 comments on commit 0641463

Please sign in to comment.