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

Should tanka deploy test charts by default? #550

Open
gassiss opened this issue Mar 25, 2021 · 10 comments
Open

Should tanka deploy test charts by default? #550

gassiss opened this issue Mar 25, 2021 · 10 comments
Labels

Comments

@gassiss
Copy link

gassiss commented Mar 25, 2021

Hi team!

It seems like when I run tk apply it automatically deploys test charts as well. Is that intended behaviour? I feel like it should only run tests if we explicitly tell it to.

I put together a small repo reproducing this: https://github.com/gassiss/tanka-issue-example

@Duologic
Copy link
Member

How does Helm handle this? Tanka simply renders the chart with helm template, this output can be modified in jsonnet.

@stale
Copy link

stale bot commented Jun 2, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 2, 2021
@stale stale bot closed this as completed Jun 9, 2021
@lkiii
Copy link

lkiii commented Jan 10, 2025

local excludeChartTests(resources) =
  {
    [item.key]: item.value
    for item in std.objectKeysValues(resources)
    if !(std.type(item.value) == 'object' &&
       std.objectHas(item.value, 'metadata') &&
       std.objectHas(item.value.metadata, 'annotations') &&
       std.objectHas(item.value.metadata.annotations, 'helm.sh/hook') &&
       item.value.metadata.annotations['helm.sh/hook'] == 'test')
  };

I was having the same issue and this looks like something universal which could help in this case

@zerok zerok reopened this Jan 13, 2025
@zerok
Copy link
Contributor

zerok commented Jan 13, 2025

helm template also has a --skip-tests flag. Perhaps it's just enough that we use that flag when running helm template ?

@lkiii
Copy link

lkiii commented Jan 13, 2025

Yeah that would make most senses, this could be additional optional flag passed for helm.template() so this would still be backwards compatible

https://github.com/grafana/tanka/blob/main/pkg/helm/helm.go#L25 maybe there is a way to pass it via opts already?

Edit: I believe it is https://github.com/grafana/tanka/blob/main/pkg/helm/template.go#L98

@zerok
Copy link
Contributor

zerok commented Jan 13, 2025

Jupp, just stumbled upon it at the same time :D Perhaps I can come up with a simple sample tomorrow (if it works) :)

@zerok
Copy link
Contributor

zerok commented Jan 14, 2025

Using the skipTests property when calling helm.template in your wrapper code should work (at least it passes the right arguments):

helm.template('nginx', './charts/nginx-ingress', {
  skipTests: true,
  // values: { ... }
}),

@lkiii
Copy link

lkiii commented Jan 14, 2025

Yep it works well with the flag on my end as well. https://stackoverflow.com/a/79346465/816230 I have posted the example here

@strowi
Copy link
Contributor

strowi commented Jan 29, 2025

Can confirm, @zerok 's skiptests: true works (not case-sensitive).
Had to search through github issues to the MR, this probably could be better documented on tanka.dev ;)

zerok added a commit that referenced this issue Jan 30, 2025
This behaviour was previously undocumented. See
#550 for more context.
@zerok
Copy link
Contributor

zerok commented Jan 30, 2025

@strowi #1329 first try 🤣

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

No branches or pull requests

5 participants