Skip to content

Commit 3d6ef3f

Browse files
committed
use NGINX cli to do configuration updates
This change enables the use of "az nginx deployment" cli to do configuration updates. This helps limit the permissions needed by the service principal to do config updates.
1 parent e02950b commit 3d6ef3f

File tree

2 files changed

+11
-58
lines changed

2 files changed

+11
-58
lines changed

github-action/src/deploy-config.sh

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@ echo "Successfully created the tarball from the NGINX configuration directory."
132132
echo "Listing the NGINX configuration file paths in the tarball."
133133
tar -tf "$config_tarball"
134134

135-
encoded_config_tarball=$(base64 "$config_tarball")
135+
encoded_config_tarball=$(base64 "$config_tarball" -w 0)
136136

137137
if [[ "$debug" == true ]]; then
138138
echo "The base64 encoded NGINX configuration tarball"
@@ -142,36 +142,28 @@ echo ""
142142

143143
# Synchronize the NGINX configuration tarball to the NGINXaaS for Azure deployment.
144144

145-
uuid="$(cat /proc/sys/kernel/random/uuid)"
146-
template_file="template-$uuid.json"
147-
template_deployment_name="${nginx_deployment_name:0:20}-$uuid"
148-
149-
wget -O "$template_file" https://raw.githubusercontent.com/nginxinc/nginx-for-azure-deploy-action/487d1394d6115d4f42ece6200cbd20859595557d/src/nginx-for-azure-configuration-template.json
150-
echo "Downloaded the ARM template for synchronizing NGINX configuration."
151-
cat "$template_file"
152-
echo ""
153-
154145
echo "Synchronizing NGINX configuration"
155146
echo "Subscription ID: $subscription_id"
156147
echo "Resource group name: $resource_group_name"
157148
echo "NGINXaaS for Azure deployment name: $nginx_deployment_name"
158-
echo "ARM template deployment name: $template_deployment_name"
159149
echo ""
160150

161151
az account set -s "$subscription_id" --verbose
162152

153+
echo "Installing the az nginx extension if not already installed."
154+
az extension add --name nginx --allow-preview true
155+
163156
az_cmd=(
164157
"az"
158+
"nginx"
165159
"deployment"
166-
"group"
167-
"create"
168-
"--name" "$template_deployment_name"
160+
"configuration"
161+
"update"
162+
"--name" "default"
163+
"--deployment-name" "$nginx_deployment_name"
169164
"--resource-group" "$resource_group_name"
170-
"--template-file" "$template_file"
171-
"--parameters"
172-
"nginxDeploymentName=$nginx_deployment_name"
173-
"rootFile=$transformed_root_config_file_path"
174-
"tarball=$encoded_config_tarball"
165+
"--root-file" "$transformed_root_config_file_path"
166+
"--package" "data=$encoded_config_tarball"
175167
"--verbose"
176168
)
177169

github-action/src/nginx-for-azure-configuration-template.json

Lines changed: 0 additions & 39 deletions
This file was deleted.

0 commit comments

Comments
 (0)