Code Monkey home page Code Monkey logo

Comments (5)

edigaryev avatar edigaryev commented on July 17, 2024 1
  • add argument to read env vars from a specified file when running cirrus run.

Take a look at #619, once merged it should allow for that.

from cirrus-cli.

craighurley avatar craighurley commented on July 17, 2024 1

cirrus version 0.98.0-21e0ceb works great me. Thank you again.

from cirrus-cli.

fkorotkov avatar fkorotkov commented on July 17, 2024

Hey @craighurley,

You will need to manage secrets yourself and pass them to Cirrus CLI via --environment flag:

export SECRET_TOKEN="..."
cirrus run --environment SECRET_TOKEN=$SECRET_TOKEN

This will override any SECRET_TOKEN environment variable defined in your .cirrus.yml.

from cirrus-cli.

craighurley avatar craighurley commented on July 17, 2024

Hi @fkorotkov

Thanks for that. I'm using sops and can successfully run this for a simple example:

cirrus run -e password=$(sops -d --extract '["password"]' sops.env)

If the task is complex and needs many secrets, I was planning on decrypting sops.env to .env locally, then running cirrus and have a task script to cat .env into $CIRRUS_ENV, e.g:

task:
  set_env_script: cat .env >> $CIRRUS_ENV
  build_script:
    # commands that rely on multiple secrets in env vars

... but because I have gitignored .env (so I don't accidentally commit secrets to git), .env is not available within the cirrus task, unless I use the --dirty argument. I would prefer not to use the --dirty argument so that cirrus has read-only permissions.

Have I missed an option? Is there another way to set env vars that would suit my use case? Or could one of these options be added

  • add argument to ignore .gitignore.
  • add argument to read env vars from a specified file when running cirrus run.

The second option would be my preference. It also opens the ability to use sops in such a way that the decrypted file does not need to be written to disk, e.g:

sops exec-file sops.env 'cirrus run --vars {}'

from cirrus-cli.

craighurley avatar craighurley commented on July 17, 2024

Amazing, thank you!

from cirrus-cli.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.