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

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:

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

- 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.

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.

Hi there @SahilReddy :wave:

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 ) so that we can take a more in-depth look? :slightly_smiling_face:

1 Like

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