From c2f2e6660ae375f84c8a054714946bf6c80b0ef4 Mon Sep 17 00:00:00 2001 From: Eesaan Atluri <atlurie@uab.edu> Date: Tue, 14 Jan 2025 21:53:09 -0500 Subject: [PATCH] feat: Use conditional to make --network optional Closes https://gitlab.rc.uab.edu/rc/hpc-factory/-/issues/181 Defining a network can be optional when a port is already defined when deploying a VM. This commit adds flexibility where you can either use --port or --network options to define a network during the deployment. Alternatively, you can define both but the port cannot be from the same network you used in the --network option. Otherwise, you will have two ips from the same network which will cause network reachability issues. --- .gitlab-ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 8915b12..393f414 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -212,6 +212,7 @@ deploy_http_proxy_node: cmd+=" --security-group $security_group" done cmd+=" --user-data user_data.txt" + if [ -n "$PROXY_NETWORK" ];then cmd+=" --network $PROXY_NETWORK"; fi if [ -n "$HTTP_PROXY_PORT" ];then cmd+=" --port $HTTP_PROXY_PORT"; fi cmd+=" --wait $HTTP_PROXY_INSTANCE_NAME" - export HTTP_PROXY_INSTANCE_ID=$(bash -c "$cmd") @@ -265,6 +266,7 @@ deploy_ssh_proxy_node: cmd+=" --security-group $security_group" done cmd+=" --user-data user_data.txt" + if [ -n "$PROXY_NETWORK" ];then cmd+=" --network $PROXY_NETWORK"; fi if [ -n "$SSH_PROXY_PORT" ];then cmd+=" --port $SSH_PROXY_PORT"; fi cmd+=" --wait $SSH_PROXY_INSTANCE_NAME" - export SSH_PROXY_INSTANCE_ID=$(bash -c "$cmd") @@ -319,6 +321,7 @@ deploy_login_node: cmd+=" --security-group $security_group" done cmd+=" --user-data user_data.txt" + if [ -n "$INSTANCE_NETWORK" ];then cmd+=" --network $INSTANCE_NETWORK"; fi if [ -n "$LOGIN_PORT" ];then cmd+=" --port $LOGIN_PORT"; fi cmd+=" --wait $LOGIN_INSTANCE_NAME" - export LOGIN_INSTANCE_ID=$(bash -c "$cmd") -- GitLab