Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Running a shell script command won't get env vars #21

Open
sombreroEnPuntas opened this issue Nov 24, 2018 · 1 comment
Open

Running a shell script command won't get env vars #21

sombreroEnPuntas opened this issue Nov 24, 2018 · 1 comment

Comments

@sombreroEnPuntas
Copy link

Hola :)

Made a small script to push a tag on a given repo, and managed to make it work 🛎
There's two things I'm missing tho.

ENV

The runner should get my env vars and have access to node/yarn without needing to explicitly set them.

PARAMS

Runner could get a set of params and pipe them to the script, so I can use argv.
Would like to have one script and set the PROJECT_PATH as an input param on the flic GUI

SHOW ME THE CODE

For reference, and maybe include it on the examples, here is my code:

#!/bin/sh
set -euf -o pipefail

# Setting project path, ideally it will get it from parameters on the script invoke, but it's ok
PROJECT_PATH=/route/to/project/
LOG=
/route/to/project/flic.log

# Setting node path. Instead it should get it from my env vars :)
PATH=~/.nvm/versions/node/v8.12.0/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:

echo "\n====[Deploy called at $(date +%Y/%m/%d--%H:%M:%S)]====" >> $LOG

printf "1️⃣ Checkout master\n" >> $LOG
cd $PROJECT_PATH >> $LOG 2>&1
git checkout master >> $LOG 2>&1
printf "✅\n" >> $LOG

printf "2️⃣ New version using standard-version\n" >> $LOG
yarn release >> $LOG 2>&1
printf "✅\n" >> $LOG

printf "3️⃣ Running application tests…\n" >> $LOG
# this pushes to PRD :o
# git push origin v >> $LOG 2>&1
printf "✅\n" >> $LOG

@AntonMeier
Copy link
Contributor

Cool script!

Regarding the issues, I don't explicitly set the environment when executing the scripts meaning that they should inherit the environment from the parent application (hax-with-flic app in this case). So I'm thinking that maybe if you launch the application from the terminal instead, then maybe it should get the correct env, but I have not tried this so I'm not sure.

Script params could definitely be added, is just a matter of updating the app. Unfortunately we don't plan to push an update anytime soon :(

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants