# Secrets not populating when running bitrise locally & deploy path not working

**URL:** <https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359>\
**Category:** Question & Answer\
**Tags:** ios\
**Created:** [July 8, 2021, 5:23am UTC](https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359 "2021-07-08T05:23:01Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![SahilReddy](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@SahilReddy](https://discuss.bitrise.io/u/SahilReddy)\
**Post date:** [July 8, 2021, 5:23am UTC](https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359/1 "2021-07-08T05:23:01Z")

</div>

I can’t seem to find a clear explanation on how to test my secrets locally.

I have the bitrise.yml and .bitrise.secrets.yml. I run `bitrise run test` and in my `test` workflow and the script runs fine and shows `REDACTED`. But when I run `xcode test` after it doesn’t replace my environment variables with the secrets I gave it and fails my test. I then tried adding it to the secrets on workflow with no luck.

How I call the environment variables:

```auto
if let key = ProcessInfo.processInfo.environment["SECRET_KEY"] {
                return key
            }

```

I even tried adding `Swift Environment Variable Injection` right before `xcode test` and changing how I call the environment variable as suggested in the docs but that doesn’t work as well. I saw in an article, suggesting to add it to the environment variables in the scheme but then that’s in source control and defeats the purpose of doing the .bitrise.secret.yml file.

Another issue is I also tried redirecting the `deploy to bitrise` to see the problems when the test fails and it’s not working for me. This is what I have in my bitrise.yml

```auto
- deploy-to-bitrise-io:
        inputs:
        - deploy_path: /var/system.log

```

My question is how can I get the `deploy_path` to show the output in this file and, more importantly, how can I run my iOS tests locally with bitrise secrets?

Seems like it should be doable as that’s the point of the .bitrise.secrets.yml but I just can’t seem to find the solution.

---

<div class="post-metadata">

**Author:** ![SahilReddy](https://avatars.discourse-cdn.com/v4/letter/s/9de053/32.png) [@SahilReddy](https://discuss.bitrise.io/u/SahilReddy)\
**Post date:** [July 8, 2021, 5:05pm UTC](https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359/2 "2021-07-08T17:05:19Z")

</div>

To be more clear if I call it as I did through `ProcessInfo` and I am running an `xcode test` this is the failure I’m getting  
`testExample, XCTAssertEqual failed: ("") is not equal to ("[REDACTED]")`

And this is because if the environment key doesn’t exist I will return an empty string.

---

<div class="post-metadata">

**Author:** ![Roland-Bak](https://sea2.discourse-cdn.com/flex016/user_avatar/discuss.bitrise.io/roland-bak/32/3480_2.png) [@Roland-Bak](https://discuss.bitrise.io/u/Roland-Bak)\
**Post date:** [July 12, 2021, 11:39am UTC](https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359/3 "2021-07-12T11:39:01Z")

</div>

Hi there @SahilReddy 👋

Can you please send us the log file or the URL of the related build and also enable Support Access on the `Settings` tab of the app ( [Enabling the Bitrise Support user for your app | Bitrise DevCenter](https://devcenter.bitrise.io/troubleshooting/enabling-bitrise-support-user/) ) so that we can take a more in-depth look? 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/bitrise/original/2X/d/d901cf2aad020f2dd11918afc89ec2089bb87b35.png) [@system](https://discuss.bitrise.io/u/system)\
**Post date:** [August 11, 2021, 11:39am UTC](https://discuss.bitrise.io/t/secrets-not-populating-when-running-bitrise-locally-deploy-path-not-working/17359/4 "2021-08-11T11:39:14Z")

</div>

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
