From 9b46ae94b6369d4068b2abb85e27e84b8e1a61ac Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 10:18:43 -0400 Subject: [PATCH 1/6] Update deploy.yml --- .github/workflows/deploy.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3799157..c00e1cc 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -74,6 +74,9 @@ jobs: username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} + - name: Test pull + run: docker image pull ghcr.io/lancemccarthy/aspirebase:8.0 + - name: Update NuGet Package Sources run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --configfile ${{env.NUGET_CONF_PATH}} --store-password-in-clear-text From af4ffeede0383871e8f1a3d58bb041b40187ccfe Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 10:53:18 -0400 Subject: [PATCH 2/6] Update deploy.yml --- .github/workflows/deploy.yml | 94 +++++++++++++++++++----------------- 1 file changed, 50 insertions(+), 44 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index c00e1cc..b50c7e0 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -12,44 +12,45 @@ on: jobs: # Build a custom base image with needed Linux dependencies installed (being done on a weekly schedule now) - update_base_image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write - steps: - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 + # COMMENTED TEMPORARILY FOR TEST + # update_base_image: + # runs-on: ubuntu-latest + # permissions: + # contents: read + # packages: write + # steps: + # - name: Checkout + # uses: actions/checkout@v4 + # with: + # fetch-depth: 0 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 + # - name: Set up QEMU + # uses: docker/setup-qemu-action@v3 - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + # - name: Set up Docker Buildx + # uses: docker/setup-buildx-action@v3 - - name: Login to ghcr.io - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{github.actor}} - password: ${{secrets.GITHUB_TOKEN}} + # - name: Login to ghcr.io + # uses: docker/login-action@v3 + # with: + # registry: ghcr.io + # username: ${{github.actor}} + # password: ${{secrets.GITHUB_TOKEN}} - - name: Build and push to Github image repository - uses: docker/build-push-action@v5 - with: - context: '.dockerbuilds/baseimage' - platforms: linux/arm64,linux/amd64 - push: true - tags: | - "ghcr.io/lancemccarthy/aspirebase:8.0" + # - name: Build and push to Github image repository + # uses: docker/build-push-action@v5 + # with: + # context: '.dockerbuilds/baseimage' + # platforms: linux/arm64,linux/amd64 + # push: true + # tags: | + # "ghcr.io/lancemccarthy/aspirebase:8.0" # Once new base image is published, we can build the .NET Aspire projects # - The ApiService project needs the custom base image, defined as ContainerBaseImage in the csproj # - The rest can use the default mcr.microsoft.com/dotnet/aspnet:8.0 image deploy_app: - needs: [update_base_image] + # needs: [update_base_image] runs-on: ubuntu-latest permissions: id-token: write @@ -74,24 +75,29 @@ jobs: username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - - name: Test pull - run: docker image pull ghcr.io/lancemccarthy/aspirebase:8.0 - - - name: Update NuGet Package Sources - run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --configfile ${{env.NUGET_CONF_PATH}} --store-password-in-clear-text + # - name: Update NuGet Package Sources + # run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --configfile ${{env.NUGET_CONF_PATH}} --store-password-in-clear-text - name: Install .NET Aspire workload run: dotnet workload install aspire - - - name: Install azd - uses: Azure/setup-azd@v1.0.0 - - name: Log into Azure with GitHub Federated Credentials (OpenID) - run: azd auth login --client-id "$Env:AZURE_CLIENT_ID" --tenant-id "$Env:AZURE_TENANT_ID" --federated-credential-provider "github" - shell: pwsh + - name: Isolated build test + run: | + dotnet nuget add source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --store-password-in-clear-text + dotnet restore --configfile ${{env.NUGET_CONF_PATH}} + dotnet build -c Release --no-restore + dotnet publish 'DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj' /t:PublishContainer --no-build --no-restore + + # COMMENTED TEMPORARILY FOR TEST + # - name: Install azd + # uses: Azure/setup-azd@v1.0.0 + + # - name: Log into Azure with GitHub Federated Credentials (OpenID) + # run: azd auth login --client-id "$Env:AZURE_CLIENT_ID" --tenant-id "$Env:AZURE_TENANT_ID" --federated-credential-provider "github" + # shell: pwsh - - name: Provision Infrastructure - run: azd provision --no-prompt --environment "aspire2b" + # - name: Provision Infrastructure + # run: azd provision --no-prompt --environment "aspire2b" - - name: Deploy Application - run: azd deploy --no-prompt --environment "aspire2b" \ No newline at end of file + # - name: Deploy Application + # run: azd deploy --no-prompt --environment "aspire2b" \ No newline at end of file From a7e1288dc9cc0ded1371d6e2deae688bb2cc1f51 Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 11:47:06 -0400 Subject: [PATCH 3/6] Update deploy.yml --- .github/workflows/deploy.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index b50c7e0..72dc073 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -67,6 +67,9 @@ jobs: - name: Checkout uses: actions/checkout@v4 + - name: Install .NET Aspire workload + run: dotnet nuget list source + # For azd deploy to pull base image defined in ApiService.csproj - name: Login to ghcr.io uses: azure/docker-login@v1 @@ -79,12 +82,12 @@ jobs: # run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --configfile ${{env.NUGET_CONF_PATH}} --store-password-in-clear-text - name: Install .NET Aspire workload - run: dotnet workload install aspire + run: dotnet workload install aspire --ignore-failed-sources - name: Isolated build test run: | - dotnet nuget add source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --store-password-in-clear-text - dotnet restore --configfile ${{env.NUGET_CONF_PATH}} + dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --store-password-in-clear-text + dotnet restore dotnet build -c Release --no-restore dotnet publish 'DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj' /t:PublishContainer --no-build --no-restore From 980ca0ad5a78c856be4c89d76aad984cbde7d80c Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 12:28:04 -0400 Subject: [PATCH 4/6] Update DevCraftAspire.ApiService.csproj --- DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj | 2 ++ 1 file changed, 2 insertions(+) diff --git a/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj b/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj index fea63ea..6f57909 100644 --- a/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj +++ b/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj @@ -2,6 +2,8 @@ ghcr.io/lancemccarthy/aspirebase:8.0 + lancemccarthy/aspireapiservice + ghcr.io Exe net8.0 enable From bc8ca03e2e8b0e4ae7861d8731f40d2d21f94bb0 Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 13:44:19 -0400 Subject: [PATCH 5/6] Update DevCraftAspire.ApiService.csproj revert test --- DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj | 6 +----- 1 file changed, 1 insertion(+), 5 deletions(-) diff --git a/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj b/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj index 6f57909..04d311d 100644 --- a/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj +++ b/DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj @@ -1,9 +1,6 @@ - - ghcr.io/lancemccarthy/aspirebase:8.0 - lancemccarthy/aspireapiservice - ghcr.io + Exe net8.0 enable @@ -29,5 +26,4 @@ PreserveNewest - From ca1dcb305e3574f1570a6cd5d441f0e6f11a132c Mon Sep 17 00:00:00 2001 From: Lance McCarthy Date: Wed, 8 May 2024 13:44:25 -0400 Subject: [PATCH 6/6] Update deploy.yml revert test --- .github/workflows/deploy.yml | 93 +++++++++++++++++------------------- 1 file changed, 45 insertions(+), 48 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 72dc073..5a766d3 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -11,40 +11,39 @@ on: - 'DevCraftAspire.Web/**/*' jobs: - # Build a custom base image with needed Linux dependencies installed (being done on a weekly schedule now) - # COMMENTED TEMPORARILY FOR TEST - # update_base_image: - # runs-on: ubuntu-latest - # permissions: - # contents: read - # packages: write - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 + # Build a custom base image with needed Linux dependencies preinstalled + update_base_image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - # - name: Set up QEMU - # uses: docker/setup-qemu-action@v3 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - # - name: Set up Docker Buildx - # uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - # - name: Login to ghcr.io - # uses: docker/login-action@v3 - # with: - # registry: ghcr.io - # username: ${{github.actor}} - # password: ${{secrets.GITHUB_TOKEN}} + - name: Login to ghcr.io + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{github.actor}} + password: ${{secrets.GITHUB_TOKEN}} - # - name: Build and push to Github image repository - # uses: docker/build-push-action@v5 - # with: - # context: '.dockerbuilds/baseimage' - # platforms: linux/arm64,linux/amd64 - # push: true - # tags: | - # "ghcr.io/lancemccarthy/aspirebase:8.0" + - name: Build and push to Github image repository + uses: docker/build-push-action@v5 + with: + context: '.dockerbuilds/baseimage' + platforms: linux/arm64,linux/amd64 + push: true + tags: | + "ghcr.io/lancemccarthy/aspirebase:8.0" # Once new base image is published, we can build the .NET Aspire projects # - The ApiService project needs the custom base image, defined as ContainerBaseImage in the csproj @@ -78,29 +77,27 @@ jobs: username: ${{github.actor}} password: ${{secrets.GITHUB_TOKEN}} - # - name: Update NuGet Package Sources - # run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --configfile ${{env.NUGET_CONF_PATH}} --store-password-in-clear-text + - name: Update NuGet Package Sources + run: dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --store-password-in-clear-text - name: Install .NET Aspire workload run: dotnet workload install aspire --ignore-failed-sources - - name: Isolated build test - run: | - dotnet nuget update source "TelerikServer" -s "https://nuget.telerik.com/v3/index.json" -u 'api-key' -p ${{secrets.TELERIK_NUGET_KEY}} --store-password-in-clear-text - dotnet restore - dotnet build -c Release --no-restore - dotnet publish 'DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj' /t:PublishContainer --no-build --no-restore + # - name: BaseContainerImage Isolated Test + # run: | + # dotnet restore + # dotnet build -c Release --no-restore + # dotnet publish 'DevCraftAspire.ApiService/DevCraftAspire.ApiService.csproj' /t:PublishContainer --no-build --no-restore - # COMMENTED TEMPORARILY FOR TEST - # - name: Install azd - # uses: Azure/setup-azd@v1.0.0 + - name: Install azd + uses: Azure/setup-azd@v1.0.0 - # - name: Log into Azure with GitHub Federated Credentials (OpenID) - # run: azd auth login --client-id "$Env:AZURE_CLIENT_ID" --tenant-id "$Env:AZURE_TENANT_ID" --federated-credential-provider "github" - # shell: pwsh + - name: Log into Azure with GitHub Federated Credentials (OpenID) + run: azd auth login --client-id "${{env.AZURE_CLIENT_ID}}" --tenant-id "${{env.AZURE_TENANT_ID}}" --federated-credential-provider "github" + shell: pwsh - # - name: Provision Infrastructure - # run: azd provision --no-prompt --environment "aspire2b" + - name: Provision Infrastructure + run: azd provision --no-prompt --environment "aspire2b" - # - name: Deploy Application - # run: azd deploy --no-prompt --environment "aspire2b" \ No newline at end of file + - name: Deploy Application + run: azd deploy --no-prompt --environment "aspire2b" \ No newline at end of file