Using env variable in artifact src

Follow

Comments

6 comments

  • Avatar
    Ian Bridson

    Hi Jebastine


    I think the ${...} syntax is for Parameters, Environment variables have a %variable% syntax, so it might be worth trying %UTC_PRJ_PATH%.


    Ian

  • Avatar
    Jebastine Vetharaj

    I tried it, it is not working. I would like to scripts in way that the artifacts location is dynamic. Any Idea?

  • Avatar
    Mark Chang

    Hi Jebastine,


    Instead of using a Go Environment Variable, use a Go Parameter.  Give that a go and let us know if that doesn't work.


    Thanks. 


    --Mark

  • Avatar
    Unknown_User

    So then how do you make the parameter dynamic?  If I use the GO_PIPELINE_NAME and GO_PIPELINE_COUNTER to generate the name for an artifact in stage1.  It would look something like <GO_PIPELINE_NAME>-<GO_PIPELINE_COUNTER>.war.  And then in stage2 I want to do a fetch artifact to grab this particular artifact.  However, I can not determine how I could use a parameter to do this.  I can't access the environment variable in <fetchartifact>.  So how would I tell <fetchartifact> the dynamically generated name of this artifact?  Is this even currently possible?


    Thanks,


    -russ

  • Avatar
    Shilpa Goley

    Hi Russell,


    Answer to your first few queries:


    Parameters are not really meant to be dynamic. They are a part of your configuration and can be used to customize/simplify the pipeline configuration.


    GO_PIPELINE_NAME and GO_PIPELINE_COUNTER are environment variables and cannot be used as parameters.


       " So how would I tell <fetchartifact> the dynamically generated name of this artifact?  Is this even currently possible?"


    No, this is not currently possible. 


    Just as a suggestion, when you define a fetchArtifact task to fetch artifact from PipelineA-StageA-JobA, then it will always pick it up from the the latest run of PipelineA-StageA-JobA. So you could fetch the whole folder which cotains your artifact too.

  • Avatar
    Jason Duff

    Just checking back on this thread.  Has the ability to dynamically name an artifact name been implemented - using either env variables or parameters?  Doesn't seem to work but I may be missing something.

    Thanks.

Please sign in to leave a comment.