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

Early validation #1368

Merged
merged 15 commits into from
Sep 28, 2023
Merged

Early validation #1368

merged 15 commits into from
Sep 28, 2023

Conversation

dbanck
Copy link
Member

@dbanck dbanck commented Aug 30, 2023

This PR merges the feature branch back into main

@dbanck dbanck added the enhancement New feature or request label Aug 30, 2023
@dbanck dbanck requested a review from a team as a code owner August 30, 2023 07:51
@dbanck dbanck self-assigned this Aug 30, 2023
@dbanck dbanck marked this pull request as draft August 30, 2023 13:46
@dbanck dbanck force-pushed the f-early-validation branch 2 times, most recently from b5b251f to 18ff8f8 Compare September 1, 2023 12:46
@radeksimko radeksimko force-pushed the f-early-validation branch 3 times, most recently from f5a17fe to 7b6cfdf Compare September 13, 2023 12:29
jpogran and others added 6 commits September 28, 2023 17:39
Adds `validation.earlyValidation` as a new setting.

I chose to use `validation` as a primary key as we expect to add future settings for this feature.
* Implement unreferenced variable validation (#1357)

Add the ability to use the collected origin and target references in early validation by providing a hook for validation funcs. This also adds a validator for unreferenced variables.

Validation funcs will be provided by terraform-ls for now, but may be moved into hcl-lang in the future.

* Introduce ValidationDiagnostics field to module

* Publish early validation diagnostics

* Include validation diagnotics in changes check

* Introduce early validation job

* Check ValidationDiagnosticsState when running validation

* Run early validation job after collection jobs

* Bump hcl-lang to `b6a3f8`

* Update internal/terraform/module/module_ops.go

Co-authored-by: Radek Simko <radek.simko@gmail.com>

---------

Co-authored-by: James Pogran <jpogran@outlook.com>
Co-authored-by: Radek Simko <radek.simko@gmail.com>
* Introduce different source for diagnostics

* Add reference validation job

* Run terraform validate as a job

* Track validation job states

* Review feedback

* Pass pathCtx to reference validation funcs

* Rename early validation job

* Bump hcl-lang to `29034e`

* Introduce VarsDiagnosticsState

* Fix tests
* Introduce new context for valiation settings

* Check context before scheduling jobs
* Introduce new RPCContextData for storing rpc info

* Attach RPCContextData to jobs

* Add RPCContextData to walker ctx, fix params

* Check RPCContext on SchemaValidation

* Bump hcl-lang to `485c60`

* Review feedback
radeksimko and others added 9 commits September 28, 2023 17:39
* validations: Limit ref. validation to only LocalOrigin(s)

* validations: add test for disabled origins
* validations: Enable reference validation of locals

* Update internal/decoder/validations/unreferenced_origin.go

Co-authored-by: Daniel Banck <dbanck@users.noreply.github.com>

* fix imports

---------

Co-authored-by: Daniel Banck <dbanck@users.noreply.github.com>
* deps: bump hcl-lang to aa9b38d (#1414)

* re-define decoupled validators
* Introduce validation of tfvars files

* clarify existing job name/type

* add tests
* Move everything into defer

* Add comment about lsctx

* Have module registry job depend on module metadata
@dbanck dbanck marked this pull request as ready for review September 28, 2023 15:39
Copy link
Contributor

@jpogran jpogran left a comment

Choose a reason for hiding this comment

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

:shipit:

Copy link
Member

@radeksimko radeksimko left a comment

Choose a reason for hiding this comment

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

giphy

@dbanck dbanck merged commit 3a8b158 into main Sep 28, 2023
22 checks passed
@dbanck dbanck deleted the f-early-validation branch September 28, 2023 15:47
@github-actions
Copy link

I'm going to lock this pull request because it has been closed for 30 days ⏳. This helps our maintainers find and focus on the active issues.
If you have found a problem that seems related to this change, please open a new issue and complete the issue template so we can capture all the details necessary to investigate further.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Oct 29, 2023
@xiehan xiehan added this to the v0.32.0 (tentative) milestone Jan 22, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants