Read from environment variable but can't seem to use the value

I have the following in my .circleci/configy.yml file

      - run:
          name: log test environment var
          command: echo "${APK_TEST}"

      - run:
          name: Extract Key
          command: ./tools/ospath/decodeBase64 $APK_TEST

  # Build & test
      - build-java:
          context: androidProductionKeys
                - main

I realize they mask secure environment variables in output(the echo) but what I don’t understand is why the decodeBase64 shell script which takes the base64 and outputs it to a keystore file for android to consume is not working.

I am following this post as I like the setup continuous integration - Where to store Android KeyStore file for CirlceCi build? - Stack Overflow

but for some reason, I do the ./tools/ospath/decodeBase64 locally and it works but in CI it is not working.

My test is using a string file (not a keystore) to make sure things are working so the base64 is VGhpcyBpcyBhIGdvb2QgdGVzdAo=% which translates to a text file with contents “This is a good test”

be very aware MAC adds a % you need to remove. that was a huge PITA to figure out.