Envman store is empty when inspected

I have a need to pass the contents of the set environment variables to another build. The idea I have is to get the environments that were added via envman and cascade them as env variables to the new build. However I can’t seem to find the correct file. The envman project page says its in the .envstore in the current directory where it is invoked but there is no such file. Based in the output of envman --help it is supposed to be in the file pointed by ENVMAN_ENVSTORE_PATH but that file is also an empty yaml file.

The stored values via envman in a prior step is loaded properly in the Script step where I was trying to print out the content. Here is the output of the execution:

±-----------------------------------------------------------------------------+

| (0) Load Environment from workspace file |
±-----------------------------------------------------------------------------+
| id: script |
| version: 1.1.6 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: bash |
| time: 2020-10-09T06:03:34Z |
±-----------------------------------------------------------------------------+
| |
[INFO] Loading from the workspace bitrise-build.properties file.
[INFO] Ignoring default value. “CI_BUILD_TYPE=prod” is already set in the environment.
[INFO] PULL_PHRASEAPP_STRINGS is not set. Adding “PULL_PHRASEAPP_STRINGS=true” to environment.
[INFO] ENABLE_DYNATRACE is not set. Adding “ENABLE_DYNATRACE=true” to environment.
[INFO] RUN_JACOCO_TASKS is not set. Adding “RUN_JACOCO_TASKS=true” to environment.
| |
±–±--------------------------------------------------------------±---------+
| âś“ | Load Environment from workspace file | 1.40 sec |
±–±--------------------------------------------------------------±---------+

And here is the later script step that checks the contents

        #!/usr/bin/env bash
        echo PhraseApp value is [$PULL_PHRASEAPP_STRINGS]
        echo Jacoco Switch is [$RUN_JACOCO_TASKS]
        
        echo Envman print
        
        envman print

        echo Checking env store path

        ls -l ${ENVMAN_ENVSTORE_PATH}

        echo printing contents of the ENVMAN_ENVSTORE_PATH

        cat ${ENVMAN_ENVSTORE_PATH}

Which resulted to this output

±-----------------------------------------------------------------------------+

| (0) Testing |
±-----------------------------------------------------------------------------+
| id: script |
| version: 1.1.6 |
| collection: https://github.com/bitrise-io/bitrise-steplib.git |
| toolkit: bash |
| time: 2020-10-09T06:03:36Z |
±-----------------------------------------------------------------------------+
| |
PhraseApp value is [true]
Jacoco Switch is [true]
Envman print

Checking env store path
-rw-r–r-- 1 root root 9 Oct 9 06:03 /tmp/bitrise564068214/output_envstore.yml

printing contents of the ENVMAN_ENVSTORE_PATH
envs: []
| |
±–±--------------------------------------------------------------±---------+
| âś“ | Testing | 1.26 sec |
±–±--------------------------------------------------------------±---------+

Am I missing something?

How do you set variables like CI_BUILD_TYPE?

Its the standard

envman add --key “key-name” --value “${value}”

command. The environment variables are only persisted in that step and recognized by subsequent steps and workflows so I am assuming that the envman command works.

Thanks.

That’s correct.

The CLI reads variables when a step starts, so you won’t be able to inspect a variable in the same script you’ve created it.

But shouldnt the variables added via envman be persisted somewhere so that later steps can reference it as part of their environment? In my post I am checking the envman persistence file on a later step.

The usecase we have is to persist custom variables to workflow being triggered as an auxilliary build.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.