Passing configuration parameters to shell build script

Hi,

I've created a configuration parameter called app.name with a default value of MyApp in the Build Parameters section.

Then in my Build Step I used %app.name% in the Command Parameters textbox.

My question is, how do I get a reference to that app.name parameter from within my shell build script?

I've been trying also sort of combinations with no success...

EDIT: Using Team City 7 Professional

Thanks

7 comments
Comment actions Permalink

For that you need to declare it as environment variable
Capture.PNG

0
Comment actions Permalink

Hi Michael,

Thanks for your reply.

But how would I then reference those env variables in my build script?

Thanks

0
Comment actions Permalink

By this name, but without env. prefix

0
Comment actions Permalink

Thanks.

I've tried testing things out with the following but with no success:

echo %env.build.number%

echo build.number
echo %custom.paramater%



Guess I'm missing something here?
0
Comment actions Permalink

Hello,

   I'd suggest 2 things:

   - use environment variable name without dots in TC settings: env.MY_APP_NAME = value
   - Reference environment variable in Windows shell script as %MY_APP_NAME%

  Hope this helps,
  KIR

0
Comment actions Permalink

Hi,

Thanks for getting back to me.

I did as you suggested but is still unable to reference my env variables from a shell script.

I use: %build.number% (system parameter) and %APP_NAME% (enviroment parameter).

Is it any different for windows shell scripts vs unix shell scripts? Because I'm trying to get this to work using on a Mac OS X enviroment.

Thanks

0
Comment actions Permalink

Ryno, yes, the syntax for expanding environment variables differs between Windows and Unix. In Unix you should use `$APP_NAME` instead of `%APP_NAME%`.

0

Please sign in to leave a comment.