Skip to content

Commit e5448fc

Browse files
committed
Updated test workflow to verify both single and multi file configurations.
1 parent 2ed0ce4 commit e5448fc

File tree

4 files changed

+55
-7
lines changed

4 files changed

+55
-7
lines changed

.github/workflows/testNginxForAzureDeploy.yml

Lines changed: 28 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,8 @@ on:
77

88
env:
99
NGINX_DEPLOYMENT_NAME: githhubci-test-dep
10-
NGINX_CONFIG_FILE: test/configs/nginx.conf
10+
NGINX_TRANSFORMED_CONFIG_DIR_PATH: /etc/nginx/
11+
NGINX_ROOT_CONFIG_FILE: nginx.conf
1112
TEST_RESOURCE_GROUP_NAME: testenv-0da38993-workload
1213

1314
permissions:
@@ -20,23 +21,43 @@ jobs:
2021
steps:
2122
- name: 'Checkout repository'
2223
uses: actions/checkout@v2
23-
- name: 'Update config'
24-
shell: bash
25-
run: |
26-
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' $NGINX_CONFIG_FILE
2724
- name: 'AZ CLI Login'
2825
uses: azure/login@v1
2926
with:
3027
client-id: ${{ secrets.AZURE_CLIENT_ID }}
3128
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
3229
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33-
- name: 'Sync NGINX configuration to NGINX on Azure instance'
30+
- name: 'Update config - single file'
31+
shell: bash
32+
run: |
33+
echo "RANDOM=$((RANDOM%10))" >> $GITHUB_ENV
34+
sed -i 's/000000/'"${ env.RANDOM }"'/g' tests/configs/single/nginx.conf
35+
- name: 'Sync NGINX configuration to NGINX on Azure instance - single file'
36+
uses: nginxinc/nginx-for-azure-deploy-action@v0
37+
with:
38+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
39+
resource-group-name: $TEST_RESOURCE_GROUP_NAME
40+
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
41+
nginx-config-directory-path: tests/configs/single/
42+
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
43+
transformed-nginx-config-directory-path: $NGINX_TRANSFORMED_CONFIG_DIR_PATH
44+
- name: 'Validate config update - single file'
45+
shell: bash
46+
run: |
47+
wget -O - -o /dev/null http://${{ secrets.NGINX_DEPLOYMENT_IP }} | jq '.request.headers."Github-Run-Id" | test( "'"${ env.RANDOM }"'")'
48+
- name: 'Update config - multi file'
49+
shell: bash
50+
run: |
51+
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' tests/configs/multi/conf.d/proxy.conf
52+
- name: 'Sync NGINX configuration to NGINX on Azure instance - multi file'
3453
uses: nginxinc/nginx-for-azure-deploy-action@v0
3554
with:
3655
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
3756
resource-group-name: $TEST_RESOURCE_GROUP_NAME
3857
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
39-
nginx-config-relative-file-path: $NGINX_CONFIG_FILE
58+
nginx-config-directory-path: tests/configs/multi/
59+
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
60+
transformed-nginx-config-directory-path: $NGINX_TRANSFORMED_CONFIG_DIR_PATH
4061
- name: 'Validate config update'
4162
shell: bash
4263
run: |

test/configs/multi/conf.d/proxy.conf

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
proxy_set_header Host $host;
2+
proxy_set_header X-Real-IP $remote_addr;
3+
proxy_set_header X-Proxy-App app;
4+
proxy_set_header Github-Run-Id 000000;
5+
proxy_buffering on;
6+
proxy_buffer_size 4k;
7+
proxy_buffers 8 8k;
8+
proxy_read_timeout 60s;

test/configs/multi/nginx.conf

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
http {
2+
upstream app {
3+
zone app 64k;
4+
least_conn;
5+
server 10.0.1.4:8000;
6+
}
7+
8+
server {
9+
listen 80;
10+
server_name *.example.com;
11+
12+
location / {
13+
include /etc/nginx/conf.d/proxy.conf;
14+
proxy_pass http://app;
15+
health_check;
16+
}
17+
18+
}
19+
}
File renamed without changes.

0 commit comments

Comments
 (0)