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

Add project ruler #52

Merged
merged 2 commits into from
Jan 24, 2024
Merged

Add project ruler #52

merged 2 commits into from
Jan 24, 2024

Conversation

B3rs
Copy link
Contributor

@B3rs B3rs commented Jan 24, 2024

Add project ruler in order to be able to have matches based on project name or project labels.
This can be useful to select (or filter) groups from providers based on project name or project labels.
an example of this can be:

  # will evaluate to true if project name is matching one of the names in the list
  - name: allowed-projects
    project:
      - names: 
          - awesome-project1
          - awesome-project2
        match: true

  # will evaluate to true if project name is matching none of the names in the list
  - name: excluded-projects
    project:
      - names: 
          - bad-project1
          - bad-project2
        match: false

  # will evaluate to true if project labels are a superset of the listed labels
  - name: matching-all-labels
    project:
      - labels: 
          team: backend
          language: golang
        match: true

  # will evaluate to true if all listed labels are not a subset of the project labels
  - name: excluding-all-labels
    project:
      - names: 
          team: backend
          language: golang
        match: false

the project rule is implemented as an array so it will be easy to compose different evaluations in the same rule with an AND logic:

  - name: allowed-projects
    project:
      - names: 
          - awesome-project1
          - awesome-project2
        match: true
      - names:
          - bad-project
        match: false

I also took the chance to add validate:"dive" in order to cascade validation checks also to slice elements

Signed-off-by: Marco Bersani <tachetefogo@gmail.com>
@B3rs B3rs requested a review from mcorbin January 24, 2024 08:57
Signed-off-by: Marco Bersani <tachetefogo@gmail.com>
@victorboissiere
Copy link
Member

#sre

@B3rs B3rs merged commit 9fc72df into main Jan 24, 2024
5 checks passed
@B3rs B3rs deleted the add_project_rule branch January 24, 2024 16:59
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