Skip to content

Commit 034e778

Browse files
authored
Merge pull request #5 from nginxinc/ag-n4a-ci-test
Added workflow schedule to validate N4A github action
2 parents f7b42df + 8b75d69 commit 034e778

File tree

2 files changed

+69
-0
lines changed

2 files changed

+69
-0
lines changed
Lines changed: 43 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,43 @@
1+
# File: .github/workflows/testNginxForAzureDeploy.yml
2+
3+
name: Test Github action to update NGINX for Azure configurations
4+
on:
5+
schedule:
6+
- cron: '0 20 * * *'
7+
8+
env:
9+
NGINX_DEPLOYMENT_NAME: githhubci-test-dep
10+
NGINX_CONFIG_FILE: test/configs/nginx.conf
11+
TEST_RESOURCE_GROUP_NAME: testenv-0da38993-workload
12+
13+
permissions:
14+
id-token: write
15+
contents: read
16+
17+
jobs:
18+
Update-NGINX-Configuration:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: 'Checkout repository'
22+
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
27+
- name: 'AZ CLI Login'
28+
uses: azure/login@v1
29+
with:
30+
client-id: ${{ secrets.AZURE_CLIENT_ID }}
31+
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
32+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
33+
- name: 'Sync NGINX configuration to NGINX on Azure instance'
34+
uses: nginxinc/nginx-for-azure-deploy-action@v0
35+
with:
36+
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
37+
resource-group-name: $TEST_RESOURCE_GROUP_NAME
38+
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
39+
nginx-config-relative-file-path: $NGINX_CONFIG_FILE
40+
- name: 'Validate config update'
41+
shell: bash
42+
run: |
43+
wget -O - -o /dev/null http://${{ secrets.NGINX_DEPLOYMENT_IP }} | jq '.request.headers."Github-Run-Id" | test( "'"$GITHUB_RUN_ID"'")'

test/configs/nginx.conf

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
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+
proxy_set_header Host $host;
14+
proxy_set_header X-Real-IP $remote_addr;
15+
proxy_set_header X-Proxy-App app;
16+
proxy_set_header Github-Run-Id 000000;
17+
proxy_buffering on;
18+
proxy_buffer_size 4k;
19+
proxy_buffers 8 8k;
20+
proxy_read_timeout 60s;
21+
proxy_pass http://app;
22+
health_check;
23+
}
24+
25+
}
26+
}

0 commit comments

Comments
 (0)