Skip to content

Commit

Permalink
Migrate to GHCR
Browse files Browse the repository at this point in the history
  • Loading branch information
willdavsmith committed Oct 15, 2023
1 parent 5c473f0 commit ba694ef
Show file tree
Hide file tree
Showing 27 changed files with 38 additions and 101 deletions.
67 changes: 2 additions & 65 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,51 +18,12 @@ concurrency:

env:
VERSION: ${{ github.event.pull_request.number || 'latest' }}
# Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io.
# TODO_LAUNCH: Remove this env var once we opensource the repo - https://github.com/radius-project/samples/issues/439
DOCKER_REGISTRY: ${{ github.event.pull_request.number && 'radiusdev.azurecr.io' || 'radius.azurecr.io' }}
# Use radiusdev.azurecr.io for PR build. Otherwise, use radius.azurecr.io.
CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project' }}
# Use ghcr.io/radius-project/dev for PR build. Otherwise, use ghcr.io/radius-project/samples.
CONTAINER_REGISTRY: ${{ github.event.pull_request.number && 'ghcr.io/radius-project/dev' || 'ghcr.io/radius-project/samples' }}
# Set to true to push images to registry.
PUSH_IMAGE: true

jobs:
# TODO_LAUNCH: Remove this build job once we opensource the repo - https://github.com/radius-project/samples/issues/439
build-acr:
name: Build and push sample images to ACR
if: github.event.action != 'closed'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- directory: samples/demo/
image: samples/demo
- directory: samples/dapr/ui/
image: samples/dapr-frontend
- directory: samples/dapr/nodeapp/
image: samples/dapr-backend
- directory: samples/aws/
image: samples/aws
- directory: samples/aws-sqs/
image: samples/aws-sqs
- directory: samples/volumes/
image: samples/volumes
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Login to container registry
uses: azure/docker-login@v1
with:
login-server: ${{ env.DOCKER_REGISTRY }}
username: '${{ secrets.AZURE_SP_DOCKER_USERNAME }}'
password: '${{ secrets.AZURE_SP_DOCKER_PASSWORD }}'
- name: Build and push ${{ matrix.image }}
uses: docker/build-push-action@v4
with:
context: ./${{ matrix.directory }}
push: ${{ env.PUSH_IMAGE }}
tags: ${{ env.DOCKER_REGISTRY }}/${{ matrix.image }}:${{ env.VERSION }}
build-ghcr:
name: Build and push sample images to GHCR
if: github.event.action != 'closed'
Expand Down Expand Up @@ -101,27 +62,3 @@ jobs:
context: ./${{ matrix.directory }}
push: ${{ env.PUSH_IMAGE }}
tags: ${{ env.CONTAINER_REGISTRY }}/${{ matrix.image }}:${{ env.VERSION }}

