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

fix: correctly substitute testing instructions in issue template #42

Merged
merged 1 commit into from
May 30, 2024

Conversation

jnsgruk
Copy link
Member

@jnsgruk jnsgruk commented May 30, 2024

Environment variable substitution in the call for testing stopped working since we factored out the testing instructions. This fix ensures that the template gets the various sections substituted out before rendering, to ensure that all the relevant fields get templated correctly.

See example output here: jnsgruk/ci-testing#51

Copy link
Member

@NucciTheBoss NucciTheBoss left a comment

Choose a reason for hiding this comment

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

LGTM! Ben would be proud of us for using awk to render the template 😄

I think this is a good stop-gap for now to ensure that the call for testing issue template renders correctly, but I think we're starting to see the need for a utility that simplifies these operations. Better to have a swiss-army knife than shell script soup imho 😅

@jnsgruk jnsgruk merged commit a8f0293 into snapcrafters:main May 30, 2024
1 check passed
@techtonik
Copy link

Why inject template-testing into template.md? Maybe allow to replace default template.md with own path to template.

@NucciTheBoss
Copy link
Member

Why inject template-testing into template.md? Maybe allow to replace default template.md with own path to template.

I think the idea is that you'll eventually be able to set a custom call for testing template. This current implementation is more a less a stop-gap for a rendering issue that I encounter in the ondemand snap: charmed-hpc/ondemand-snap#3

Ideally, if/when we switch over to a CI tool, it will be much easier for folks to just set a template. For example, if we write something in Go, we can use the text/template package. That will make it really easy for folks to set their own template.

@jnsgruk
Copy link
Member Author

jnsgruk commented May 30, 2024

Well, kind of. I want to steer away from a system where every single snap has a totally different template. Consistency here is a good thing, but we do need a way to customise testing instructions specifically - a lot of the other stuff won't change between snaps :)

@techtonik
Copy link

Does Go text/template allow block overriding? Like in Jinja https://jinja.palletsprojects.com/en/3.0.x/templates/#template-inheritance

@NucciTheBoss
Copy link
Member

Yep! Go's text/template supports inheritance! https://towardsdev.com/go-text-templates-advanced-concepts-for-dynamic-content-d9e4067e91b7

@techtonik
Copy link

Yep! Go's text/template supports inheritance! https://towardsdev.com/go-text-templates-advanced-concepts-for-dynamic-content-d9e4067e91b7

Am I right that this is for HTML only?

Is there a way to specify default values for define? Looks like child template can not inherit parent, so there is a separate Go code that calculates the values for base template.

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