Skip to content

Conversation

@dkovba
Copy link
Contributor

@dkovba dkovba commented Aug 16, 2025

This PR adds the support for the ARG instruction in the native builder parser, implements the support for different kinds of ARGs, and performs the substitution of ARG variables in the supported instructions. Resolves #437.

Some features are currently blocked and not included into this PR:

Copy link
Contributor

@wlan0 wlan0 left a comment

Choose a reason for hiding this comment

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

Only fix needed is to fix NSRange vs. String counting.

LGTM otherwise!

Also, the current impl doesn't support the following instructions right?

  • ARG var= i.e. no value
  • RUN $var i.e. without enclosing ${}
  • ARG var2=${var1:-default}

Could we add an issue for these (if true)

#expect(Bool(false), "Expected registry image source")
}

if let run = stage.nodes[1].operation as? ExecOperation {
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we add guards for accessing the nodes in the stage?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Crashing immediately with an index out of bounds error in a test provides a clear, specific failure message that pinpoints exactly what assumption was violated, whereas a guard might obscure the root cause. This will also make it easier to add new tests for added instructions in the future.

@dkovba dkovba marked this pull request as ready for review August 19, 2025 07:23
@dkovba dkovba changed the title Add the ARG parser Add the support for ARG in the native builder parser Aug 19, 2025
@dkovba dkovba requested a review from wlan0 August 20, 2025 21:56
@dkovba dkovba merged commit 9a597eb into apple:main Aug 20, 2025
2 checks passed
@dkovba dkovba deleted the dkovba/arg-parser branch August 20, 2025 21:57
dkovba added a commit that referenced this pull request Aug 21, 2025
Fixes a warning missed in #516.
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.

Native builder parser support ARG instruction

3 participants