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

Target parameter is resolved from environment variable before command-line positional argument #300

Closed
RobSmyth opened this issue Aug 4, 2019 · 8 comments
Milestone

Comments

@RobSmyth
Copy link

RobSmyth commented Aug 4, 2019

Hi,

My Windows development environment has a system environment variable "Target". It seems that Nuke keeps picking this up in preference to the command line as I get an error that target "XX" (value of the environment variable) does not exist.

I'm running: nuke --target Compile

(I'm a newbie, so maybe I'm just getting the command line wrong?)

It does the same when I invoke via the PowerShell script build.ps1 without arguments.

@matkoch
Copy link
Member

matkoch commented Aug 4, 2019

Hi @RobSmyth,

NUKE picks up parameters (including ExecutingTargets) from the command-line / environment variables. You're only chance is to unset the environment variable inside the build.ps1/sh scripts.

@RobSmyth
Copy link
Author

RobSmyth commented Aug 7, 2019

Hi @matkoch

I appreciate the frank response. Thank you.

@RobSmyth
Copy link
Author

Hi @matkoch ,

Unfortunately, in order to use Nuke, I need to fork and compile a version of nuke with the environment variable "TARGET" renamed to something like "NUKE_TARGET". But looking at the source code I do not see where it is reading the environment variable "TARGET".

Can you help me find the code?

@matkoch
Copy link
Member

matkoch commented Aug 20, 2019

I assume you called nuke compile rather than nuke --target compile. The latter will work, the first is broken, unfortunately. In general, parameter resolution will first try to resolve from command-line arguments, and then from environment variables.

@matkoch matkoch reopened this Aug 20, 2019
@matkoch matkoch changed the title How to ignore Target environment variable Target parameter is resolved from environment variable before command-line positional argument Aug 20, 2019
@matkoch matkoch added this to the v0.22.0 milestone Aug 20, 2019
@matkoch matkoch closed this as completed Sep 5, 2019
@RobSmyth
Copy link
Author

Hi matkoch,

Sorry I have not given this the attention I should have. But coming back to this issue it looks like you have redefined my issue as being about command line argument having precedence over an environment variable and that has been fixed. Thank you.

The fix done is good but it is a work around and does not fix the issue I reported. We are building by a command "nuke" (without parameters). That fails and I assume it will still fail as Nuke and another application are both using an environment variable "TARGET".

I put that both apps have a bug in that neither should be using such a generic environment variable name.

So, while thank you for your providing a work around, I think the reported issue remains. What is the best way to deal with that? Rename this issue or I can create a new one?

@matkoch
Copy link
Member

matkoch commented Oct 30, 2019

Except from unsetting the environment variable or explicitly passing the targets, I guess you can't do anything. For the 1.0 release, we will introduce NUKE_ prefixes (see #242)

@RobSmyth
Copy link
Author

Yes the NUKE_ prefix is a solution to the bug. Given that you have that on a todo list I do not think an open issue is necessary.

Thanks.

@lock
Copy link

lock bot commented Nov 20, 2019

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@lock lock bot locked as resolved and limited conversation to collaborators Nov 20, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants