Skip to content

Commit c1b31cc

Browse files
authored
Merge pull request #4 from GoodOldJack12/main
CI and small fixes
2 parents 7b7fbaf + ae39b20 commit c1b31cc

10 files changed

Lines changed: 52 additions & 20 deletions

File tree

.github/workflows/ci.yaml

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
pull_request:
6+
7+
permissions:
8+
contents: read
9+
10+
jobs:
11+
checks:
12+
runs-on: ubuntu-latest
13+
strategy:
14+
matrix:
15+
check:
16+
- name: local-module-check
17+
run: ./tests/local-module-check.test.sh
18+
- name: fmt-check
19+
run: ./tests/tofu-fmt.test.sh
20+
21+
name: ${{ matrix.check.name }}
22+
23+
steps:
24+
- uses: actions/checkout@v4
25+
26+
- uses: opentofu/setup-opentofu@v1
27+
with:
28+
tofu_version: "1.11.0"
29+
30+
- run: tofu version
31+
- run: chmod +x tests/*.sh
32+
- run: ${{ matrix.check.run }}

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,4 @@
11
.terraform/
22
.terraform.lock.*
3+
*.tfstate
4+
*.tfstate.*

examples/multiple-vms/main.tf

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Router definition
22
module "router" {
3-
source = "hpcugent/vsc/opennebula//submodules/router"
3+
source = "hpcugent/opennebula/vsc//modules/router"
44
version = "0.0.3"
55
#VM Which we can ssh to by default
66
access_vm = module.Main.router_access
@@ -16,7 +16,7 @@ module "router" {
1616
}
1717
}
1818
module "Main" {
19-
source = "hpcugent/vsc/opennebula"
19+
source = "hpcugent/opennebula/vsc"
2020
version = "0.0.3"
2121
vm_name = "MultipleExampleMain"
2222
image_name = "Rocky 9"
@@ -25,7 +25,7 @@ module "Main" {
2525
firewall_services = ["http"] # Automatically allows ports 80 & 443
2626
}
2727
module "Secondary" {
28-
source = "hpcugent/vsc/opennebula"
28+
source = "hpcugent/opennebula/vsc"
2929
version = "0.0.3"
3030
vm_name = "MultipleExampleSecondary"
3131
image_name = "Ubuntu 24.04"

examples/simple-server/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Router definition
22
module "router" {
3-
source = "hpcugent/vsc/opennebula//submodules/router"
3+
source = "hpcugent/opennebula/vsc//modules/router"
44
version = "0.0.3"
55
# VM Which we can ssh to by default
66
access_vm = module.SimpleVM.router_access
77
}
88
module "SimpleVM" {
9-
source = "hpcugent/vsc/opennebula"
9+
source = "hpcugent/opennebula/vsc"
1010
version = "0.0.3"
1111
vm_name = "SimpleExample"
1212
image_name = "Rocky 9"

examples/webserver/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Router definition
22
module "router" {
3-
source = "hpcugent/vsc/opennebula//submodules/router"
3+
source = "hpcugent/opennebula/vsc//modules/router"
44
version = "0.0.3"
55
#VM Which we can ssh to by default
66
access_vm = module.WebServer.router_access
@@ -14,7 +14,7 @@ module "router" {
1414
}
1515
}
1616
module "WebServer" {
17-
source = "hpcugent/vsc/opennebula"
17+
source = "hpcugent/opennebula/vsc"
1818
version = "0.0.3"
1919
vm_name = "WebExample"
2020
image_name = "Rocky 9"

examples/windows/main.tf

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
# Router definition
22
module "router" {
3-
source = "hpcugent/vsc/opennebula//submodules/router"
3+
source = "hpcugent/opennebula/vsc//modules/router"
44
version = "0.0.3"
55
#VM Which we can ssh/rdp to by default
66
access_vm = module.vsc-opennebula.router_access
77
}
88
module "vsc-opennebula" {
9-
source = "hpcugent/vsc/opennebula"
9+
source = "hpcugent/opennebula/vsc"
1010
version = "0.0.3"
1111
vm_name = "JonTest"
1212
image_name = "Windows 11"

fixup-examples.sh

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,12 +10,14 @@ if [[ "$MODE" != "remote" && "$MODE" != "local" ]]; then
1010
fi
1111

1212
LOCAL_BASE='"../../"'
13-
REMOTE_BASE='"hpcugent/vsc/opennebula"'
13+
REMOTE_BASE='"hpcugent/opennebula/vsc"'
1414
LOCAL_ROUTER_BASE='"../../modules/router"'
15-
REMOTE_ROUTER_BASE='"hpcugent/vsc/opennebula//submodules/router"'
15+
REMOTE_ROUTER_BASE='"hpcugent/opennebula/vsc//modules/router"'
1616
VERSION='0.0.3'
1717

18-
find "$ROOT_DIR/examples" -type f -name 'main.tf' -print0 |
18+
find "$ROOT_DIR/examples" \
19+
-type d -name '.terraform' -prune -o \
20+
-type f -name 'main.tf' -print0 |
1921
while IFS= read -r -d '' file; do
2022
if [[ "$MODE" == "remote" ]]; then
2123
sed -i \

modules/router/variables.tf

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -30,10 +30,5 @@ variable "port_forwards" {
3030
)
3131
error_message = "External port must be 80, 443, or between ${local.ugent_port_range.min} and ${local.ugent_port_range.max}."
3232
}
33-
description = <<-EOF
34-
List of port forwarding rules.
35-
internal_ip (optional) default: access_vm IP
36-
internal_port (optional) default: external_port
37-
external_port (required) MUST be between 51001 and 59999 OR port 80/443
38-
EOF
33+
description = "List of port forwarding rules."
3934
}

tests/local-module-check.test.sh

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
#!/bin/bash
2+
: "${ROOT_DIR:=$(pwd)}"
3+
24
if [[ -f "common.sh" ]];then
35
source common.sh
46
elif [[ -d tests ]];then

tests/runAll.sh

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ TEST_SCRIPTS=(
55
"./module-tofu.test.sh"
66
"./examples-tofu.test.sh"
77
"./tofu-fmt.test.sh"
8-
#"./local-module-check.test.sh"
8+
"./local-module-check.test.sh" # This one should always be last
99
)
1010

1111
# Array to hold exit codes
@@ -17,7 +17,6 @@ for script in "${TEST_SCRIPTS[@]}"; do
1717
EXIT_CODES+=($?) # store exit code
1818
echo ""
1919
done
20-
2120
# Check if any failed
2221
FAILED=()
2322
for i in "${!TEST_SCRIPTS[@]}"; do

0 commit comments

Comments
 (0)