Skip to content

Commit 8f4afca

Browse files
authored
Merge pull request #21 from nginxinc/ag-cert-test-fixes
Update action to first update certs then configurations. Plus test fixes.
2 parents cc236bc + 1b3ddcf commit 8f4afca

File tree

2 files changed

+20
-25
lines changed

2 files changed

+20
-25
lines changed

.github/workflows/testNginxForAzureDeploy.yml

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,6 @@ jobs:
2929
client-id: ${{ secrets.AZURE_CLIENT_ID }}
3030
tenant-id: ${{ secrets.AZURE_TENANT_ID }}
3131
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
32-
- name: "Sync NGINX certificate to NGINX for Azure - single cert"
33-
uses: nginxinc/[email protected]
34-
with:
35-
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
36-
resource-group-name: $TEST_RESOURCE_GROUP_NAME
37-
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
38-
nginx-certificate-details: '[{"certificateName": "$NGINX_CERT_NAME", "keyvaultSecret": "https://$NGINX_VAULT_NAME.vault.azure.net/secrets/$NGINX_CERT_NAME", "certificateVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_NUMBER/my-cert.crt", "keyVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_NUMBER/my-cert.key" } ]'
3932

4033
- name: "Update config - single file"
4134
shell: bash
@@ -62,15 +55,17 @@ jobs:
6255
cat test/configs/single/nginx.conf
6356
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' test/configs/multi/conf.d/proxy.conf
6457
cat test/configs/multi/conf.d/proxy.conf
65-
- name: "Sync NGINX configuration to NGINX for Azure - multi file"
58+
- name: "Sync NGINX configuration and certificate to NGINX for Azure - multi file"
6659
uses: nginxinc/[email protected]
6760
with:
6861
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
6962
resource-group-name: $TEST_RESOURCE_GROUP_NAME
7063
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
64+
nginx-resource-location: "westcentralus"
7165
nginx-config-directory-path: test/configs/multi/
7266
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
7367
transformed-nginx-config-directory-path: $NGINX_TRANSFORMED_CONFIG_DIR_PATH
68+
nginx-certificate-details: '[{"certificateName": "$NGINX_CERT_NAME", "keyvaultSecret": "https://$NGINX_VAULT_NAME.vault.azure.net/secrets/$NGINX_CERT_NAME", "certificateVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_NUMBER/my-cert.crt", "keyVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_NUMBER/my-cert.key" } ]'
7469

7570
- name: "Validate config update"
7671
shell: bash

action.yml

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,44 @@
1-
name: 'NGINX For Azure Deployment Sync'
2-
description: 'The action synchronizes NGINX configuration from a Git repository and/or certificates already on Azure keyvault to an NGINX for Azure deployment'
1+
name: "NGINX For Azure Deployment Sync"
2+
description: "The action synchronizes NGINX configuration from a Git repository and/or certificates already on Azure keyvault to an NGINX for Azure deployment"
33
inputs:
44
subscription-id:
5-
description: 'The Azure subscription ID of the NGINX for Azure deployment.'
5+
description: "The Azure subscription ID of the NGINX for Azure deployment."
66
required: true
77
resource-group-name:
8-
description: 'The resource group of the NGINX for Azure deployment.'
8+
description: "The resource group of the NGINX for Azure deployment."
99
required: true
1010
nginx-deployment-name:
11-
description: 'The name of the NGINX for Azure deployment.'
11+
description: "The name of the NGINX for Azure deployment."
1212
required: true
1313
nginx-deployment-location:
14-
description: 'The location where the NGINX deployment is located. Example westcentralus'
14+
description: "The location where the NGINX deployment is located. Example westcentralus"
1515
required: false
1616
nginx-config-directory-path:
1717
description: 'The NGINX configuration directory path relative to the root of the Git repository, example: "config/".'
1818
required: false
1919
nginx-root-config-file:
2020
description: >
21-
'The root NGINX configuration file path relative to the NGINX configuration directory in the Git repository, example: "nginx.conf".'
21+
'The root NGINX configuration file path relative to the NGINX configuration directory in the Git repository, example: "nginx.conf".'
2222
required: false
23-
default: 'nginx.conf'
23+
default: "nginx.conf"
2424
transformed-nginx-config-directory-path:
2525
description: >
26-
'The transformed absolute path of the NGINX configuration directory in NGINX for Azure deployment, example: "/etc/nginx/".
27-
If the "include" directive in the NGINX configuration files uses absolute paths, the path transformation
28-
can be used to overwrite the file paths when the action synchronizes the files to the NGINX for Azure deployment.'
26+
'The transformed absolute path of the NGINX configuration directory in NGINX for Azure deployment, example: "/etc/nginx/".
27+
If the "include" directive in the NGINX configuration files uses absolute paths, the path transformation
28+
can be used to overwrite the file paths when the action synchronizes the files to the NGINX for Azure deployment.'
2929
required: false
30-
default: ''
30+
default: ""
3131
nginx-certificate-details:
3232
description: 'An array of JSON objects each with keys nginx_cert_name, keyvault_secret, certificate_virtual_path and key_virtual_path. Example: [{"certificateName": "server1", "keyvaultSecret": "https://...", "certificateVirtualPath": "/etc/ssl/certs/server1.crt", "keyVirtualPath": "/etc/ssl/certs/server1.key" }, {"name": "server2", "keyvaultSecret": "https://...", "certificateVirtualPath": "/etc/ssl/certs/server2.crt", "keyVirtualPath": "/etc/ssl/certs/server2.key" }] '
3333
required: false
3434
runs:
3535
using: "composite"
3636
steps:
37-
- name: 'Synchronize NGINX configuration from the Git repository to an NGINX for Azure deployment'
37+
- name: "Synchronize NGINX certificate(s) from the Git repository to an NGINX for Azure deployment"
38+
run: ${{github.action_path}}/src/deploy-certificate.sh --subscription_id=${{ inputs.subscription-id }} --resource_group_name=${{ inputs.resource-group-name }} --nginx_deployment_name=${{ inputs.nginx-deployment-name }} --nginx_resource_location=${{ inputs.nginx-deployment-location }} --certificates=${{ toJSON(inputs.nginx-certificate-details) }}
39+
if: ${{ inputs.nginx-deployment-location != '' && inputs.nginx-certificate-details != '' }}
40+
shell: bash
41+
- name: "Synchronize NGINX configuration from the Git repository to an NGINX for Azure deployment"
3842
run: ${{github.action_path}}/src/deploy-config.sh --subscription_id=${{ inputs.subscription-id }} --resource_group_name=${{ inputs.resource-group-name }} --nginx_deployment_name=${{ inputs.nginx-deployment-name }} --config_dir_path=${{ inputs.nginx-config-directory-path }} --root_config_file=${{ inputs.nginx-root-config-file }} --transformed_config_dir_path=${{ inputs.transformed-nginx-config-directory-path }}
3943
if: ${{ inputs.nginx-config-directory-path != '' }}
4044
shell: bash
41-
- name: 'Synchronize NGINX certificate(s) from the Git repository to an NGINX for Azure deployment'
42-
run: ${{github.action_path}}/src/deploy-certificate.sh --subscription_id=${{ inputs.subscription-id }} --resource_group_name=${{ inputs.resource-group-name }} --nginx_deployment_name=${{ inputs.nginx-deployment-name }} --nginx_resource_location=${{ inputs.nginx-deployment-location }} --certificates=${{ toJSON(inputs.nginx-certificate-details) }}
43-
if: ${{ inputs.nginx-deployment-location != '' && inputs.nginx-certificate-details != '' }}
44-
shell: bash

0 commit comments

Comments
 (0)