Skip to content
Merged
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
11 changes: 11 additions & 0 deletions Dockerfile.test-images
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
FROM python:3.10

# Download Terraform
RUN apt-get update && \
apt-get install -y wget unzip gnupg software-properties-common && \
wget -O terraform.zip https://releases.hashicorp.com/terraform/1.12.1/terraform_1.12.1_linux_amd64.zip && \
unzip terraform.zip && mv terraform /usr/local/bin/ && \
rm terraform.zip && terraform -version

COPY ../requirements/base.txt /tmp/requirements.txt
RUN pip install -r /tmp/requirements.txt
4 changes: 2 additions & 2 deletions alts/shared/terraform.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,9 +148,9 @@ def get_opennebula_template_regex(
else:
arches_to_try = dist_arch
if test_flavor_name and test_flavor_version:
flavor = f'{test_flavor_name}-{test_flavor_version}'
flavor = f'{test_flavor_name}-?{test_flavor_version}'
regex_str = (
rf'{dist_name}-{dist_version}-({arches_to_try})\.{flavor}\.'
rf'^{dist_name}-{dist_version}-({arches_to_try})\.{flavor}\.'
rf'test_system\.({channels})\.b\d{{8}}-\d+'
)
# Escape backslashes for Terraform HCL string
Expand Down
21 changes: 16 additions & 5 deletions resources/opennebula/opennebula.tf.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ variable "one_username" {}
variable "one_password" {
sensitive = true
}
variable "load_all_templates" {
type = bool
default = false
description = "If true, output all matching templates; otherwise, only one"
}

provider "opennebula" {
endpoint = var.one_endpoint
Expand Down Expand Up @@ -31,11 +36,16 @@ locals {

has_templates_with_channels = length(local.templates_with_channels) > 0

selected_template = (
local.has_templates_with_channels ? local.templates_with_channels[0] :
local.all_templates[0]
candidate_templates = (
local.has_templates_with_channels ? local.templates_with_channels : local.all_templates
)

selected_templates = (
var.load_all_templates ? local.candidate_templates : [local.candidate_templates[0]]
)

selected_template = local.selected_templates[0]

disk_0 = local.selected_template.disk[0]
disk_size = max(
local.disk_0.size, # Original disk size from template
Expand Down Expand Up @@ -79,6 +89,7 @@ output "vm_id" {
value = opennebula_virtual_machine.${vm_name}.id
}

output "template_name" {
value = local.selected_template.name
output "template_names" {
value = [for t in local.selected_templates : t.name]
description = "Array of selected template names (1 or many depending on flag)"
}
Empty file added scripts/__init__.py
Empty file.
11 changes: 11 additions & 0 deletions scripts/test_config.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
---

broker_config:
rabbitmq_host: localhost
rabbitmq_port: 5671
rabbitmq_user: albs
rabbitmq_password: some-another-secret-password
rabbitmq_vhost: test_system

results_backend_config:
path: file:///srv/celery_results
Loading
Loading