Welcome to the Inedo Forums! Check out the Forums Guide for help getting started.
If you are experiencing any issues with the forum software, please visit the Contact Form on our website and let us know!
[BM] $ApplicationName is empty
-
For some reason the $ApplicationName variable is empty in one of my applications. It's working in the others. The plan is fully working, I can create releases and run the pipelines, etc, but the variable is empty when I use it in scripts.
Maybe also related, on the landing page, it says there are no executions for the app, even though under Releases I have multiple releases that have gone through various stages.
-
Hi @PhilipWhite ,
Can you clarify what you mean by empty?
Like, if you were to do
Log-Information Hello $ApplicationName!;
, it would just logHello!
? Or are you seeing it somewhere else?There is an
$ApplicationName
"variable function" that will return the name of the current application in context. There is almost always an application in context, unless you're doing something like a system-level scheduled job or something.However, variable functions have a low precedence, so if you were to do something like
set $ApplicationName = whatever;
, it would create a runtime variable calledApplicationName
, and then$ApplicationName
would resolve to that.You can explicitly invoke a function by doing
$ApplicationName()
. So,Log-Information Hello $ApplicationName()!;
should always work.As for nothing showing up on that application page.. that's weird --- but something to dig through separately for sure.
Cheers,
Alana
-
Hi @atripp,
Sorry, I got kind of muddled there; it's actually $EnvironmentName that is empty.
I'm running a script as part of promoting a build to a Test environment. I expect the $EnvironmentName would contain "Test".
-
Hi @PhilipWhite ,
Thanks for clarifying!
Long story short, you probably want to just use
$PipelineStageName
. In your case, it would be which would be "Test" (based on the screenshot that says Test Stage).Overall, it's a little confusing but Pipeline Stages and Environments are orthogonal concepts:
- Environments are used to group servers and scope permissions
- Stages define a phase in the deployment/release process (i.e. a pipeline)
A Deployment Target (e.g. "Deploy to XXXXX") is part of a stage, and may be associated with an Environment. Just click "edit", then check "Environment-specific permissions", then select an environment.
That would put an environment in context (and thus
$EnvironmentName
would return what you expect), but more practically it would:- throw an error if any of the servers used in the execution are not a part of that environment
- not allow someone to press the "deploy" or "force" button to that stage , unless they have permissions specific to that environment
It's a little confusing at first, which is why we "kind of" hide environments from the user.
This is most definitely a common point of confusion, so we are really open to feedback if you can think of how to improve documentation/user experience!!
Alana
-
Hi @atripp,
So I associated the deployment targets with environments and that fixed both of my issues: $EnvironmentName is populated and now the environments are showing on that application screen:Thanks!