Pass Mongo to an Atlas Operator, then move Env Vars from Travis to Kubernetes

I’m assuming the --from-literal syntax will just put in the literal string “orgId=$MY_ORG_ID” for example, and I need to use pipe syntax - but can I do something along the lines of this?:

echo "$MY_ORG_ID" | then  kubectl create secret generic mongodb-atlas-operator-api-key --orgId-stdin

Or do I need to put something in my travis.yaml before_install script? Really stuck here.

Hello @HILLBILLYHeisT,

You are correct, echo should be more than good enough - you don’t need to put anything in your before_install hook in your .travis.yml.

So this would be the equivalent of passing Docker environment variables in the CLI?

Hey @HILLBILLYHeisT,

It’s quite almost exactly the same like passing Docker environment variables to Travis using the Travis CLI. So for example the script hook I wrote passes the environment variables to Docker, then once authenticated pushes the image out:

script: docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD && make push-image

There’s no reason to add anything to your before_script hook though. I get the question, but the solution should be obvious, the flow you’re describing, sounds a lot like if you used another CI provider at one point, specifically CircleCI.

It’s not better or worse, CircleCI has their own process, but unlike CircleCI, our build starts out as a single bash script compiled from the information given in .travis.yml, and again this isn’t a better or worse way of doing things, it’s just how Travis is designed.

1 Like