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

[communication][sms] run sms samples in pipeline #15345

Merged
merged 6 commits into from
May 21, 2021
Merged

[communication][sms] run sms samples in pipeline #15345

merged 6 commits into from
May 21, 2021

Conversation

0rland0Wats0n
Copy link
Contributor

This PR refactors the sms samples and stops skipping them in pipeline runs.

@0rland0Wats0n 0rland0Wats0n requested review from ankitarorabit and a team as code owners May 20, 2021 15:16
@ghost ghost added the Communication label May 20, 2021
@0rland0Wats0n
Copy link
Contributor Author

/azp run js - communication-sms - tests

@azure-pipelines
Copy link

Azure Pipelines successfully started running 1 pipeline(s).

const endpoint =
process.env["COMMUNICATION_ENDPOINT"] || "https://<resource-name>.communication.azure.com";
process.env.COMMUNICATION_ENDPOINT ||
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to just remove this process.env.COMMUNICATION_ENDPOINT? We don't even have a reference to it in the sample.env.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'll add COMMUNICATION_ENDPOINT to sample.env because if you're using aad to authenticate you most likely won't have a connection string to parse. Also, if a developer has a connection string they might as well use it to authenticate instead of aad. We only have connection string in this sample because we don't have COMMUNICATION_ENDPOINT.

@@ -51,7 +51,7 @@ node sendSms.js
Alternatively, run a single sample with the correct environment variables set (setting up the `.env` file is not required if you do this), for example (cross-platform):

```bash
npx cross-env COMMUNICATION_CONNECTION_STRING="<communication connection string>" node sendSms.js
npx cross-env COMMUNICATION_SAMPLES_CONNECTION_STRING="<communication samples connection string>" FROM_PHONE_NUMBER="<from phone number>" AZURE_PHONE_NUMBER="<azure phone number>" TO_PHONE_NUMBERS="<to phone numbers>" AZURE_PHONE_NUMBER="<azure phone number>" node sendSms.js
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AZURE_PHONE_NUMBER="<azure phone number>" node sendSms.js
I think these instructions are a little unclear. Cause technically if we have TO_PHONE_NUMBERS and FROM_PHONE_NUMBERS then setting the AZURE_PHONE_NUMBER become moot. We should strive for a bit more clarity.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is auto generated

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

only way to be clearer is to not use AZURE_PHONE_NUMBER

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I could edit the generated output but then this would have to be done every time the publish command is run

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We want to keep AZURE_PHONE_NUMBER cause that is the one at the moment that the pipeline is injecting. I can make a new property in the config for the new properties TO_PHONE_NUMBERS and FROM_PHONE_NUMBERS but for the time being this should be fine


# The endpoint to the Communication Services resource
COMMUNICATION_ENDPOINT="https://<resource name>.communication.azure.net/"
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this being set in the LiveTest pipeline? should we make the name more in-line with the others? e,g, COMMUNICATION_SAMPLES_ENDPOINT?


// construct send request
const sendRequest: SmsSendRequest = {
from: process.env.FROM_PHONE_NUMBER || process.env.AZURE_PHONE_NUMBER || "<from-phone-number>",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is AZURE_PHONE_NUMBER the one used in the livetest pipeline? maybe we should figure out a better way than all these or statements because I think this will confuse the customers

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@JoshuaLai @0rland0Wats0n how much effort would it be to make a subconfig for samples env vars
so maybe something like:
COMMUNICATION_SAMPLES_CONNECTION_STRING
COMMUNICATION_SAMPLES_ENDPOINT
SAMPLES_PHONE_NUMBER (alternatively we can keep this as AZURE_PHONE_NUMBER and update the sample.env)
SAMPLES_DESTINATION_PHONE_NUMBERS (change the TO_PHONE_NUMBERS in sample.env)

const credential: TokenCredential = isNode
? new DefaultAzureCredential()
: new ClientSecretCredential(
process.env.AZURE_TENANT_ID,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we would need to add this to the samples.env then, and add a small comment on what they're used for (e.g. used for AAD samples)

@0rland0Wats0n 0rland0Wats0n merged commit bb5fd9a into Azure:master May 21, 2021
@0rland0Wats0n 0rland0Wats0n deleted the enable-sms-samples branch May 21, 2021 01:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants