Using Environment Variables with period in the name - Not passed to build processes

All,

An odd behavior.  I need to set an environment variable with a period in the name (eframe.key).  The action YAML file is:

name: BuildAndTestAll

on: [push]

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v1
      - name: Set up JDK 1.8
        uses: actions/setup-java@v1
        with:
          java-version: 1.8
      - name: Build and Test
        env:
          # A key to use for testing, not used in production.
          eframe.key: someKey890123456789012345678901234567890
          eframeKey: othersomeKey890123456789012345678901234567890
        run: ./gradlew cleanAll testAll -DwriteTests=false

The variable eframeKey works fine and is in the environment.  The eframe.key is not.  I am using Micronaut and it seems to need the variable with a period in the name (not sure why yet).

I have  a short-term work around using a default value in the code, but I need to avoid that for security reasons.

Is period just a reserved character for the names?

The repository is: https://github.com/simplemes/simplemes-core

1 Like

Did you tried using underscore instead of period?

Hi simplemes,

As  shafi1996 suggested, when name an environment variable, please use '_ ’ instead of  '. ’ . 

Use eframe_key instead of e frame.key.

There is the document for Using environment variables: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables 

Thanks for the feedback.   I did try using underscore, but I found a problem with Gradle not passing the env variable to the forked test process.  It only seems to pass variables with a period in them :(.

I found a work-around with Micronaut using the application-test.yml configuration file.  That file provides a value without the need for an environment variable.  I will mark this as the answered, just to help other micronaut users.

BTW, the link to the doc did not work.  I used: https://help.github.com/en/actions/automating-your-workflow-with-github-actions/using-environment-variables 

I could not find anyting saying period (decimal) is not allowed.  It is implied that there is some structure to the variable naming scheme.  The  syntax: jobs.job.env gave me a clue that period might not be supported.

Not a big problem, but just for future searchers…