Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 15 additions & 1 deletion benchmark_runner/grafana/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ FROM quay.io/centos/centos:stream9
WORKDIR /app

ENV TERRAFORM_VERSION=1.5.4
# Pre-seeded provider directory: terraform init at runtime uses -plugin-dir so
# CI does not depend on registry.terraform.io being reachable.
ENV TF_PLUGIN_DIR=/terraform-plugins

RUN dnf update -y && \
dnf install -y git go wget unzip && \
Expand All @@ -13,6 +16,17 @@ RUN dnf update -y && \
mv terraform /usr/local/bin/ && \
rm terraform_${TERRAFORM_VERSION}_linux_amd64.zip

# Warm the jsonnet provider into TF_PLUGIN_DIR at build time so the runtime
# never has to query the provider registry for packages or checksums.
RUN mkdir -p ${TF_PLUGIN_DIR} /tmp/warm && \
printf 'terraform {\n required_providers {\n jsonnet = {\n source = "alxrem/jsonnet"\n version = "2.5.0"\n }\n }\n}\n' > /tmp/warm/main.tf && \
cd /tmp/warm && \
terraform init -backend=false && \
cp -r /tmp/warm/.terraform/providers/* ${TF_PLUGIN_DIR}/ && \
cd / && rm -rf /tmp/warm

ENV PATH="/root/go/bin:${PATH}"

CMD ["/bin/sh", "-c", "terraform init; make; terraform destroy -auto-approve > /dev/null 2>&1"]
# -e plus && so a terraform init failure fails the run with its real error
# instead of a misleading downstream "Dashboard JSON content not found".
CMD ["/bin/sh", "-ec", "terraform init -backend=false -plugin-dir=${TF_PLUGIN_DIR} && make && terraform destroy -auto-approve > /dev/null 2>&1"]
2 changes: 1 addition & 1 deletion benchmark_runner/grafana/perf/dashboard.tf
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ terraform {
required_providers {
jsonnet = {
source = "alxrem/jsonnet"
version = ">= 2.2.0"
version = "2.5.0"
}
}
}
Expand Down
Loading