#πŸ˜΅πŸ’« CI pipeline perplexity! Failing when piping a command??

9 messages Β· Page 1 of 1 (latest)

gloomy pilot
#

This one is truly baffling me. Can someone please please point me in the direction of what i've done wrong.
Top and bottom is - Nothing has changed (on my side), but now its broken.

Gitlab CI deploy stage looks like this (deploying to heroku via heroku cli).

heroku-deploy-staging:
  extends: .heroku-deploy
  needs: ['test-heroku-env', 'build-staging-frontend']
  script:
    - heroku builds:create --app my-app-name # WORKS FINE
    - cat ./build/flushall | heroku redis:cli --app my-app-name --confirm my-app-name
  ... and so on.

Entire CI passes, the app deploys to heroku, heroku confirms app deploy. Final stage is to flush redis.
Response... Error: No Redis instances found

This is the strange part.
Doesn't work ❌
(flushall file πŸ‘‡)

FLUSHALL
QUIT

cat ./build/flushall | heroku redis:cli --app my-app-name --confirm my-app-name

Doesn't work ❌
echo "FLUSHALL\r\nQUIT" | heroku redis:cli --app my-app-name --confirm my-app-name

Connects to redis βœ… (but with no commands, so hangs infinitely)
heroku redis:cli --app my-app-name --confirm my-app-name

As a final sense check... I added this command BEFORE redis, just to confirm it's there.
heroku addons --app my-app-name

Yep - REDIS is there, created and available.

So why on earth, does it fail only when I pipe a command to it??
I can connect with no command piped. Cannot be found without the command piped.
Any help on this would be hugely appreciated. One entire morning has been wasted so far...

astral trellis
#

This doesn't likely feel like a GitLab issue - rather some issue with running the Heroku command.

Have you tried running it locally, in exactly the same way (i.e. piping in the command etc.)?

gloomy pilot
#

Literally works fine locally... heroku version outputs exact same version too

astral trellis
#

I'm not familar with Heroku - how does the command line tool get configured? Is there a config file or something? Or environment variables that it uses?

#

From looking at the docs, I see that there is this command: heroku redis:info - might be worth running that in your pipeline to check that the output of that gives what you'd expect?

gloomy pilot
#

I think you're actually right that this is specifically a heroku issue, and not a gitlab piping issue. I've FINALLY managed to break it locally with the same response. Something msut have changed in their CLI over the past 4 days.

Interestingly this doesnt work...
echo "FLUSHALL\nQUIT" | heroku redis:cli --app app-name --confirm app-name

But, an expect command does (thank Claude)

expect -c '
spawn heroku redis:cli --app app-name --confirm app-name
expect ">"
send "FLUSHALL\r"
expect ">"
send "QUIT\r"
expect eof'
gloomy pilot
astral trellis
#

OK, so if you can reproduce it locally, I guess that gives you the route to solve it.

As I say, I've no experience with Heroku, so maybe some forum or whatever they have might be more help than here.

gloomy pilot
#

Yeah no that's fine - thanks for giving it some airtime with me though! Appreciate your time