Merge branch 'microsoft:main' into main

pull/153/head
Marcus Felling 2022-09-14 09:07:08 -05:00 committed by GitHub
commit 7b7d76d540
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 30 additions and 7 deletions

View File

@ -45,7 +45,6 @@ jobs:
azPSVersion: "latest"
inlineScript: |
az extension add --name containerapp
az provider register --namespace Microsoft.App
$apiUrl = "https://$(az containerapp show -g ${{ secrets.AZURE_RESOURCE_GROUP_NAME }} -n ${{ env.API_RESOURCE_NAME }} -o tsv --query properties.configuration.ingress.fqdn)"
$listenTogetherHubUrl = "https://${{ secrets.HUB_WEBAPP_NAME }}.azurewebsites.net/listentogether"
echo "PODCAST_API_URL=$apiUrl" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append

View File

@ -35,13 +35,29 @@ First, you need to create an Azure Resource group within your subscription. If y
To create the resource group, run the following command in the terminal:
```console
az group create --name podcastrg --location westus2
az group create --name podcastrg --location canadacentral
```
The above resource group name will be added to the GitHub secrets in a later step. If you decide to use your own resource group name, be sure to update the same later.
Checkout [Azure CLI](https://docs.microsoft.com/azure/azure-resource-manager/management/manage-resource-groups-cli) or [Azure Cloud Shell](https://docs.microsoft.com/azure/cloud-shell/quickstart#create-a-resource-group) if you need additional help to set up a resource group.
### Register Subscription dependencies
Run the following command to ensure the following dependencies
```console
az provider register --namespace Microsoft.ContainerRegistry
```
and also Microsoft.App
```console
az provider register --namespace Microsoft.App
```
> If you see errors similar to "The subscription is not registered to use namespace `'Microsoft.<ProviderName>'`", execute the command az provider register --namespace `'Microsoft.<ProviderName>'` in Azure CLI and re-run the failed jobs again.
### Configure Azure Credentials in GitHub Secrets
To connect GitHub Actions, you will create a secret named `AZURE_CREDENTIALS` that you can use to authenticate with Azure.
@ -72,7 +88,7 @@ To connect GitHub Actions, you will create a secret named `AZURE_CREDENTIALS` th
![Select Settings in the navigation](docs/github-repo-settings.png)
1. Select **Secrets** and then **New Secret**.
1. Under **Security** Select **Secrets** -> **Actions** and then **New repository secret**.
![Choose to add a secret](docs/select-secrets.png)
@ -113,7 +129,9 @@ Go to the GitHub actions tab, and enable the workflows.
## Run the Podcast API CICD first
The backend services need to be run first to set up all necessary dependencies, databases, and blob storage. You can manually run this from the `Actions` tab, click on `Select workflow` -> `Podcast API CICD` -> `Run workflow`.
> IMPORTANT: The backend services need to be run first to set up all necessary dependencies, databases, and blob storage.
You can manually run this from the `Actions` tab, click on `Select workflow` -> `Podcast API CICD` -> `Run workflow`.
Wait for the workflow run to complete and execute the next steps. The first time you run this it will take a bit longer as it creates all of the Azure resources.
@ -121,7 +139,13 @@ Wait for the workflow run to complete and execute the next steps. The first time
Next we will wanto to deploy the listen together hub and the web app.
You can manually run the Hub action from the `Actions` tab, click on `Select workflow` -> `Podcast Hub CICD` -> `Run workflow`. Then run the web action with `Select workflow` -> `Podcast Web CICD` -> `Run workflow`
You can manually run the Hub action from the `Actions` tab, click on:
* `Select workflow` -> `Podcast Hub CICD` -> `Run workflow`.
> Note: If deploy fails, re-run as it may be a timing issue.
Then run the web action with:
* `Select workflow` -> `Podcast Web CICD` -> `Run workflow`
Once all the runs are complete, you'll see something like this under the Actions tab.

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 8.5 KiB

View File

@ -28,7 +28,7 @@ public class PodcastIngestionHandler : IPodcastIngestionHandler
CancellationToken stoppingToken)
{
_logger.LogInformation($"The show {title} at {url} was received by the ingestion worker.");
var isExistingShow = await _podcastDbContext.Feeds.AnyAsync(feed => string.Equals(feed.Url, url, StringComparison.OrdinalIgnoreCase), stoppingToken);
var isExistingShow = await _podcastDbContext.Feeds.AnyAsync(feed => feed.Url.ToLower() == url.ToLower(), stoppingToken);
if (isExistingShow)
return;
@ -39,7 +39,7 @@ public class PodcastIngestionHandler : IPodcastIngestionHandler
_logger.LogInformation($"The show {title} at {url} was not automatically approved.");
// Must be manually approved
var userFeed = new UserSubmittedFeed(
title, url, string.Join(",", feedCategories));
url, title, string.Join(",", feedCategories));
await _podcastDbContext.UserSubmittedFeeds.AddAsync(userFeed, stoppingToken);
await _podcastDbContext.SaveChangesAsync(stoppingToken);
_logger.LogInformation($"The show {title} at {url} was saved as a user-submitted feed.");