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

feat: support NOT operation when using trigger #987

Open
Stono opened this issue Nov 29, 2024 · 1 comment
Open

feat: support NOT operation when using trigger #987

Stono opened this issue Nov 29, 2024 · 1 comment
Labels
enhancement New feature or request

Comments

@Stono
Copy link

Stono commented Nov 29, 2024

What problem does this feature solve?

I would like to be able to say npx checkly trigger --tags=my-app --not-tags=under-development, in this example, this would select all tests with the tag of my-app, but exclude tests which are flagged as under-development.

This is partly a product of the way we deploy checkly at Auto Trader, but the app tag is always present for a given app, so I need a method of excluding under-development tests.

Context; we "trigger" and apps tests after the app, or tests for that app, get deployed to create a CICD flow.

How would you implement this feature?

As above

@Stono Stono added the enhancement New feature or request label Nov 29, 2024
@sorccu
Copy link
Collaborator

sorccu commented Nov 29, 2024

Hi @Stono,

Thanks for the suggestion! I took a look at the backend, and it seems that some changes would be needed there as well.

It might be better to integrate the proposed functionality of --not-tags with the existing --tags flag. Since multiple --tags flags are combined with OR, it may get a little confusing. For example:

npx checkly trigger --tags=one,two --tags=three,four --tags=five

The above currently translates to:

(one AND two) OR (three AND four) OR (five)

Now if you were to change one of the --tags to --not-tags, like this:

npx checkly trigger --tags=one,two --not-tags=three,four --tags=five

Now it's not quite clear if the behavior is:

(one AND two) OR (NOT three AND NOT four) OR (five)

Or:

((one AND two) OR (five)) AND (NOT three AND NOT four)

In either case, it will not be possible to achieve BOTH behaviors at the same time, because the operator is implied. So, you could only have tags AND NOT not-tags, or tags OR NOT not-tags depending on which option you chose at implementation time, but you would be unable to support both.

Therefore it might make more sense to simply use !tag with --tags to exclude a tag. Then you could do:

npx checkly trigger --tags=one,two --tags=three,!four,!five --tags=!six

To achieve a query like:

(one AND two) OR (three AND NOT four AND NOT five) OR (NOT six)

Effectively giving you access to both OR and AND.

However this implementation is only possible if no customer is currently using an actual tag with a ! prefix. I will ask someone to check later. Side note: obviously the CLI currently does not work with tag values that contain a comma, so I suppose we don't have perfect matching capability even now.

Would you be OK with this alternate solution, and/or do you have any other comments? Also, how soon do you need this feature?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants