Modify environement variables within build script

Issue #12779 duplicate
Alexandre Pabouctsidis created an issue

In order to deploy binaries with a version numbering scheme, we need to be able to modify a Pipelines environment variable from within a build script.

Comments (11)

  1. Joshua Tjhin Account Deactivated

    Hi Alex,

    It should be possible to set the system variable within the build script by export just like you would in bash e.g.

    pipelines:
      branches:
        master:
          - step:
              script:
                - export HERO=Superman
                - echo $HERO
    

    Does that work for you? Or were you looking for something different?

  2. Alexandre Pabouctsidis reporter
    • changed status to open

    I was actually referring to the pipelines environment variables as seen in the Settings->Pipelines->Environment variables page.

    What I'm trying to achieve is an auto increment of the version number after each deployment.

    After each merge/commit on our develop branch, we export our binaries to a server via SCP into a new folder, named DEV-0, DEV-1, and so fourth.

    I was hoping to store the counter in the pipelines variables, and then manage the increment in the .ylm file.

  3. Joshua Tjhin Account Deactivated

    Hey Alex, could you tell me if my suggestion above would solve your problem? If not, please describe why not. Thanks!

  4. Alexandre Pabouctsidis reporter

    I was actually in the process of migrating our CI from bamboo to pipelines, but this is actually a blocker for us.

    I'm trying to find some sort of work around in the mean time. Do you have any ideas?

  5. Joshua Tjhin Account Deactivated

    Hey Alex, I've just sent you a possible workaround to your Bitbucket inbox.

  6. Kevin Miller

    I'm looking to do this too within my Bitbucket Pipelines yml. Can you send me the 'work around' as well?

  7. Ruben van Eijnatten

    I'm also looking for a way to maintain a numerical build number, can you share the workaround?

  8. Log in to comment