# TODO_LAUNCH: Remove this job once we opensource the repo because all pkgs will be cleaned up regularly - https://github.com/radius-project/samples/issues/439
cleanup:
name: Cleanup ${{ matrix.image }}
if: github.event.action == 'closed'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
image: [
samples/demo,
samples/dapr-frontend,
samples/dapr-backend,
samples/aws,
samples/aws-sqs,
samples/volumes
]
steps:
- name: Login to az cli and ACR
run: |
az login --service-principal --username ${{ secrets.AZURE_SP_DOCKER_USERNAME }} --password ${{ secrets.AZURE_SP_DOCKER_PASSWORD }} --tenant ${{ secrets.AZURE_SP_DOCKER_TENANT }}
az acr login --name ${{ env.DOCKER_REGISTRY }}
- name: Delete PR images
run: az acr repository delete --name ${{ env.DOCKER_REGISTRY }} --image "${{ matrix.image }}:${{ env.VERSION }}" --yes
4 changes: 2 additions & 2 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ jobs:
rad group switch default
rad env create default
rad env switch default
rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches
rad recipe register default -e default -w default --template-kind bicep --template-path radius.azurecr.io/recipes/dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/dev/rediscaches:latest --resource-type Applications.Datastores/redisCaches
rad recipe register default -e default -w default --template-kind bicep --template-path ghcr.io/radius-project/recipes/dev/mongodatabases:latest --resource-type Applications.Datastores/mongoDatabases
if [[ "${{ matrix.credential }}" == "azure" ]]; then
rad env update default --azure-subscription-id ${{ secrets.AZURE_SUBSCRIPTIONID_TESTS }} --azure-resource-group ${{ steps.gen-id.outputs.TEST_AZURE_RESOURCE_GROUP }}
rad credential register azure --client-id ${{ secrets.AZURE_SP_TESTS_APPID }} --client-secret ${{ secrets.AZURE_SP_TESTS_PASSWORD }} --tenant-id ${{ secrets.AZURE_SP_TESTS_TENANTID }}
Expand Down
4 changes: 2 additions & 2 deletions samples/aws-sqs/sqs.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ resource producer 'Applications.Core/containers@2023-10-01-preview' = {
},
aws_credential
)
image: 'radius.azurecr.io/reference-apps/aws-sqs-sample:edge'
image: 'ghcr.io/radius-project/samples/reference-apps/aws-sqs-sample:edge'
}
}
}
Expand All @@ -61,7 +61,7 @@ resource consumer 'Applications.Core/containers@2023-10-01-preview' = {
},
aws_credential
)
image: 'radius.azurecr.io/reference-apps/aws-sqs-sample:edge'
image: 'ghcr.io/radius-project/samples/reference-apps/aws-sqs-sample:edge'
}
}
}
2 changes: 1 addition & 1 deletion samples/aws/awss3.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
AWS_SECRET_ACCESS_KEY: aws_secret_access_key
AWS_DEFAULT_REGION: aws_region
}
image: 'radius.azurecr.io/reference-apps/aws:edge'
image: 'ghcr.io/radius-project/samples/reference-apps/aws:edge'
}
}
}
4 changes: 2 additions & 2 deletions samples/dapr/dapr-azure.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ resource backend 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: app.id
container: {
image: 'radius.azurecr.io/quickstarts/dapr-backend:edge'
image: 'ghcr.io/radius-project/samples/quickstarts/dapr-backend:edge'
ports: {
web: {
containerPort: 3000
Expand All @@ -42,7 +42,7 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: app.id
container: {
image: 'radius.azurecr.io/quickstarts/dapr-frontend:edge'
image: 'ghcr.io/radius-project/samples/quickstarts/dapr-frontend:edge'
env: {
CONNECTION_BACKEND_APPID: backend.name
}
Expand Down
4 changes: 2 additions & 2 deletions samples/dapr/dapr.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ resource backend 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: app.id
container: {
image: 'radius.azurecr.io/quickstarts/dapr-backend:edge'
image: 'ghcr.io/radius-project/samples/quickstarts/dapr-backend:edge'
ports: {
web: {
containerPort: 3000
Expand All @@ -45,7 +45,7 @@ resource frontend 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: app.id
container: {
image: 'radius.azurecr.io/quickstarts/dapr-frontend:edge'
image: 'ghcr.io/radius-project/samples/quickstarts/dapr-frontend:edge'
env: {
CONNECTION_BACKEND_APPID: backend.name
}
Expand Down
2 changes: 1 addition & 1 deletion samples/demo/app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ resource demo 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/tutorial/webapp:edge'
image: 'ghcr.io/radius-project/samples/tutorial/webapp:edge'
ports: {
web: {
containerPort: 3000
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/basket-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resource basketApi 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/basket.api:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/basket.api:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/blazor-client.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ resource blazorClient 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/blazor.client:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/blazor.client:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/catalog-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ resource catalogApi 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/catalog.api:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/catalog.api:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/identity-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resource identityApi 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/identity.api:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/identity.api:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/ordering-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ resource orderingApi 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/ordering.api:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/ordering.api:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/payment-api.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ resource paymentApi 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/payment.api:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/payment.api:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/webshopping-agg.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ resource webshoppingAgg 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/webshoppingagg:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/webshoppingagg:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/webshopping-gw.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ resource webshoppingGw 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/webshoppingapigw:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/webshoppingapigw:rad-latest'
env: {
ENVOY_CATALOG_API_ADDRESS: catalogApiRoute.properties.hostname
ENVOY_CATALOG_API_PORT: '${catalogApiRoute.properties.port}'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop-dapr/services/webstatus.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: appId
container: {
image: 'radius.azurecr.io/eshopdapr/webstatus:rad-latest'
image: 'ghcr.io/radius-project/samples/eshopdapr/webstatus:rad-latest'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
4 changes: 2 additions & 2 deletions samples/eshop/envoy/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ What this means is that if we need to update the names of routes in eshop, *we l

The routing configuration is in [envoy.yaml](envoy.yaml). See the `route_config` section specifically.

To build the docker image, run `docker build . -t radius.azurecr.io/eshop-envoy:0.1.<NUMBER>`.
To build the docker image, run `docker build . -t ghcr.io/radius-project/samples/eshop-envoy:0.1.<NUMBER>`.

Where NUMBER is one greater than the latest version made. To view versions, see https://ms.portal.azure.com/#view/Microsoft_Azure_ContainerRegistries/RepositoryBlade/id/%2Fsubscriptions%2F66d1209e-1382-45d3-99bb-650e6bf63fc0%2FresourceGroups%2Fassets%2Fproviders%2FMicrosoft.ContainerRegistry%2Fregistries%2Fradius/repository/eshop-envoy.

To push the image, run `az acr login -n radius` and then `docker push radius.azurecr.io/eshop-envoy:0.1.<NUMBER>`.
To push the image, run `az acr login -n radius` and then `docker push ghcr.io/radius-project/samples/eshop-envoy:0.1.<NUMBER>`.

2 changes: 1 addition & 1 deletion samples/eshop/iac/services/basket.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ resource basket 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/basket.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/basket.api:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop/iac/services/catalog.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ resource catalog 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/catalog.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/catalog.api:${TAG}'
env: {
UseCustomizationData: 'False'
PATH_BASE: '/catalog-api'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop/iac/services/identity.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ resource identity 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/identity.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/identity.api:${TAG}'
env: {
PATH_BASE: '/identity-api'
ASPNETCORE_ENVIRONMENT: 'Development'
Expand Down
6 changes: 3 additions & 3 deletions samples/eshop/iac/services/ordering.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ resource ordering 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/ordering.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/ordering.api:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down Expand Up @@ -119,7 +119,7 @@ resource orderbgtasks 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/ordering.backgroundtasks:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/ordering.backgroundtasks:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down Expand Up @@ -156,7 +156,7 @@ resource orderingsignalrhub 'Applications.Core/containers@2023-10-01-preview' =
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/ordering.signalrhub:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/ordering.signalrhub:${TAG}'
env: {
PATH_BASE: '/payment-api'
ASPNETCORE_ENVIRONMENT: 'Development'
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop/iac/services/payment.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ resource payment 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/payment.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/payment.api:${TAG}'
env: {
ApplicationInsights__InstrumentationKey: APPLICATION_INSIGHTS_KEY
'Serilog__MinimumLevel__Override__payment-api.IntegrationEvents.EventHandling': 'Verbose'
Expand Down
4 changes: 2 additions & 2 deletions samples/eshop/iac/services/web.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ resource webspa 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webspa:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webspa:${TAG}'
env: {
PATH_BASE: '/'
ASPNETCORE_ENVIRONMENT: 'Production'
Expand Down Expand Up @@ -103,7 +103,7 @@ resource webmvc 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webmvc:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webmvc:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
4 changes: 2 additions & 2 deletions samples/eshop/iac/services/webhooks.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ resource webhooks 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webhooks.api:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webhooks.api:${TAG}'
env: {
PATH_BASE: '/webhooks-api'
ASPNETCORE_ENVIRONMENT: 'Development'
Expand Down Expand Up @@ -90,7 +90,7 @@ resource webhooksclient 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webhooks.client:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webhooks.client:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Production'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
4 changes: 2 additions & 2 deletions samples/eshop/iac/services/webshopping.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ resource webshoppingagg 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webshoppingagg:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webshoppingagg:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
PATH_BASE: '/webshoppingagg'
Expand Down Expand Up @@ -119,7 +119,7 @@ resource webshoppingapigw 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop-envoy:0.1.4'
image: 'ghcr.io/radius-project/samples/eshop-envoy:0.1.4'
ports: {
http: {
containerPort: 80
Expand Down
2 changes: 1 addition & 1 deletion samples/eshop/iac/services/webstatus.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ resource webstatus 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: application
container: {
image: 'radius.azurecr.io/eshop/webstatus:${TAG}'
image: 'ghcr.io/radius-project/samples/eshop/webstatus:${TAG}'
env: {
ASPNETCORE_ENVIRONMENT: 'Development'
ASPNETCORE_URLS: 'http://0.0.0.0:80'
Expand Down
2 changes: 1 addition & 1 deletion samples/volumes/app.bicep
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ resource container 'Applications.Core/containers@2023-10-01-preview' = {
properties: {
application: app.id
container: {
image: 'radius.azurecr.io/quickstarts/volumes:edge'
image: 'ghcr.io/radius-project/samples/quickstarts/volumes:edge'
volumes: {
temp: {
kind: 'ephemeral'
Expand Down

0 comments on commit ba694ef

Please sign in to comment.