Secrets in environment variables is such a bad security anti-pattern, and it seems to be getting more popular.
What is a better pattern?
Secrets or credential management is hard, but the first step is to centralise. Many folk use Vault. There's also Knox, KeyWhiz and I forget some others. I've been a secrets-management product team (CredHub) for several months now.
We've looked at different ways of shuttling secrets but really, it's going to be specific to the context. For example, one job our software does is to hand credentials to a trusted BOSH director during deployments. That's basically done at this point and works very nicely from an operator perspective.
But then when we look at handing secrets to applications, or getting secrets to CI, it's a bit trickier.
We use Concourse a lot and for Concourse the next major track of work centres entirely around creating a secrets-management layer that backs onto secret-management systems.
Disclosure: At the moment I work on CredHub on behalf of Pivotal.
CI secret access isn't a thing in the systems I develop (unit tests don't need them, integration tests get a spun-up environment that provisions its own secrets), but you could provide access with a bog-standard token machine.
[1] https://github.com/fugue/credstash