<p>I am trying to adapt the quickstart guide for Mongo Atlas Operator here <a href="https://www.mongodb.com/blog/post/introducing-atlas-operator-kubernetes" rel="nofollow noreferrer">Atlas Operator Quickstart</a> to use secure env variables set in TravisCI.</p>
<p>I want to put the quickstart scripts into my deploy.sh, which is triggered from my travis.yaml file.</p>
<p>My travis.yaml already sets one global variable like this:</p>
<pre><code>env:
 global:
    - SHA=$(git rev-parse HEAD)
</code></pre>
<p>Which is consumed by the deploy.sh file like this:</p>
<pre><code>docker build -t mydocker/k8s-client:latest -t mydocker/k8s-client:$SHA -f ./client/Dockerfile ./client
</code></pre>
<p>but I'm not sure how to pass vars set in the Environment variables bit in the travis Settings to deploy.sh</p>
<p><a href="https://i.stack.imgur.com/C3Pyi.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/C3Pyi.png" alt="env vars" /></a></p>
<p>This is the section of script I want to pass variables to:</p>
<pre><code>    kubectl create secret generic mongodb-atlas-operator-api-key \
  --from-literal=&quot;orgId=$MY_ORG_ID&quot; \
  --from-literal=&quot;publicApiKey=$MY_PUBLIC_API_KEY&quot; \
  --from-literal=&quot;privateApiKey=$MY_PRIVATE_API_KEY&quot; \
  -n mongodb-atlas-system
</code></pre>
<p>I'm assuming the --from-literal syntax will just put in the literal string &quot;orgId=$MY_ORG_ID&quot; for example, and I need to use pipe syntax - but can I do something along the lines of this?:</p>
<pre><code>echo &quot;$MY_ORG_ID&quot; | kubectl create secret generic mongodb-atlas-operator-api-key --orgId-stdin
</code></pre>
<p>Or do I need to put something in my travis.yaml before_install script?</p>

Davtho1983
<p>Looks like the <code>echo</code> approach is fine, I've found a similar use-case to yours, have a look <a href="https://drew-buckman.medium.com/use-travis-ci-to-automate-the-deployment-of-a-python-app-to-ibm-code-engine-4b534b503055" rel="nofollow noreferrer">here</a>.</p>
