Skip to content
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

Check that Portal UI form outputs map to template parameter inputs on pull requests #620

Merged
merged 26 commits into from
Feb 2, 2022

Conversation

glennmusa
Copy link
Contributor

@glennmusa glennmusa commented Jan 25, 2022

Description

So that:

  • On a PR, check to see that the Portal UI is compatible with the compiled Bicep deployment template
  • check that all required parameters in the deployment template have a matching named output in the Portal UI template
  • check that the Portal UI template outputs contain only named values that are available parameters in the deployment template

Here's what it looks like when this check fails:

https://ag-ascii.visualstudio.com/Mission%20Landing%20Zone%20-%20Pipeline/_build/results?buildId=6746&view=results

Here's what it looks like when this check passes:

https://ag-ascii.visualstudio.com/Mission%20Landing%20Zone%20-%20Pipeline/_build/results?buildId=6756&view=results

These proposed changes:

  • adds an Azure DevOps Pipeline that executes on pull requests to /main
  • when the pipeline executes, the mlz.portal.json declarative form and mlz.json deployment template are validated and if any errors occur, the pipeline fails
  • references an external utility to perform the validation from glennmusa/validate-declarative-form

Issue reference

The issue this PR will close: #598

Checklist

Please make sure you've completed the relevant tasks for this PR out of the following list:

  • All acceptance criteria in the backlog item are met
  • The documentation is updated to cover any new or changed features
  • Manual tests have passed
  • Relevant issues are linked to this PR

@glennmusa glennmusa requested a review from a team as a code owner January 25, 2022 17:28
@glennmusa glennmusa marked this pull request as draft January 26, 2022 14:51
@glennmusa
Copy link
Contributor Author

glennmusa commented Jan 26, 2022

adding a check that the form is indeed a form and the deployment template is indeed a template

this could be done in the future with some schema validation, but, this'll do for now

@glennmusa glennmusa marked this pull request as ready for review January 26, 2022 16:17
@brooke-hamilton brooke-hamilton self-assigned this Feb 1, 2022
Copy link
Contributor

@brooke-hamilton brooke-hamilton left a comment

Choose a reason for hiding this comment

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

This PR is 🚀 🦖 🎉 . The README was easy to follow and I was able to reproduce everything documented there, including testing mismatched form and parameters. I had one issue with building the dev container, but I added a suggestion to fix it.

If you think this is a general purpose tool, in the future it could move to https://github.com/glennmusa and we could reference it there.

.vscode/extensions.json Outdated Show resolved Hide resolved
.vscode/settings.json Outdated Show resolved Hide resolved
.devcontainer/Dockerfile Outdated Show resolved Hide resolved
src/bicep/form/validation/README.md Outdated Show resolved Hide resolved
src/bicep/form/validation/README.md Outdated Show resolved Hide resolved
src/bicep/form/validation/README.md Outdated Show resolved Hide resolved
src/bicep/form/validation/validate_declarative_form.py Outdated Show resolved Hide resolved
@glennmusa
Copy link
Contributor Author

This PR is 🚀 🦖 🎉 . The README was easy to follow and I was able to reproduce everything documented there, including testing mismatched form and parameters. I had one issue with building the dev container, but I added a suggestion to fix it.

If you think this is a general purpose tool, in the future it could move to https://github.com/glennmusa and we could reference it there.

I like your idea to make use of this as a general purpose tool from a different repository:

  1. this tool is not MLZ-specific
  2. this tool should be superseded in time by an official product

I'll update this branch so that it makes use of the tool in a pipeline, but host that tool elsewhere. Thanks for the idea.

@glennmusa glennmusa marked this pull request as draft February 2, 2022 15:36
@glennmusa
Copy link
Contributor Author

Thanks for the thorough review @brooke-hamilton!

I've taken your advice and now host this tool here: https://github.com/glennmusa/validate-declarative-form

It's extremely lightweight today to cURL the single utility this change needs, but for completeness, I added an Issue in that backlog to expose the utility as a GitHub Action: glennmusa/validate-declarative-form#4

@glennmusa glennmusa marked this pull request as ready for review February 2, 2022 21:35
@brooke-hamilton brooke-hamilton merged commit 69a4a15 into main Feb 2, 2022
@brooke-hamilton brooke-hamilton deleted the glenn/declarativeFormValidation branch February 2, 2022 23:41
@brooke-hamilton brooke-hamilton added the core New feature or request label Feb 6, 2022
Breanna-Stryker added a commit that referenced this pull request Feb 21, 2022
* Check that Portal UI form outputs map to template parameter inputs on pull requests (#620)

* Move the workflow scripts to where they're used (#632)

* Update descriptions in alt text on main README.md (#633)

* Add spike issue template and remove feature request issue template (#635)

* Fix for Terraform issue in which the tier 2 subscription parameter is ignored (#638)

* Process for handling a broken build (#641)

* Clean-up nightly deployments using Azure CLI (#642)

* Add instructions for ASC/Defender cleanup (#643)

* Pin Bicep to v0.4.1272 (#650)

* SBOM generation in PR (#648)

* Update policy assignment resource provider version (#652)

* Generate SBOMs without .git contents (#654)

* Generate SBOM files during PR events (#656)

* check to see if the SBOM needs to be regenerated before running the pipeline again

* Update Software Bill of Materials (SBOM)

Co-authored-by: Microsoft.VisualStudio.Services.TFS <>

Co-authored-by: Glenn Musa <4622125+glennmusa@users.noreply.github.com>
Co-authored-by: Brooke Hamilton <45323234+brooke-hamilton@users.noreply.github.com>
Co-authored-by: Vidya Bala <vidbala@microsoft.com>
Co-authored-by: JeromeJansen <jjansen23@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
core New feature or request user interface
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

Automated validation that the Portal UI outputs map to deployment template parameter inputs
2 participants