Skip to content

Updated test workflow to verify both single and multi file configs #9

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 18, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 28 additions & 7 deletions .github/workflows/testNginxForAzureDeploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ on:

env:
NGINX_DEPLOYMENT_NAME: githhubci-test-dep
NGINX_CONFIG_FILE: test/configs/nginx.conf
NGINX_TRANSFORMED_CONFIG_DIR_PATH: /etc/nginx/
NGINX_ROOT_CONFIG_FILE: nginx.conf
TEST_RESOURCE_GROUP_NAME: testenv-0da38993-workload

permissions:
Expand All @@ -20,23 +21,43 @@ jobs:
steps:
- name: 'Checkout repository'
uses: actions/checkout@v2
- name: 'Update config'
shell: bash
run: |
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' $NGINX_CONFIG_FILE
- name: 'AZ CLI Login'
uses: azure/login@v1
with:
client-id: ${{ secrets.AZURE_CLIENT_ID }}
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
- name: 'Sync NGINX configuration to NGINX on Azure instance'
- name: 'Update config - single file'
shell: bash
run: |
echo "RANDOM=$((RANDOM%10))" >> $GITHUB_ENV
sed -i 's/000000/'"${ env.RANDOM }"'/g' tests/configs/single/nginx.conf
- name: 'Sync NGINX configuration to NGINX on Azure instance - single file'
uses: nginxinc/nginx-for-azure-deploy-action@v0
with:
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resource-group-name: $TEST_RESOURCE_GROUP_NAME
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
nginx-config-directory-path: tests/configs/single/
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
transformed-nginx-config-directory-path: $NGINX_TRANSFORMED_CONFIG_DIR_PATH
- name: 'Validate config update - single file'
shell: bash
run: |
wget -O - -o /dev/null http://${{ secrets.NGINX_DEPLOYMENT_IP }} | jq '.request.headers."Github-Run-Id" | test( "'"${ env.RANDOM }"'")'
- name: 'Update config - multi file'
shell: bash
run: |
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' tests/configs/multi/conf.d/proxy.conf
- name: 'Sync NGINX configuration to NGINX on Azure instance - multi file'
uses: nginxinc/nginx-for-azure-deploy-action@v0
with:
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
resource-group-name: $TEST_RESOURCE_GROUP_NAME
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
nginx-config-relative-file-path: $NGINX_CONFIG_FILE
nginx-config-directory-path: tests/configs/multi/
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
transformed-nginx-config-directory-path: $NGINX_TRANSFORMED_CONFIG_DIR_PATH
- name: 'Validate config update'
shell: bash
run: |
Expand Down
8 changes: 8 additions & 0 deletions test/configs/multi/conf.d/proxy.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
proxy_set_header Host $host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header X-Proxy-App app;
proxy_set_header Github-Run-Id 000000;
proxy_buffering on;
proxy_buffer_size 4k;
proxy_buffers 8 8k;
proxy_read_timeout 60s;
19 changes: 19 additions & 0 deletions test/configs/multi/nginx.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
http {
upstream app {
zone app 64k;
least_conn;
server 10.0.1.4:8000;
}

server {
listen 80;
server_name *.example.com;

location / {
include /etc/nginx/conf.d/proxy.conf;
proxy_pass http://app;
health_check;
}

}
}
File renamed without changes.