Skip to content

Conversation

preminger
Copy link
Contributor

Description of the Pull Request (PR):

Provides support for --build-arg and --build-arg-file to pass variables to build process, allowing definition file to use values using {{ argname }} strings. Also supports an %arguments section in definition file to provide default values for the arguments used by the definition file, which can then be overridden via the aforementioned command-line options.

This is a pick of apptainer/apptainer#1356

@preminger preminger force-pushed the templating-support-for-definition-file branch 2 times, most recently from 75de3bd to ea9061f Compare June 5, 2023 21:57
Copy link
Member

@dtrudg dtrudg left a comment

Choose a reason for hiding this comment

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

I like the approach to the replacement here, vs what's in the initial cherry pick 👍.

Generally, the more I look at this, the more I think there need to be some researched and carefully considered design decisions made... which may or may not mesh with the Apptainer implementation. From an initial reading:

  • What should be the restrictions on build arg names?
  • Should there be a way to escape the {{ ... }} pattern in a def file? Some programs will take arguments in that format. It's not uncommon for Go programs to take Go template snippets to format output.

We also need to carefully consider what happens with remote builds. Is this parsing on the client side (okay)... or will the def currently be sent up to the remote builder before the replacements occur?

@preminger preminger force-pushed the templating-support-for-definition-file branch 2 times, most recently from d25f03f to 336b719 Compare June 13, 2023 20:20
Copy link
Member

@dtrudg dtrudg left a comment

Choose a reason for hiding this comment

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

Lookst prety good to me at this point. Definitely prefer the code as re-written.

I think It'd be good for a docs PR to be written up in parallel with this WIP PR, so that they can be merged together. The reason for this is that it'll focus some attention on what key/val pairs are allowed, and how things like quoting etc. differ between CLI and file. I'm not convinced there aren't some rough edges there that we might want to address, yet.

@preminger preminger force-pushed the templating-support-for-definition-file branch 4 times, most recently from b6d01d7 to af2bf8f Compare June 14, 2023 15:09
@preminger preminger requested a review from dtrudg June 14, 2023 15:10
@preminger preminger force-pushed the templating-support-for-definition-file branch 2 times, most recently from 540adf2 to 17fc2d5 Compare June 14, 2023 15:12
@preminger preminger force-pushed the templating-support-for-definition-file branch from 17fc2d5 to 09a9ae9 Compare June 26, 2023 14:06
@preminger preminger marked this pull request as ready for review June 26, 2023 14:19
@preminger preminger changed the title WIP: templating support for definition file templating support for definition file Jun 26, 2023
Copy link
Member

@dtrudg dtrudg left a comment

Choose a reason for hiding this comment

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

LGTM ... This is a ✅ just held in order to raise it with @EmmEff tomorrow, just to 100% confirm we are all good with the exact change in types.Definition

@preminger preminger force-pushed the templating-support-for-definition-file branch 4 times, most recently from 4280dcc to ef5f9af Compare June 28, 2023 15:16
@preminger preminger force-pushed the templating-support-for-definition-file branch from ef5f9af to 6d87087 Compare June 28, 2023 15:17
@preminger preminger requested a review from dtrudg June 28, 2023 15:28
@dtrudg
Copy link
Member

dtrudg commented Jun 28, 2023

Just thought.... this only works for local builds, at present, right? If that's the case we should have a warning/error if used with --remote. We don't need remote support to merge at this time.

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