Integers longer than 6 digits will be converted in job level environment variables

When setting a job level environment variable, if the value is an integer and greater than 6 digits, we will convert it to an exponential number. As an example:

version: 2.1

jobs:
  build:
    docker:
      - image: buildpack-deps:trusty
    environment:
      NUMBER: 7777777

The above would become instead 7.777777e+06 in the job. The reason for this conversion is how yaml interprets the value being passed. However, this can be avoided in a few different ways.

Store value as a string

Instead of setting the value as an integer instead set it as a string. So instead of 7777777 set it to "7777777" like this:

version: 2.1

jobs:
  build:
    docker:
      - image: buildpack-deps:trusty
    environment:
      NUMBER: "7777777"

Set the variable at the project level

Instead of setting the variable in your config.yml directly, you can instead set the variable at the project level to utilize in jobs. This will ensure the value is protected and not automatically converted.

Was this article helpful?
0 out of 0 found this helpful

Comments

0 comments

Article is closed for comments.