Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Accessing in Xcode #488

Closed
philihp opened this issue Mar 6, 2019 — with docs.microsoft.com · 10 comments
Closed

Accessing in Xcode #488

philihp opened this issue Mar 6, 2019 — with docs.microsoft.com · 10 comments
Assignees

Comments

Copy link

philihp commented Mar 6, 2019

How can these be accessed in Xcode?


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

@philihp
Copy link
Author

philihp commented Mar 6, 2019

To add some clarity here, I have two branches, one for staging and one for release, each of which has an environment variable giving it a CODEPUSH_KEY.

When I add a build step that does a printenv command to list all the variables, I see it showing up as USER-DEFINED_CODEPUSH_KEY, but environment variables allowed to have a dash in them, so printing this results in printing the value of $USER followed by -DEFINED_CODEPUSH_KEY... so vsts-DEFINED_CODEPUSH_KEY.

Is the USER-DEFINED_ prefix being added by Appcenter? Is there a way around this?

@jwargo
Copy link
Contributor

jwargo commented Mar 6, 2019

@philihp I'll ask someone on the build team to respond, but you should probably just ask support for help. The comments feature of our documentation is intended to enable customers to suggest changes to the docs or ask clarifying questions about the docs. If feels like a doc update would help here, but we can do that after you resolve your issue.

App Center support is provided directly from within the App Center portal. Any time you need help, just click the blue chat button in the lower-right corner of any page and our dedicated support team will respond. For additional information, see the App Center Help Center.

@nilofer
Copy link

nilofer commented Mar 7, 2019

@philihp the USER-DEFINED_ prefix is added by App Center when you add an environment variable when configuring the branch. There isn't a way around this. If you need still need more specific help, please reach out to our support via the blue bubble in the App Center portal.

@nilofer nilofer closed this as completed Mar 7, 2019
@philihp
Copy link
Author

philihp commented Mar 7, 2019

@nrajpurkar can that prefix be changed to USER_DEFINED_ for reasons in https://unix.stackexchange.com/questions/23659/can-shell-variable-include-character/23714#23714? This would be a breaking change, but I don't imagine they're very useful with that dash.

@dennispan
Copy link
Contributor

dennispan commented Mar 8, 2019

@philihp If you access the variables in the places documented here: https://docs.microsoft.com/en-us/appcenter/build/custom/variables/#access-the-variables , then USER-DEFINED_ prefix is not needed. To access them elsewhere, unfortunately there is currently no workaround. I'd encourage adding a new feature request here: https://github.com/Microsoft/appcenter

@tonyarnold
Copy link

Why is this closed? The issue isn't resolved, and there's no workaround?

@dennispan
Copy link
Contributor

@tonyarnold The environment variables configured in App Center Build are currently specifically designed to be used in places documented here: https://docs.microsoft.com/en-us/appcenter/build/custom/variables/#access-the-variables, where you can access them without the USER-DEFINED_ prefix. This is achieved by storing the variables with USER-DEFINED_ prefix, and then remove the prefix when we make them available at the places described in the doc.

Accessing the variables outside of those documented place are currently unsupported. Directly using USER-DEFINED_xxx really wasn't our intention. That said, I would definitely be open to hear what you are trying to solve (e.g. where you are trying to access the variables), and see what we can do.

@tonyarnold
Copy link

Thanks for the info, @dennispan.

I have components of my Xcode build that I only wish to run in release builds. To date, I’ve been doing that using environment variables that I watch for in build phase scripts.

I also use them to pass a password to lock/unlock a bundled Keychain with build secrets in it.

I really need these available during the Xcode build - I can’t make this work via pre/post build scripts.

@dennispan
Copy link
Contributor

@tonyarnold Thanks for the quick reply! Let's move this discussion to microsoft/appcenter#161? Would be great to consolidate feedbacks on this in one place

@tonyarnold
Copy link

Actually, I take that back. I can think of a workaround for the release components. Not sure what to do about the bundled keychain though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

5 participants