|
16 | 16 |
|
17 | 17 | gha_version="0.1.0" |
18 | 18 |
|
19 | | -image="$1" |
20 | | -app_name="$2" |
21 | | -location="$3" |
22 | | -cluster_name="$4" |
23 | | -project_id="$5" |
24 | | -namespace="$6" |
25 | | -expose_port="$7" |
26 | | -k8s_manifests="$8" |
| 19 | +image="${1}" |
| 20 | +app_name="${2}" |
| 21 | +location="${3}" |
| 22 | +cluster_name="${4}" |
| 23 | +project_id="${5}" |
| 24 | +namespace="${6}" |
| 25 | +expose_port="${7}" |
| 26 | +k8s_manifests="${8}" |
27 | 27 |
|
28 | | -gke_deploy_command="gke-deploy run -i $image -a $app_name -l $location -c $cluster_name -p $project_id" |
| 28 | +gke_deploy_command="gke-deploy run -i ${image} -a ${app_name} -l ${location} -c ${cluster_name} -p ${project_id}" |
29 | 29 |
|
30 | 30 | # Ensure all required variables are provided by workflow users. |
31 | | -if [ -z "$image" ] || [ -z "$app_name" ] || [ -z "$location" ] || [ -z "$cluster_name" ] || [ -z "$project_id" ]; then |
| 31 | +if [ -z "${image}" ] || [ -z "${app_name}" ] || [ -z "${location}" ] || [ -z "${cluster_name}" ] || [ -z "${project_id}" ]; then |
32 | 32 | echo "Error: Required variables (image, app_name, location, cluster_name, project_id) are not set." |
33 | 33 | exit 1 |
34 | 34 | fi |
35 | 35 |
|
36 | 36 | # Add namespace if the input is apparent. |
37 | | -if [ -n "$namespace" ]; then |
38 | | - gke_deploy_command="$gke_deploy_command -n $namespace" |
| 37 | +if [ -n "${namespace}" ]; then |
| 38 | + gke_deploy_command="${gke_deploy_command} -n ${namespace}" |
39 | 39 | fi |
40 | 40 |
|
41 | 41 | # Add expose port if the input is apparent. |
42 | | -if [ -n "$expose_port" ]; then |
43 | | - gke_deploy_command="$gke_deploy_command -x $expose_port" |
| 42 | +if [ -n "${expose_port}" ]; then |
| 43 | + gke_deploy_command="${gke_deploy_command} -x ${expose_port}" |
44 | 44 | fi |
45 | 45 |
|
46 | 46 | # Add k8s manifests file(s) if the input is apparent. |
47 | | -if [ -n "$k8s_manifests" ]; then |
48 | | - gke_deploy_command="$gke_deploy_command -f $k8s_manifests" |
| 47 | +if [ -n "${k8s_manifests}" ]; then |
| 48 | + gke_deploy_command="${gke_deploy_command} -f ${k8s_manifests}" |
49 | 49 | fi |
50 | 50 |
|
51 | 51 | # Utilize Google APIs user agent for metrics with the following unique identifier: |
52 | | -export GOOGLE_APIS_USER_AGENT=google-github-action:deploy-gke/$gha_version |
| 52 | +export GOOGLE_APIS_USER_AGENT="google-github-action:deploy-gke/${gha_version}" |
53 | 53 |
|
54 | | -$gke_deploy_command |
| 54 | +"${gke_deploy_command}" |
0 commit comments