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.
    7250f303-da03-4f3f-b24a-20464aa3b596-image.png


  • inedo-engineer

    Hi @PhilipWhite ,

    Can you clarify what you mean by empty?

    Like, if you were to do Log-Information Hello $ApplicationName!;, it would just log Hello!? 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 called ApplicationName, 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".

    83ed6f90-0b5e-4e71-9682-7a55c7b2edf4-image.png
    75e2e796-47f6-4891-9b9b-050b872f5c78-image.png
    c5a8b0f7-58db-4ca5-9b57-a22929083333-image.png
    4626bed8-667d-4946-83c0-a79da7d573bb-image.png


  • inedo-engineer

    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:

    f2980f10-64c0-41a7-a082-7115d0d3b1ba-image.png

    Thanks!


Log in to reply
 

Inedo Website HomeSupport HomeCode of ConductForums GuideDocumentation