Commit 11d233c
authored
* Update descriptions and validations
Signed-off-by: Timo Sand <[email protected]>
* Add `CustomizeDiff` logic to validate on `plan`
Signed-off-by: Timo Sand <[email protected]>
* Add first validation test
Signed-off-by: Timo Sand <[email protected]>
* Add validation error when `conditions` is missing
Signed-off-by: Timo Sand <[email protected]>
* Add further validation tests
Signed-off-by: Timo Sand <[email protected]>
* Remove unnecessary skip blocks as `individual` and `anonymous` access to org rulesets will never be a thing
Signed-off-by: Timo Sand <[email protected]>
* Switch `ref_name` to `Optional` as `push` doesn't need a `ref_name`
Signed-off-by: Timo Sand <[email protected]>
* Add Debug logging with `tflog` to validation
Signed-off-by: Timo Sand <[email protected]>
* Fix validation as `ref_name`, `repository_name` and `repository_id` are empty lists by default
Signed-off-by: Timo Sand <[email protected]>
* Remove unnecessary panic test
Signed-off-by: Timo Sand <[email protected]>
* Improve validation output messages
Signed-off-by: Timo Sand <[email protected]>
* Fix condition to require only one of `repository_name` or `repository_id`
Signed-off-by: Timo Sand <[email protected]>
* Add validation to `required_workflow.path`
Signed-off-by: Timo Sand <[email protected]>
* Rename test resources for easier debugging
Signed-off-by: Timo Sand <[email protected]>
* Fix linter issues
Signed-off-by: Timo Sand <[email protected]>
* Add validation to ensure `rules.required_status_checks.required_checks.context` is not empty
Signed-off-by: Timo Sand <[email protected]>
* Add test to ensure that `required_checks` is always required
Signed-off-by: Timo Sand <[email protected]>
* Fix tests after rebase
Signed-off-by: Timo Sand <[email protected]>
* Improve legibility of `conditions` description
Signed-off-by: Timo Sand <[email protected]>
* Update descriptions
Signed-off-by: Timo Sand <[email protected]>
* Add Acc test for push ruleset.
This turns out to be failing as there is a bug in our implementation! Unit tests and fix coming up
Signed-off-by: Timo Sand <[email protected]>
* Add failing test for `flattenConditions` with no `ref_name` condition
Signed-off-by: Timo Sand <[email protected]>
* Fix `flattenConditions` to work with `push` rulesets
Signed-off-by: Timo Sand <[email protected]>
* Add more tests for `flattenConditions`
Signed-off-by: Timo Sand <[email protected]>
* Enable debug logging in `flattenConditions`
Signed-off-by: Timo Sand <[email protected]>
* Ensures that `flattenConditions` returns an empty list on empty API response
Signed-off-by: Timo Sand <[email protected]>
* Add validation for `push` `rules`
As they differ from `branch` and `tag` rules
Signed-off-by: Timo Sand <[email protected]>
* Get `TestAccGithubRepositoryRulesets` to work
Signed-off-by: Timo Sand <[email protected]>
* `repository_ruleset`: Add tests for validations
Signed-off-by: Timo Sand <[email protected]>
* `repository_ruleset`: Implement validations for `target`, `conditions` and `rules`
Signed-off-by: Timo Sand <[email protected]>
* Updated ruleset docs
Signed-off-by: Timo Sand <[email protected]>
* Extract validation functions to separate utils file with unit tests
Signed-off-by: Timo Sand <[email protected]>
* Fix push ruleset test config
Signed-off-by: Timo Sand <[email protected]>
* Remove `repository` target after thorough testing that it doesn't do anything
Signed-off-by: Timo Sand <[email protected]>
* Use idiomatic test naming convention
Signed-off-by: Timo Sand <[email protected]>
* Address code structure comment in tests
Signed-off-by: Timo Sand <[email protected]>
* Fix inconsistent logging
Signed-off-by: Timo Sand <[email protected]>
* Refactor to use typed constant string for ruleset `Target`
Signed-off-by: Timo Sand <[email protected]>
* Fix indentation issue with `github_repository_file` and heredocs
Signed-off-by: Timo Sand <[email protected]>
* Rename files to be more sensible
Signed-off-by: Timo Sand <[email protected]>
* Refactor validation functions so that Repo and Org share almost everything
Signed-off-by: Timo Sand <[email protected]>
* Address review comments
Signed-off-by: Timo Sand <[email protected]>
* Use `github.RepositoryRuleType` instead of strings
Signed-off-by: Timo Sand <[email protected]>
* Refactor `flattenRules` and `expandRules` to use context
Signed-off-by: Timo Sand <[email protected]>
* Fix failing validation
Signed-off-by: Timo Sand <[email protected]>
* Refactor to use `ValidateDiagFunc` and `validation.ToDiagFunc` in repo ruleset
Signed-off-by: Timo Sand <[email protected]>
* Use `strings.Join` to make `Description` of `target` dynamic
Signed-off-by: Timo Sand <[email protected]>
* Add validation to `operator` attributes
Signed-off-by: Timo Sand <[email protected]>
* Add missing validations to repo ruleset attributes
Signed-off-by: Timo Sand <[email protected]>
* Refactor to use `ValidateDiagFunc` and `validation.ToDiagFunc` in org ruleset
* Use `strings.Join` to make `Description` of `target` dynamic
* Add validation to `operator` attributes
* Add missing validations to org ruleset attributes
* Ensure attribute names map correctly to rule names
Signed-off-by: Timo Sand <[email protected]>
* Don't ignore errors
Signed-off-by: Timo Sand <[email protected]>
* Address review comments
Signed-off-by: Timo Sand <[email protected]>
---------
Signed-off-by: Timo Sand <[email protected]>
1 parent 272856f commit 11d233c
10 files changed
Lines changed: 1466 additions & 288 deletions
File tree
- github
- website/docs/r
Large diffs are not rendered by default.
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
2 | 2 | | |
3 | 3 | | |
4 | 4 | | |
| 5 | + | |
5 | 6 | | |
6 | 7 | | |
7 | 8 | | |
| |||
18 | 19 | | |
19 | 20 | | |
20 | 21 | | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
21 | 35 | | |
22 | 36 | | |
23 | 37 | | |
| |||
28 | 42 | | |
29 | 43 | | |
30 | 44 | | |
31 | | - | |
32 | | - | |
33 | | - | |
34 | | - | |
35 | | - | |
36 | | - | |
37 | | - | |
38 | | - | |
39 | | - | |
40 | | - | |
41 | | - | |
| 45 | + | |
42 | 46 | | |
43 | 47 | | |
44 | 48 | | |
| |||
210 | 214 | | |
211 | 215 | | |
212 | 216 | | |
213 | | - | |
214 | | - | |
215 | | - | |
216 | | - | |
217 | | - | |
218 | 217 | | |
219 | 218 | | |
220 | 219 | | |
| |||
499 | 498 | | |
500 | 499 | | |
501 | 500 | | |
| 501 | + | |
| 502 | + | |
| 503 | + | |
| 504 | + | |
| 505 | + | |
| 506 | + | |
| 507 | + | |
| 508 | + | |
| 509 | + | |
| 510 | + | |
| 511 | + | |
| 512 | + | |
| 513 | + | |
| 514 | + | |
| 515 | + | |
| 516 | + | |
| 517 | + | |
| 518 | + | |
| 519 | + | |
| 520 | + | |
| 521 | + | |
| 522 | + | |
| 523 | + | |
| 524 | + | |
| 525 | + | |
| 526 | + | |
| 527 | + | |
| 528 | + | |
| 529 | + | |
| 530 | + | |
| 531 | + | |
| 532 | + | |
| 533 | + | |
| 534 | + | |
| 535 | + | |
| 536 | + | |
| 537 | + | |
| 538 | + | |
| 539 | + | |
| 540 | + | |
| 541 | + | |
| 542 | + | |
| 543 | + | |
| 544 | + | |
| 545 | + | |
| 546 | + | |
| 547 | + | |
| 548 | + | |
| 549 | + | |
| 550 | + | |
| 551 | + | |
| 552 | + | |
| 553 | + | |
| 554 | + | |
| 555 | + | |
| 556 | + | |
| 557 | + | |
| 558 | + | |
| 559 | + | |
| 560 | + | |
| 561 | + | |
| 562 | + | |
| 563 | + | |
| 564 | + | |
| 565 | + | |
| 566 | + | |
| 567 | + | |
| 568 | + | |
| 569 | + | |
| 570 | + | |
| 571 | + | |
| 572 | + | |
| 573 | + | |
| 574 | + | |
| 575 | + | |
| 576 | + | |
| 577 | + | |
| 578 | + | |
| 579 | + | |
| 580 | + | |
| 581 | + | |
| 582 | + | |
| 583 | + | |
| 584 | + | |
| 585 | + | |
| 586 | + | |
| 587 | + | |
| 588 | + | |
| 589 | + | |
| 590 | + | |
| 591 | + | |
| 592 | + | |
| 593 | + | |
| 594 | + | |
| 595 | + | |
| 596 | + | |
| 597 | + | |
| 598 | + | |
| 599 | + | |
| 600 | + | |
| 601 | + | |
| 602 | + | |
| 603 | + | |
| 604 | + | |
| 605 | + | |
| 606 | + | |
| 607 | + | |
| 608 | + | |
| 609 | + | |
| 610 | + | |
| 611 | + | |
| 612 | + | |
| 613 | + | |
| 614 | + | |
| 615 | + | |
| 616 | + | |
| 617 | + | |
| 618 | + | |
| 619 | + | |
| 620 | + | |
| 621 | + | |
| 622 | + | |
| 623 | + | |
| 624 | + | |
| 625 | + | |
| 626 | + | |
| 627 | + | |
| 628 | + | |
| 629 | + | |
| 630 | + | |
| 631 | + | |
| 632 | + | |
| 633 | + | |
| 634 | + | |
| 635 | + | |
| 636 | + | |
| 637 | + | |
| 638 | + | |
| 639 | + | |
| 640 | + | |
| 641 | + | |
| 642 | + | |
| 643 | + | |
| 644 | + | |
| 645 | + | |
| 646 | + | |
| 647 | + | |
| 648 | + | |
| 649 | + | |
| 650 | + | |
| 651 | + | |
| 652 | + | |
| 653 | + | |
| 654 | + | |
| 655 | + | |
| 656 | + | |
| 657 | + | |
| 658 | + | |
| 659 | + | |
| 660 | + | |
| 661 | + | |
| 662 | + | |
| 663 | + | |
| 664 | + | |
| 665 | + | |
| 666 | + | |
| 667 | + | |
| 668 | + | |
| 669 | + | |
| 670 | + | |
| 671 | + | |
| 672 | + | |
| 673 | + | |
| 674 | + | |
| 675 | + | |
| 676 | + | |
| 677 | + | |
| 678 | + | |
| 679 | + | |
| 680 | + | |
| 681 | + | |
| 682 | + | |
| 683 | + | |
| 684 | + | |
| 685 | + | |
| 686 | + | |
| 687 | + | |
| 688 | + | |
| 689 | + | |
| 690 | + | |
| 691 | + | |
| 692 | + | |
| 693 | + | |
| 694 | + | |
| 695 | + | |
| 696 | + | |
| 697 | + | |
| 698 | + | |
| 699 | + | |
| 700 | + | |
| 701 | + | |
| 702 | + | |
| 703 | + | |
| 704 | + | |
| 705 | + | |
| 706 | + | |
| 707 | + | |
| 708 | + | |
| 709 | + | |
| 710 | + | |
| 711 | + | |
| 712 | + | |
| 713 | + | |
| 714 | + | |
| 715 | + | |
| 716 | + | |
| 717 | + | |
| 718 | + | |
| 719 | + | |
| 720 | + | |
| 721 | + | |
| 722 | + | |
| 723 | + | |
| 724 | + | |
| 725 | + | |
| 726 | + | |
| 727 | + | |
| 728 | + | |
| 729 | + | |
| 730 | + | |
| 731 | + | |
| 732 | + | |
| 733 | + | |
| 734 | + | |
| 735 | + | |
| 736 | + | |
| 737 | + | |
| 738 | + | |
| 739 | + | |
| 740 | + | |
| 741 | + | |
| 742 | + | |
| 743 | + | |
| 744 | + | |
| 745 | + | |
| 746 | + | |
| 747 | + | |
| 748 | + | |
| 749 | + | |
| 750 | + | |
| 751 | + | |
| 752 | + | |
| 753 | + | |
| 754 | + | |
| 755 | + | |
| 756 | + | |
| 757 | + | |
| 758 | + | |
| 759 | + | |
| 760 | + | |
| 761 | + | |
| 762 | + | |
| 763 | + | |
| 764 | + | |
| 765 | + | |
| 766 | + | |
| 767 | + | |
| 768 | + | |
| 769 | + | |
| 770 | + | |
| 771 | + | |
| 772 | + | |
| 773 | + | |
| 774 | + | |
| 775 | + | |
| 776 | + | |
| 777 | + | |
| 778 | + | |
| 779 | + | |
| 780 | + | |
| 781 | + | |
| 782 | + | |
| 783 | + | |
| 784 | + | |
| 785 | + | |
| 786 | + | |
| 787 | + | |
| 788 | + | |
| 789 | + | |
| 790 | + | |
| 791 | + | |
| 792 | + | |
| 793 | + | |
| 794 | + | |
| 795 | + | |
| 796 | + | |
| 797 | + | |
| 798 | + | |
| 799 | + | |
| 800 | + | |
| 801 | + | |
| 802 | + | |
| 803 | + | |
| 804 | + | |
| 805 | + | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
502 | 812 | | |
503 | 813 | | |
504 | 814 | | |
| |||
578 | 888 | | |
579 | 889 | | |
580 | 890 | | |
581 | | - | |
| 891 | + | |
582 | 892 | | |
583 | 893 | | |
584 | 894 | | |
| |||
0 commit comments