Skip to content

Commit f5088f5

Browse files
authored
Merge pull request #22 from nginxinc/ag-parameter-fixes
Renamed nginx-certificate-details to nginx-certificates. Fixed test bugs.
2 parents 8f4afca + 77a542c commit f5088f5

File tree

3 files changed

+11
-14
lines changed

3 files changed

+11
-14
lines changed

.github/workflows/testNginxForAzureDeploy.yml

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ jobs:
3636
sed -i 's/000000/'"$GITHUB_RUN_NUMBER"'/g' test/configs/single/nginx.conf
3737
cat test/configs/single/nginx.conf
3838
- name: "Sync NGINX configuration to NGINX for Azure - single file"
39-
uses: nginxinc/nginx-for-azure-deploy-action@v0.2.0
39+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
4040
with:
4141
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
4242
resource-group-name: $TEST_RESOURCE_GROUP_NAME
@@ -52,33 +52,30 @@ jobs:
5252
shell: bash
5353
run: |
5454
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' test/configs/multi/nginx.conf
55-
cat test/configs/single/nginx.conf
55+
cat test/configs/multi/nginx.conf
5656
sed -i 's/000000/'"$GITHUB_RUN_ID"'/g' test/configs/multi/conf.d/proxy.conf
5757
cat test/configs/multi/conf.d/proxy.conf
5858
- name: "Sync NGINX configuration and certificate to NGINX for Azure - multi file"
59-
uses: nginxinc/nginx-for-azure-deploy-action@v0.2.0
59+
uses: nginxinc/nginx-for-azure-deploy-action@v0.3.0
6060
with:
6161
subscription-id: ${{ secrets.AZURE_SUBSCRIPTION_ID }}
6262
resource-group-name: $TEST_RESOURCE_GROUP_NAME
6363
nginx-deployment-name: $NGINX_DEPLOYMENT_NAME
64-
nginx-resource-location: "westcentralus"
64+
nginx-deployment-location: "westcentralus"
6565
nginx-config-directory-path: test/configs/multi/
6666
nginx-root-config-file: $NGINX_ROOT_CONFIG_FILE
6767
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" } ]'
68+
nginx-certificates: '[{"certificateName": "$NGINX_CERT_NAME", "keyvaultSecret": "https://$NGINX_VAULT_NAME.vault.azure.net/secrets/$NGINX_CERT_NAME", "certificateVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_ID/my-cert.crt", "keyVirtualPath": "/etc/nginx/ssl/$GITHUB_RUN_ID/my-cert.key" } ]'
6969

7070
- name: "Validate config update"
7171
shell: bash
7272
run: |
7373
wget -O - -o /dev/null http://${{ secrets.NGINX_DEPLOYMENT_IP }} | jq '.request.headers."Github-Run-Id" | test( "'"$GITHUB_RUN_ID"'")'
74-
- name: "Create cert file"
74+
- name: "Validate certificate update"
7575
uses: azure/CLI@v1
7676
with:
7777
inlineScript: |
7878
echo "-----BEGIN CERTIFICATE-----" > /tmp/$GITHUB_RUN_ID.tmp
7979
az keyvault certificate show --vault-name $NGINX_VAULT_NAME -n $NGINX_CERT_NAME | jq -r .cer | cat >> /tmp/$GITHUB_RUN_ID.tmp
8080
echo "-----END CERTIFICATE-----" >> /tmp/$GITHUB_RUN_ID.tmp
81-
- name: "Validate certificate update"
82-
shell: bash
83-
run: |
84-
wget -O - -o /dev/null https://${{ secrets.NGINX_DEPLOYMENT_IP }} --ca-certificate=/tmp/$GITHUB_RUN_ID.tmp | jq '.request.headers."Github-Run-Id" | test( "'"$GITHUB_RUN_ID"'")'
81+
wget -O - -o /dev/null https://${{ secrets.NGINX_DEPLOYMENT_IP }} --ca-certificate=/tmp/$GITHUB_RUN_ID.tmp | jq '.request.headers."Github-Run-Id" | test( "'"$GITHUB_RUN_ID"'")'

action.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -28,15 +28,15 @@ inputs:
2828
can be used to overwrite the file paths when the action synchronizes the files to the NGINX for Azure deployment.'
2929
required: false
3030
default: ""
31-
nginx-certificate-details:
31+
nginx-certificates:
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:
3737
- 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 != '' }}
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-certificates) }}
39+
if: ${{ inputs.nginx-deployment-location != '' && inputs.nginx-certificates != '' }}
4040
shell: bash
4141
- name: "Synchronize NGINX configuration from the Git repository to an NGINX for Azure deployment"
4242
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 }}

src/deploy-certificate.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ then
5454
fi
5555
if [[ ! -v certificates ]];
5656
then
57-
echo "Please set 'nginx-certificate-details' ..."
57+
echo "Please set 'nginx-certificates' ..."
5858
exit 1
5959
fi
6060

0 commit comments

Comments
 (0)