Skip to content

Certificate deployment in github action #19

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
Aug 30, 2022

Conversation

george-ngugi
Copy link
Contributor

Modifications made are to incorporate certificate deployment using the already existent github action. Consequently, one can do config and/or cert deployment for their Nginx on Azure.
The assumption is that certs are already in Azure key vault. The user provides a list of certs as a JSON array.
More details on the design discussion are as per issue 391
The deploy-config script is also modified to use named arguments instead of positional arguments.

Copy link
Member

@ornj ornj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Forgive me if this was answered on your doc, without access to Teams I cannot check.

I think it would be better to combine things into a single script. Users of Github actions I assume wouldn't be impacted by this, but users of Azure DevOps who we are instructing to use the script manually certainly will. Something like,

deploy.sh --subscription-id 6A87EB1F-F879-457F-94A2-6878AA6F2633 /
  --resource-group ExampleGroup /
  --name ExampleNGINXDeployment /
  --config-dir path/to/config /
  --certificate '{"name": "cert1", "keyvaultSecret": "...", ...}' /
  --certificate '{"name": "cert1", "keyvaultSecret": "...", ...}' /  # provide the option once per cert

Or if this is hard to use in automation, a single --certificates option that accepts a JSON array of certificate objects.

When using the script to update we could add a --skip-config and --skip-certificates flags to communicate the user does not intend to modify these settings, although I think automation use cases would just call the script the same way and leave it to us to handle no-ops.

@george-ngugi
Copy link
Contributor Author

Forgive me if this was answered on your doc, without access to Teams I cannot check.

I think it would be better to combine things into a single script. Users of Github actions I assume wouldn't be impacted by this, but users of Azure DevOps who we are instructing to use the script manually certainly will. Something like,

deploy.sh --subscription-id 6A87EB1F-F879-457F-94A2-6878AA6F2633 /
  --resource-group ExampleGroup /
  --name ExampleNGINXDeployment /
  --config-dir path/to/config /
  --certificate '{"name": "cert1", "keyvaultSecret": "...", ...}' /
  --certificate '{"name": "cert1", "keyvaultSecret": "...", ...}' /  # provide the option once per cert

Or if this is hard to use in automation, a single --certificates option that accepts a JSON array of certificate objects.

When using the script to update we could add a --skip-config and --skip-certificates flags to communicate the user does not intend to modify these settings, although I think automation use cases would just call the script the same way and leave it to us to handle no-ops.

I added such a script for this(deploy.sh), though it is not being referenced by the action. Work is also underway for the action on Azure pipelines (targeted for GA) so it can be used in the short term.

@george-ngugi george-ngugi force-pushed the george-ngugi/nginx-certs branch from c6c78c6 to df3dabb Compare August 17, 2022 11:36
@george-ngugi george-ngugi reopened this Aug 17, 2022
Copy link
Member

@ornj ornj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we merge the scripts together into a single deploy.sh? The majority of each script seems to be duplicate handling of options/arguments.

@george-ngugi george-ngugi force-pushed the george-ngugi/nginx-certs branch from a2ad853 to 3f06756 Compare August 19, 2022 09:41
@george-ngugi george-ngugi requested a review from ornj August 19, 2022 09:43
Copy link
Member

@ornj ornj left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approved with one last small nit. Can you please fix the files that are missing newline characters at the end? Look the change files for a symbol looking something like ⛔ at the end or \ No newline at end of file in the output of git diff. It's really minor but there are cases where it is helpful and is a little less noisy overall.

@george-ngugi george-ngugi force-pushed the george-ngugi/nginx-certs branch 3 times, most recently from d7d44a1 to 6f98e5e Compare August 19, 2022 18:22
@george-ngugi
Copy link
Contributor Author

george-ngugi commented Aug 19, 2022

Approved with one last small nit. Can you please fix the files that are missing newline characters at the end? Look the change files for a symbol looking something like ⛔ at the end or \ No newline at end of file in the output of git diff. It's really minor but there are cases where it is helpful and is a little less noisy overall.

Fixed. Thanks for bringing up these as well as some of the best practices highlighted earlier. It's some of those things one overlooks but are really important 😄

Add test files

Enhanced certificate script

Correct template to correctly name certificate; cleanup

Finalize the github action

Use named parameters

Implement new cert logic that skips KV step

Incorporate certificate changes in github action

use named arguments for deploy-config script

Validate JSON certificate details

Test my action; Cleanup

Correct per shell checks

Correct per shell checks

Manually run workflow

Remove validate bits

Run correct action

Run correct action

Run correct action

Correct typo

Trigger push

Trigger push

Update tag

Update tag

Use new tag

Make cert script executable

Make deploy-certificate.sh executable

Enclose JSON array argument in quotes

Remove buggy json check

Download ARM template from public storage

Echo json to view if valid

Echo json to view if valid

Echo json to view if valid

JSON array through action to test

View nginx-cert-details content

View nginx-cert-details content

revert script

Parse certificate arg directly

test toJSON

test toJSON

test toJSON

test toJSON

test toJSON in action

Push certs

A bug free run..

Remove jq parse bit

Restore prev workflow

Intro new entry script for smart deployment

Shell check fixes

Make deploy.sh executable

add path for external scripts

triggers for workflow

correct call

Add check confg and cert scripts since I can't run scripts inline

Rename file

Make scripts executable

Rename files as per ops

Correct conditions

Do checks on action

cleanup;pass correct arg

change arm template URI

correct URI

clean workflow

rename action name and other variables

Add new lines as flagged on github

Add new lines as flagged on github

remove .gitignore

Remove test workflow
@george-ngugi george-ngugi force-pushed the george-ngugi/nginx-certs branch from 6f98e5e to a69d33f Compare August 25, 2022 08:33
@george-ngugi george-ngugi merged commit 9313a85 into nginxinc:main Aug 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants