I'm trying to use the technique of base64 encoding my .env file into a pipelines unsecured variable as described in the following places, but the file that is created is empty:
How can I run a env variables on bitbucket pipeline?
How to pass variables to credentials.json in bitbucket-pipelines?
image: node:16
definitions:
caches:
yarncustom: /usr/local/share/.cache/yarn
steps:
- step: &Build-step
name: Build
caches:
- node
- yarncustom
script:
- echo $ENV_FILE | base64 -d > .env.local
- cat .env.local
- yarn install
- yarn build
artifacts:
- .next/**
- node_modules/**
- .env.local
- step: &Deploy-step
name: Deploy
script:
- pipe: atlassian/rsync-deploy:0.4.3
variables:
USER: $USER
SERVER: $SERVER
REMOTE_PATH: $REMOTE_PATH
LOCAL_PATH: '.'
EXTRA_ARGS: '--exclude-from=deployment-exclude-list.txt'
pipelines:
branches:
development:
- step: *Build-step
- step:
<<: *Deploy-step
deployment: test
I have tried running the following which works, which means that the variable is simply not there, although everything I have read suggests this should be working.
echo randomBase64String | base64 -d > .env.local
Screenshot of Bitbucket Piplelines to prove it exists and is unsecured:
What could I be missing?