Skip to content

How to make env vars available to JVMs? #189

Open
@autonomousapps

Description

@autonomousapps

I am working on a new step that would let people execute arbitrary Groovy scripts (https://github.com/hiyainc/bitrise-step-groovy-script-runner). During testing in my own pipeline, though, I am unable to access environment variables I expect to be present. I use the standard JVM approach of calling System.getenv('BITRISE_BUILD_NUMBER') (for example). When I test that in a bash script (with $BITRISE_BUILD_NUMBER), I get the expected value. When I test it in my Groovy script, it's always a blank string (not even null). I have tested this same Groovy script locally, and System.getenv(...) works as expected.

How does envman -- and indeed, Bitrise -- expose environment variables to steps?

To provide further examples, I have a step that has this output:

Screen Shot 2020-07-17 at 10 48 24 AM

and I cannot access that env var in my groovy step which runs immediately afterwards. Just for the hell of it, I inserted a bash step between the two that does this:

#!/usr/bin/env bash
set -ex
echo -n $BITRISE_APK_PATH | envman add --key PROD_RELEASE_APK_PATH

and I also could not access PROD_RELEASE_APK_PATH. This works when consumed from a bash script.

Thanks for your time.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions