Can you advise me how to insert a bitbucket variables into the script I have locally and run it via atlassian / ssh-run in pipelines? In this .contrib file I want use bitbucket variables, but does not work nothing, i tried $VARIABLE, ${VARIABLE}, but without success.
is there any way to get them there?
or do you have any other better solution?
Hi @creox-bitbucket , using envsubst is probably the easiest solution.
- step:
script:
- envsubst < .contrib/deploy.sh > deploy-out.sh
- pipe: atlassian/ssh-run:0.2.2
varialbes:
SSH_USER: $STAGE_USER
SERVER: $STAGE_SERVER
MODE: 'script'
COMMAND: 'deploy-out.sh'
What envsubst will do is it'll basically hardcode your environment variables into your script right where you reference them.
Hi @Alexander Zhukov , I tried to use envsubst in the yaml but it failed because of `envsubst` not found. any thoughts about this? thanks
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
You have to install the envsubst package in your step
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hey @Alexander Zhukov, not sure if only installing in my step helps. Image needs also to be updated. To be honest, I was expecting this to be "there" because bitbucket-pipelines support aws-ecs pipeline which practically relies on this transformation.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
I have the same problem and asked for help here: https://stackoverflow.com/questions/62643174/looking-for-a-docker-image-with-node-envsubst-and-rsync
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
if you are getting `envsubst` not found
- step:
script:
- apt-get update && apt-get install -y gettext-base
- envsubst < .contrib/deploy.sh > deploy-out.sh
- pipe: atlassian/ssh-run:0.2.2
varialbes:
SSH_USER: $STAGE_USER
SERVER: $STAGE_SERVER
MODE: 'script'
COMMAND: 'deploy-out.sh'
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.