From 9895a2bd4dc7101640fddd014ac14e2a0d790a04 Mon Sep 17 00:00:00 2001 From: Jasper Hedegaard Bojsen Date: Sun, 24 Dec 2023 12:02:40 +0100 Subject: [PATCH 1/4] .NET 8 + script improvements --- .../Saas.Admin.Client.csproj | 4 +- .../Saas.Admin.Service.csproj | 10 ++-- .../Saas.Application.Web.csproj | 10 ++-- .../Saas.IdentityProvider/deployment/run.sh | 8 +-- .../deployment/script/init.sh | 2 +- .../Saas.IdentityProvider/readme.md | 4 +- .../Saas.Permissions.Client.csproj | 2 +- .../Saas.Permissions.Service.csproj | 12 ++--- .../Dockerfile.AppleSilicon | 32 ++++++++++++ src/Saas.Lib/Deployment.Container/build.sh | 49 ++++++++++++++----- .../Saas.Identity/Saas.Identity.csproj | 6 +-- src/Saas.Lib/Saas.Shared/Saas.Shared.csproj | 2 +- .../Saas.SignupAdministration.Web.csproj | 12 ++--- 13 files changed, 107 insertions(+), 46 deletions(-) create mode 100644 src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon diff --git a/src/Saas.Admin/Saas.Admin.Client/Saas.Admin.Client.csproj b/src/Saas.Admin/Saas.Admin.Client/Saas.Admin.Client.csproj index f03f0f1b..6b678fcb 100644 --- a/src/Saas.Admin/Saas.Admin.Client/Saas.Admin.Client.csproj +++ b/src/Saas.Admin/Saas.Admin.Client/Saas.Admin.Client.csproj @@ -1,14 +1,14 @@ - net7.0 + net8.0 enable enable Debug;Release;Multi Debug - + diff --git a/src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj b/src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj index fda2d956..87aa1516 100644 --- a/src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj +++ b/src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable aspnet-Saas.Admin.Service-5358E0C3-EA51-44EA-B381-CA2F9D9710D3 @@ -11,11 +11,11 @@ - + - - - + + + diff --git a/src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj b/src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj index e9d4abe0..ab4fe39b 100644 --- a/src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj +++ b/src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable a45ad9f7-37e3-4dc7-bf2c-9f1f3e449cba @@ -9,10 +9,10 @@ - - - - + + + + diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh index 1395e0b3..2e3832c7 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh @@ -25,11 +25,13 @@ docker run \ --volume "${repo_base}/src/Saas.Lib/Deployment.Script.Modules":/asdk/src/Saas.Lib/Deployment.Script.Modules:ro \ --volume "${repo_base}/src/Saas.Lib/Saas.Bicep.Module":/asdk/src/Saas.Lib/Saas.Bicep.Module:ro \ --volume "${repo_base}/.git/":/asdk/.git:ro \ - --volume "${HOME}/.azure/":/asdk/.azure:ro \ + --volume "${HOME}/.azure/msal_token_cache.json":/root/.azure/msal_token_cache.json:ro \ + --volume "${HOME}/.azure/azureProfile.json":/root/.azure/azureProfile.json:ro \ --volume "${HOME}/asdk/.cache/":/asdk/.cache \ --env "ASDK_DEPLOYMENT_SCRIPT_PROJECT_BASE=/asdk/src/Saas.Identity/Saas.IdentityProvider/deployment" \ --env "GIT_REPO_ORIGIN=${git_repo_origin}" \ --env "GIT_ORG_PROJECT_NAME=${git_org_project_name}" \ --env "GITHUB_AUTH_TOKEN=${gh_auth_token}" \ - asdk-script-deployment:latest \ - bash /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh + --platform linux/amd64 \ + asdk-script-deployment:latest +# bash /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/init.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/init.sh index d155c3d0..2b20dceb 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/init.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/init.sh @@ -20,7 +20,7 @@ function check-prerequisites() { --header "Checking prerequisites" what_os="$(get-os)" || - echo "Unsupported OS: ${what_os}. This script support linux and macos." | + echo "Unsupported OS: ${what_os}. This script support linux (WSL 2.0 on Windows) and MacOS." | log-output \ --level error \ --header "Critical Error" || diff --git a/src/Saas.Identity/Saas.IdentityProvider/readme.md b/src/Saas.Identity/Saas.IdentityProvider/readme.md index edc749ee..d922f91b 100644 --- a/src/Saas.Identity/Saas.IdentityProvider/readme.md +++ b/src/Saas.Identity/Saas.IdentityProvider/readme.md @@ -20,7 +20,7 @@ For more details please read the [FAQ](./faq.md): Running the deployment script requires utilizing a container and Docker. -### Prerequisites +### Prerequisites The following platforms are supported: @@ -85,6 +85,8 @@ To run the script you must first setup of the deployment environment and build t ./setup.sh ``` +> *Tip#1: On MacOS, you may need to run `chmod +x setup.sh` first, to make the script executable.* + ![Screenshot of a Linux console window after initial setup.sh execution](.assets/readme/image-20230221115203497-1683889385776-2.png) This will take a few minutes to complete and you will only need to do it once. The container will be named `asdk-script-deployment`. diff --git a/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Client/Saas.Permissions.Client.csproj b/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Client/Saas.Permissions.Client.csproj index a338e185..6959a63c 100644 --- a/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Client/Saas.Permissions.Client.csproj +++ b/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Client/Saas.Permissions.Client.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable Debug;Release;Multi Debug diff --git a/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj b/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj index 41b82966..21a58ef9 100644 --- a/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj +++ b/src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable 2f007af4-43b5-4316-903b-03340f0999e4 @@ -16,11 +16,11 @@ - - - - - + + + + + diff --git a/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon new file mode 100644 index 00000000..40928647 --- /dev/null +++ b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon @@ -0,0 +1,32 @@ +FROM --platform=linux/amd64 ubuntu:22.04 + +RUN apt-get update && apt-get install -y \ + curl \ + dnsutils \ + python3-pip \ + jq \ + sudo \ + libicu-dev \ + uuid-runtime \ + zip \ + dos2unix \ + python3-ruamel.yaml \ + && curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash + +# Install latest GitHub cli (gh) +# https://github.com/cli/cli/blob/trunk/docs/install_linux.md +RUN curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg \ + && sudo chmod go+r /usr/share/keyrings/githubcli-archive-keyring.gpg \ + && echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null \ + && sudo apt update \ + && sudo apt install gh -y + +RUN pip3 install PyYaml + +# Install Azure Cli extension 'Storage-preview' +# RUN az extension add --name storage-preview + +WORKDIR /asdk + +# trust repository in container +RUN git config --global --add safe.directory /asdk \ No newline at end of file diff --git a/src/Saas.Lib/Deployment.Container/build.sh b/src/Saas.Lib/Deployment.Container/build.sh index 53859c87..b1ff0ff6 100755 --- a/src/Saas.Lib/Deployment.Container/build.sh +++ b/src/Saas.Lib/Deployment.Container/build.sh @@ -1,33 +1,58 @@ #!/usr/bin/env bash +# shellcheck disable=SC1091 +source "./constants.sh" +source "$SHARED_MODULE_DIR/util-module.sh" + force_update=false -while getopts f flag -do +while getopts f flag; do case "${flag}" in - f) force_update=true;; - *) force_update=false;; + f) force_update=true ;; + *) force_update=false ;; esac done -repo_base="$( git rev-parse --show-toplevel )" +repo_base="$(git rev-parse --show-toplevel)" docker_file_folder="${repo_base}/src/Saas.Lib/Deployment.Container" -architecture="$( uname -a )" +architecture="$(uname -a)" + +what_os="$(get-os)" || + echo "Unsupported OS: ${what_os}. This script support linux (ubxl.WSL 2.0 on Windows) and MacOS." | + log-output \ + --level error \ + --header "Critical Error" || + exit 1 -if [[ "${force_update}" == false ]]; then +if [[ "${force_update}" == false ]]; then if [[ "${architecture}" == *"ARM64"* ]]; then - echo "Building for ARM64 (including Apple Sillicon)..." - docker build --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest . + if [[ "${what_os}" == "linux" ]]; then + echo "Building for Linux on Arm)..." + docker build --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest . + elif [[ "${what_os}" == "macos" ]]; then + echo "Building for MacOS on Apple Silicon" + docker build --file "${docker_file_folder}/Dockerfile.AppleSilicon" --tag asdk-script-deployment:latest . + else + exit 1 + fi else + echo "Building for Linux (incl. WSL 2.0 on Windows) on x86_64)..." docker build --file "${docker_file_folder}/Dockerfile" --tag asdk-script-deployment:latest . fi else if [[ "${architecture}" == *"ARM64"* ]]; then - echo "Building for ARM64 (including Apple Sillicon)..." - docker build --no-cache --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest . + if [[ "${what_os}" == "linux" ]]; then + echo "Force building for Linux on Arm)..." + docker build --no-cache --file "${docker_file_folder}/Dockerfile.ARM" --tag asdk-script-deployment:latest . + elif [[ "${what_os}" == "macos" ]]; then + echo "Force building for MacOS on Apple Silicon" + docker build --no-cache --file "${docker_file_folder}/Dockerfile.AppleSilicon" --tag asdk-script-deployment:latest . + else + exit 1 + fi else + echo "Force building for Linux (incl. WSL 2.0 on Windows) on x86_64)..." docker build --no-cache --file "${docker_file_folder}/Dockerfile" --tag asdk-script-deployment:latest . fi fi - diff --git a/src/Saas.Lib/Saas.Identity/Saas.Identity.csproj b/src/Saas.Lib/Saas.Identity/Saas.Identity.csproj index 7dec3667..50d011d2 100644 --- a/src/Saas.Lib/Saas.Identity/Saas.Identity.csproj +++ b/src/Saas.Lib/Saas.Identity/Saas.Identity.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 enable enable Debug;Release;Multi Debug @@ -9,8 +9,8 @@ - - + + diff --git a/src/Saas.Lib/Saas.Shared/Saas.Shared.csproj b/src/Saas.Lib/Saas.Shared/Saas.Shared.csproj index 19bc24b9..ce8a2293 100644 --- a/src/Saas.Lib/Saas.Shared/Saas.Shared.csproj +++ b/src/Saas.Lib/Saas.Shared/Saas.Shared.csproj @@ -1,7 +1,7 @@ - net7.0 + net8.0 enable enable Debug;Release;Multi Debug diff --git a/src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj b/src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj index 8232f888..d9655c53 100644 --- a/src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj +++ b/src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj @@ -1,7 +1,7 @@  - net7.0 + net8.0 false 7b599cf5-3102-4740-ab34-69dd240f9ea3 /subscriptions/357c83c2-bed7-4fe7-af6a-95835c6e2d91/resourceGroups/rg-saas-dev-001/providers/microsoft.insights/components/app-provider-dev-001 @@ -17,12 +17,12 @@ - + - - - - + + + + From e5498c64243acb4f412c56f9f06301b9bb52aab6 Mon Sep 17 00:00:00 2001 From: Jasper Hedegaard Bojsen Date: Sun, 24 Dec 2023 13:06:28 +0100 Subject: [PATCH 2/4] Edit run --- src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh index 2e3832c7..1919f0c9 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh @@ -33,5 +33,5 @@ docker run \ --env "GIT_ORG_PROJECT_NAME=${git_org_project_name}" \ --env "GITHUB_AUTH_TOKEN=${gh_auth_token}" \ --platform linux/amd64 \ - asdk-script-deployment:latest -# bash /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh + asdk-script-deployment:latest \ +bash # /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh From a1cbaa44619087bd01a0c66aceb112968a8c1d4a Mon Sep 17 00:00:00 2001 From: Jasper Hedegaard Bojsen Date: Tue, 26 Dec 2023 08:47:19 +0100 Subject: [PATCH 3/4] .net 8 - Apple Silicon - Fixes --- .github/workflows/admin-service-api-deploy.yml | 4 ++-- .github/workflows/permissions-api-deploy.yml | 4 ++-- .github/workflows/saas-app-deploy.yml | 4 ++-- .github/workflows/signup-administration-deploy.yml | 4 ++-- src/Saas.Admin/deployment/act/deploy.sh | 1 + .../act/workflows/admin-service-api-deploy-debug.yml | 4 ++-- src/Saas.Admin/deployment/run.sh | 1 + src/Saas.Application/deployment/act/deploy.sh | 1 + .../deployment/act/workflows/saas-app-deploy-debug.yml | 4 ++-- src/Saas.Application/deployment/run.sh | 1 + .../Saas.IdentityProvider/deployment/bicep/.gitignore | 1 + .../Saas.IdentityProvider/deployment/run.sh | 7 +++---- .../deployment/script/config-b2c.sh | 2 +- .../Saas.Permissions/deployment/act/deploy.sh | 1 + .../act/workflows/permissions-api-deploy-debug.yml | 4 ++-- src/Saas.Identity/Saas.Permissions/deployment/run.sh | 1 + src/Saas.Lib/Act.Container/build.sh | 1 + .../Deployment.Container/Dockerfile.AppleSilicon | 4 ++++ .../Deployment.Script.Modules/deploy-app-service.sh | 6 ++++-- .../Deployment.Script.Modules/deploy-config-entries.sh | 6 ++++-- .../Deployment.Script.Modules/deploy-service-module.sh | 10 +++++++++- src/Saas.SignupAdministration/deployment/act/deploy.sh | 1 + .../workflows/signup-administration-deploy-debug.yml | 4 ++-- src/Saas.SignupAdministration/deployment/run.sh | 1 + 24 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore diff --git a/.github/workflows/admin-service-api-deploy.yml b/.github/workflows/admin-service-api-deploy.yml index b96dc319..84d2522a 100644 --- a/.github/workflows/admin-service-api-deploy.yml +++ b/.github/workflows/admin-service-api-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'admin-api-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'admin-api-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service PROJECT_PATH: ./src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj OUTPUT_PATH: ./publish/admin-api diff --git a/.github/workflows/permissions-api-deploy.yml b/.github/workflows/permissions-api-deploy.yml index 6759674d..8d483d1c 100644 --- a/.github/workflows/permissions-api-deploy.yml +++ b/.github/workflows/permissions-api-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'api-permission-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'api-permission-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1 PROJECT_PATH: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj OUTPUT_PATH: ./publish/api-permission diff --git a/.github/workflows/saas-app-deploy.yml b/.github/workflows/saas-app-deploy.yml index 1e09c7ef..be291c78 100644 --- a/.github/workflows/saas-app-deploy.yml +++ b/.github/workflows/saas-app-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'saas-app-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'saas-app-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web PROJECT_PATH: ./src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj OUTPUT_PATH: ./publish/saas-app diff --git a/.github/workflows/signup-administration-deploy.yml b/.github/workflows/signup-administration-deploy.yml index 652aa0ae..6973c697 100644 --- a/.github/workflows/signup-administration-deploy.yml +++ b/.github/workflows/signup-administration-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web PROJECT_PATH: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj OUTPUT_PATH: ./publish/signupadmin diff --git a/src/Saas.Admin/deployment/act/deploy.sh b/src/Saas.Admin/deployment/act/deploy.sh index 4e4a5bc8..3752421e 100755 --- a/src/Saas.Admin/deployment/act/deploy.sh +++ b/src/Saas.Admin/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml b/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml index 25b875d6..77c50bc7 100644 --- a/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml +++ b/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: admin-api - AZURE_WEBAPP_NAME: admin-api-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: admin-api-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Admin.Service.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Admin/deployment/run.sh b/src/Saas.Admin/deployment/run.sh index 3638c2cb..ab784093 100755 --- a/src/Saas.Admin/deployment/run.sh +++ b/src/Saas.Admin/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Application/deployment/act/deploy.sh b/src/Saas.Application/deployment/act/deploy.sh index a1ce1b81..de9e2cf1 100755 --- a/src/Saas.Application/deployment/act/deploy.sh +++ b/src/Saas.Application/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml b/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml index 9b8df7fb..32a64dd4 100644 --- a/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml +++ b/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: saas-app - AZURE_WEBAPP_NAME: saas-app-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: saas-app-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Application.Web.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Application/deployment/run.sh b/src/Saas.Application/deployment/run.sh index c4c8578c..d888fb72 100755 --- a/src/Saas.Application/deployment/run.sh +++ b/src/Saas.Application/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore b/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore new file mode 100644 index 00000000..fcad9c43 --- /dev/null +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore @@ -0,0 +1 @@ +deployStorage.json \ No newline at end of file diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh index 1919f0c9..7740900c 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh @@ -15,6 +15,7 @@ fi # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ @@ -25,13 +26,11 @@ docker run \ --volume "${repo_base}/src/Saas.Lib/Deployment.Script.Modules":/asdk/src/Saas.Lib/Deployment.Script.Modules:ro \ --volume "${repo_base}/src/Saas.Lib/Saas.Bicep.Module":/asdk/src/Saas.Lib/Saas.Bicep.Module:ro \ --volume "${repo_base}/.git/":/asdk/.git:ro \ - --volume "${HOME}/.azure/msal_token_cache.json":/root/.azure/msal_token_cache.json:ro \ - --volume "${HOME}/.azure/azureProfile.json":/root/.azure/azureProfile.json:ro \ + --volume "${HOME}/.azure/":/asdk/.azure:ro \ --volume "${HOME}/asdk/.cache/":/asdk/.cache \ --env "ASDK_DEPLOYMENT_SCRIPT_PROJECT_BASE=/asdk/src/Saas.Identity/Saas.IdentityProvider/deployment" \ --env "GIT_REPO_ORIGIN=${git_repo_origin}" \ --env "GIT_ORG_PROJECT_NAME=${git_org_project_name}" \ --env "GITHUB_AUTH_TOKEN=${gh_auth_token}" \ - --platform linux/amd64 \ asdk-script-deployment:latest \ -bash # /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh + bash /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh index 82af94fe..694638ec 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh @@ -46,7 +46,7 @@ for app in "${app_reg_array[@]}"; do if [[ "${has_secret}" == true || "${has_secret}" == "true" ]]; then app_name=$(jq --raw-output '.name' <<<"${app}") - secret_path=$(jq --raw-output '.secretPath' <<<"${app}") + secret_path=$(jq --raw-output '.secretPath' <<< "${app}") if [[ -s "${secret_path}" ]]; then diff --git a/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh b/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh index be7ba9b1..183628b8 100755 --- a/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh +++ b/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml b/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml index 986c72e5..b7057b49 100644 --- a/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml +++ b/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: permissions-api - AZURE_WEBAPP_NAME: api-permission-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: api-permission-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1 PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Permissions.Service.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Identity/Saas.Permissions/deployment/run.sh b/src/Saas.Identity/Saas.Permissions/deployment/run.sh index c2cdaf82..00578687 100755 --- a/src/Saas.Identity/Saas.Permissions/deployment/run.sh +++ b/src/Saas.Identity/Saas.Permissions/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Lib/Act.Container/build.sh b/src/Saas.Lib/Act.Container/build.sh index 8633be89..f57644f8 100755 --- a/src/Saas.Lib/Act.Container/build.sh +++ b/src/Saas.Lib/Act.Container/build.sh @@ -26,3 +26,4 @@ else docker build --no-cache --file "${ACT_CONTAINER_DIR}/Dockerfile" --tag "${tag_name}" . fi +gh extension install https://github.com/nektos/gh-act diff --git a/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon index 40928647..d90ec67e 100644 --- a/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon +++ b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon @@ -28,5 +28,9 @@ RUN pip3 install PyYaml WORKDIR /asdk +# Workaround for the dotnet 7 execution with rosetta2 emulation +# https://github.com/Azure/bicep/issues/10245#issuecomment-1816816017 +ENV DOTNET_EnableWriteXorExecute=0 + # trust repository in container RUN git config --global --add safe.directory /asdk \ No newline at end of file diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh index 3df07190..979b1184 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh @@ -15,15 +15,17 @@ prepare-parameters-file "${BICEP_PARAMETERS_TEMPLATE_FILE}" "${BICEP_APP_SERVICE resource_group="$(get-value ".deployment.resourceGroup.name")" identity_foundation_deployment_name="$(get-value ".deployment.identityFoundation.name")" +subscriptionId="$(get-value ".initConfig.subscriptionId")" -echo "Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | +echo "Deploying App Service: Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | log-output \ --level info get-identity-foundation-deployment-outputs \ "${resource_group}" \ "${identity_foundation_deployment_name}" \ - "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" + "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" \ + "${subscriptionId}" echo "Mapping '${APP_NAME}' parameters..." | log-output \ diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh index f49d3d46..d98bd6c3 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh @@ -15,15 +15,17 @@ prepare-parameters-file "${BICEP_PARAMETERS_TEMPLATE_FILE}" "${BICEP_CONFIG_ENTR resource_group="$(get-value ".deployment.resourceGroup.name")" identity_foundation_deployment_name="$(get-value ".deployment.identityFoundation.name")" +subscriptionId="$(get-value ".initConfig.subscriptionId")" -echo "Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | +echo "Deploying Config Entries: Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | log-output \ --level info get-identity-foundation-deployment-outputs \ "${resource_group}" \ "${identity_foundation_deployment_name}" \ - "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" + "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" \ + "${subscriptionId}" echo "Provisioning the ${APP_NAME} Configuration Entries." | log-output \ diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh index a8fa6179..065f7e8c 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh @@ -17,7 +17,7 @@ function deploy-service() { --name "${deployment_name}" \ --template-file "${template_file}" \ --parameters "${parameters_file}" \ - || echo "Failed to deploy to ${APP_NAME}. This sometimes happens for no apperent reason. Please try again." \ + || echo "Failed to deploy to ${APP_NAME}. This sometimes happens, please try again." \ | log-output \ --level error \ --header "Critical Error" \ @@ -28,6 +28,14 @@ function get-identity-foundation-deployment-outputs() { local resource_group="$1" local deployment_name="$2" local output_file="$3" + local subscriptionId="$4" + + az account set --subscription "${subscriptionId}" \ + || echo "Failed to set subscription to ${subscriptionId}" \ + | log-output \ + --level error \ + --header "Critical Error" \ + || exit 1 deployment_output_parameters="$( az deployment group show \ --name "${deployment_name}" \ diff --git a/src/Saas.SignupAdministration/deployment/act/deploy.sh b/src/Saas.SignupAdministration/deployment/act/deploy.sh index 54e4fa80..69c6ff73 100755 --- a/src/Saas.SignupAdministration/deployment/act/deploy.sh +++ b/src/Saas.SignupAdministration/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.SignupAdministration/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml b/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml index f24f15b8..42cc6993 100644 --- a/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml +++ b/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: signupadmin-app - AZURE_WEBAPP_NAME: signupadmin-app-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: signupadmin-app-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.SignupAdministration.Web.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.SignupAdministration/deployment/run.sh b/src/Saas.SignupAdministration/deployment/run.sh index 7d19967b..10528bd0 100755 --- a/src/Saas.SignupAdministration/deployment/run.sh +++ b/src/Saas.SignupAdministration/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.SignupAdministration/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ From 1881b43789fa0abfc33f2ec9c585a25ed3b5ee33 Mon Sep 17 00:00:00 2001 From: Jasper Hedegaard Bojsen Date: Tue, 26 Dec 2023 08:47:19 +0100 Subject: [PATCH 4/4] .net 8 - Apple Silicon - Fixes --- .github/workflows/admin-service-api-deploy.yml | 4 ++-- .github/workflows/permissions-api-deploy.yml | 4 ++-- .github/workflows/saas-app-deploy.yml | 4 ++-- .github/workflows/signup-administration-deploy.yml | 4 ++-- src/Saas.Admin/deployment/act/deploy.sh | 1 + .../act/workflows/admin-service-api-deploy-debug.yml | 4 ++-- src/Saas.Admin/deployment/run.sh | 1 + src/Saas.Application/deployment/act/deploy.sh | 1 + .../deployment/act/workflows/saas-app-deploy-debug.yml | 4 ++-- src/Saas.Application/deployment/run.sh | 1 + .../Saas.IdentityProvider/deployment/bicep/.gitignore | 1 + .../Saas.IdentityProvider/deployment/run.sh | 7 +++---- .../deployment/script/config-b2c.sh | 2 +- .../Saas.Permissions/deployment/act/deploy.sh | 1 + .../act/workflows/permissions-api-deploy-debug.yml | 4 ++-- src/Saas.Identity/Saas.Permissions/deployment/run.sh | 1 + src/Saas.Lib/Act.Container/build.sh | 1 + .../Deployment.Container/Dockerfile.AppleSilicon | 4 ++++ .../Deployment.Script.Modules/deploy-app-service.sh | 6 ++++-- .../Deployment.Script.Modules/deploy-config-entries.sh | 6 ++++-- .../Deployment.Script.Modules/deploy-service-module.sh | 10 +++++++++- src/Saas.SignupAdministration/deployment/act/deploy.sh | 1 + .../workflows/signup-administration-deploy-debug.yml | 4 ++-- src/Saas.SignupAdministration/deployment/run.sh | 1 + 24 files changed, 51 insertions(+), 26 deletions(-) create mode 100644 src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore diff --git a/.github/workflows/admin-service-api-deploy.yml b/.github/workflows/admin-service-api-deploy.yml index b96dc319..84d2522a 100644 --- a/.github/workflows/admin-service-api-deploy.yml +++ b/.github/workflows/admin-service-api-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'admin-api-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'admin-api-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service PROJECT_PATH: ./src/Saas.Admin/Saas.Admin.Service/Saas.Admin.Service.csproj OUTPUT_PATH: ./publish/admin-api diff --git a/.github/workflows/permissions-api-deploy.yml b/.github/workflows/permissions-api-deploy.yml index 6759674d..8d483d1c 100644 --- a/.github/workflows/permissions-api-deploy.yml +++ b/.github/workflows/permissions-api-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'api-permission-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'api-permission-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1 PROJECT_PATH: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1/Saas.Permissions.Service.csproj OUTPUT_PATH: ./publish/api-permission diff --git a/.github/workflows/saas-app-deploy.yml b/.github/workflows/saas-app-deploy.yml index 1e09c7ef..be291c78 100644 --- a/.github/workflows/saas-app-deploy.yml +++ b/.github/workflows/saas-app-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'saas-app-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'saas-app-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web PROJECT_PATH: ./src/Saas.Application/Saas.Application.Web/Saas.Application.Web.csproj OUTPUT_PATH: ./publish/saas-app diff --git a/.github/workflows/signup-administration-deploy.yml b/.github/workflows/signup-administration-deploy.yml index 652aa0ae..6973c697 100644 --- a/.github/workflows/signup-administration-deploy.yml +++ b/.github/workflows/signup-administration-deploy.yml @@ -9,9 +9,9 @@ permissions: contents: read env: - AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-83sx' # set this to your application's name + AZURE_WEBAPP_NAME: 'signupadmin-app-asdk-test-v23y' # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web PROJECT_PATH: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web/Saas.SignupAdministration.Web.csproj OUTPUT_PATH: ./publish/signupadmin diff --git a/src/Saas.Admin/deployment/act/deploy.sh b/src/Saas.Admin/deployment/act/deploy.sh index 4e4a5bc8..3752421e 100755 --- a/src/Saas.Admin/deployment/act/deploy.sh +++ b/src/Saas.Admin/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml b/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml index 25b875d6..77c50bc7 100644 --- a/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml +++ b/src/Saas.Admin/deployment/act/workflows/admin-service-api-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: admin-api - AZURE_WEBAPP_NAME: admin-api-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: admin-api-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Admin/Saas.Admin.Service PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Admin.Service.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Admin/deployment/run.sh b/src/Saas.Admin/deployment/run.sh index 3638c2cb..ab784093 100755 --- a/src/Saas.Admin/deployment/run.sh +++ b/src/Saas.Admin/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Admin/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Application/deployment/act/deploy.sh b/src/Saas.Application/deployment/act/deploy.sh index a1ce1b81..de9e2cf1 100755 --- a/src/Saas.Application/deployment/act/deploy.sh +++ b/src/Saas.Application/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml b/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml index 9b8df7fb..32a64dd4 100644 --- a/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml +++ b/src/Saas.Application/deployment/act/workflows/saas-app-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: saas-app - AZURE_WEBAPP_NAME: saas-app-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: saas-app-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Application/Saas.Application.Web PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Application.Web.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Application/deployment/run.sh b/src/Saas.Application/deployment/run.sh index c4c8578c..d888fb72 100755 --- a/src/Saas.Application/deployment/run.sh +++ b/src/Saas.Application/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Application/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore b/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore new file mode 100644 index 00000000..fcad9c43 --- /dev/null +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/bicep/.gitignore @@ -0,0 +1 @@ +deployStorage.json \ No newline at end of file diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh index 1919f0c9..7740900c 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/run.sh @@ -15,6 +15,7 @@ fi # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ @@ -25,13 +26,11 @@ docker run \ --volume "${repo_base}/src/Saas.Lib/Deployment.Script.Modules":/asdk/src/Saas.Lib/Deployment.Script.Modules:ro \ --volume "${repo_base}/src/Saas.Lib/Saas.Bicep.Module":/asdk/src/Saas.Lib/Saas.Bicep.Module:ro \ --volume "${repo_base}/.git/":/asdk/.git:ro \ - --volume "${HOME}/.azure/msal_token_cache.json":/root/.azure/msal_token_cache.json:ro \ - --volume "${HOME}/.azure/azureProfile.json":/root/.azure/azureProfile.json:ro \ + --volume "${HOME}/.azure/":/asdk/.azure:ro \ --volume "${HOME}/asdk/.cache/":/asdk/.cache \ --env "ASDK_DEPLOYMENT_SCRIPT_PROJECT_BASE=/asdk/src/Saas.Identity/Saas.IdentityProvider/deployment" \ --env "GIT_REPO_ORIGIN=${git_repo_origin}" \ --env "GIT_ORG_PROJECT_NAME=${git_org_project_name}" \ --env "GITHUB_AUTH_TOKEN=${gh_auth_token}" \ - --platform linux/amd64 \ asdk-script-deployment:latest \ -bash # /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh + bash /asdk/src/Saas.Identity/Saas.IdentityProvider/deployment/start.sh diff --git a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh index 82af94fe..694638ec 100755 --- a/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh +++ b/src/Saas.Identity/Saas.IdentityProvider/deployment/script/config-b2c.sh @@ -46,7 +46,7 @@ for app in "${app_reg_array[@]}"; do if [[ "${has_secret}" == true || "${has_secret}" == "true" ]]; then app_name=$(jq --raw-output '.name' <<<"${app}") - secret_path=$(jq --raw-output '.secretPath' <<<"${app}") + secret_path=$(jq --raw-output '.secretPath' <<< "${app}") if [[ -s "${secret_path}" ]]; then diff --git a/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh b/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh index be7ba9b1..183628b8 100755 --- a/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh +++ b/src/Saas.Identity/Saas.Permissions/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml b/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml index 986c72e5..b7057b49 100644 --- a/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml +++ b/src/Saas.Identity/Saas.Permissions/deployment/act/workflows/permissions-api-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: permissions-api - AZURE_WEBAPP_NAME: api-permission-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: api-permission-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: "." # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.Identity/Saas.Permissions/Saas.Permissions.Service_v1.1 PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.Permissions.Service.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.Identity/Saas.Permissions/deployment/run.sh b/src/Saas.Identity/Saas.Permissions/deployment/run.sh index c2cdaf82..00578687 100755 --- a/src/Saas.Identity/Saas.Permissions/deployment/run.sh +++ b/src/Saas.Identity/Saas.Permissions/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.Identity/Saas.Permissions/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.Lib/Act.Container/build.sh b/src/Saas.Lib/Act.Container/build.sh index 8633be89..f57644f8 100755 --- a/src/Saas.Lib/Act.Container/build.sh +++ b/src/Saas.Lib/Act.Container/build.sh @@ -26,3 +26,4 @@ else docker build --no-cache --file "${ACT_CONTAINER_DIR}/Dockerfile" --tag "${tag_name}" . fi +gh extension install https://github.com/nektos/gh-act diff --git a/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon index 40928647..d90ec67e 100644 --- a/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon +++ b/src/Saas.Lib/Deployment.Container/Dockerfile.AppleSilicon @@ -28,5 +28,9 @@ RUN pip3 install PyYaml WORKDIR /asdk +# Workaround for the dotnet 7 execution with rosetta2 emulation +# https://github.com/Azure/bicep/issues/10245#issuecomment-1816816017 +ENV DOTNET_EnableWriteXorExecute=0 + # trust repository in container RUN git config --global --add safe.directory /asdk \ No newline at end of file diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh index 3df07190..979b1184 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-app-service.sh @@ -15,15 +15,17 @@ prepare-parameters-file "${BICEP_PARAMETERS_TEMPLATE_FILE}" "${BICEP_APP_SERVICE resource_group="$(get-value ".deployment.resourceGroup.name")" identity_foundation_deployment_name="$(get-value ".deployment.identityFoundation.name")" +subscriptionId="$(get-value ".initConfig.subscriptionId")" -echo "Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | +echo "Deploying App Service: Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | log-output \ --level info get-identity-foundation-deployment-outputs \ "${resource_group}" \ "${identity_foundation_deployment_name}" \ - "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" + "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" \ + "${subscriptionId}" echo "Mapping '${APP_NAME}' parameters..." | log-output \ diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh index f49d3d46..d98bd6c3 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-config-entries.sh @@ -15,15 +15,17 @@ prepare-parameters-file "${BICEP_PARAMETERS_TEMPLATE_FILE}" "${BICEP_CONFIG_ENTR resource_group="$(get-value ".deployment.resourceGroup.name")" identity_foundation_deployment_name="$(get-value ".deployment.identityFoundation.name")" +subscriptionId="$(get-value ".initConfig.subscriptionId")" -echo "Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | +echo "Deploying Config Entries: Downloading Identity Foundation outputs from Resource Group '${resource_group}' deployment named '${identity_foundation_deployment_name}'..." | log-output \ --level info get-identity-foundation-deployment-outputs \ "${resource_group}" \ "${identity_foundation_deployment_name}" \ - "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" + "${BICEP_IDENTITY_FOUNDATION_OUTPUT_FILE}" \ + "${subscriptionId}" echo "Provisioning the ${APP_NAME} Configuration Entries." | log-output \ diff --git a/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh b/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh index a8fa6179..065f7e8c 100755 --- a/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh +++ b/src/Saas.Lib/Deployment.Script.Modules/deploy-service-module.sh @@ -17,7 +17,7 @@ function deploy-service() { --name "${deployment_name}" \ --template-file "${template_file}" \ --parameters "${parameters_file}" \ - || echo "Failed to deploy to ${APP_NAME}. This sometimes happens for no apperent reason. Please try again." \ + || echo "Failed to deploy to ${APP_NAME}. This sometimes happens, please try again." \ | log-output \ --level error \ --header "Critical Error" \ @@ -28,6 +28,14 @@ function get-identity-foundation-deployment-outputs() { local resource_group="$1" local deployment_name="$2" local output_file="$3" + local subscriptionId="$4" + + az account set --subscription "${subscriptionId}" \ + || echo "Failed to set subscription to ${subscriptionId}" \ + | log-output \ + --level error \ + --header "Critical Error" \ + || exit 1 deployment_output_parameters="$( az deployment group show \ --name "${deployment_name}" \ diff --git a/src/Saas.SignupAdministration/deployment/act/deploy.sh b/src/Saas.SignupAdministration/deployment/act/deploy.sh index 54e4fa80..69c6ff73 100755 --- a/src/Saas.SignupAdministration/deployment/act/deploy.sh +++ b/src/Saas.SignupAdministration/deployment/act/deploy.sh @@ -17,6 +17,7 @@ container_deployment_dir="/asdk/src/Saas.SignupAdministration/deployment" # running the './act/script/patch-app-name.sh' script using our ASDK deployment script container - i.e., not the act container docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \ diff --git a/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml b/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml index f24f15b8..42cc6993 100644 --- a/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml +++ b/src/Saas.SignupAdministration/deployment/act/workflows/signup-administration-deploy-debug.yml @@ -10,9 +10,9 @@ permissions: env: APP_NAME: signupadmin-app - AZURE_WEBAPP_NAME: signupadmin-app-asdk-test-83sx # set this to your application's name + AZURE_WEBAPP_NAME: signupadmin-app-asdk-test-v23y # set this to your application's name AZURE_WEBAPP_PACKAGE_PATH: . # set this to the path to your web app project, defaults to the repository root - DOTNET_VERSION: 7.x.x + DOTNET_VERSION: 8.x.x PROJECT_DIR: ./src/Saas.SignupAdministration/Saas.SignupAdministration.Web PROJECT_PATH: ${{ env.PROJECT_DIR }}/Saas.SignupAdministration.Web.csproj PUBLISH_PATH: ./publish diff --git a/src/Saas.SignupAdministration/deployment/run.sh b/src/Saas.SignupAdministration/deployment/run.sh index 7d19967b..10528bd0 100755 --- a/src/Saas.SignupAdministration/deployment/run.sh +++ b/src/Saas.SignupAdministration/deployment/run.sh @@ -11,6 +11,7 @@ container_deployment_dir="/asdk/src/Saas.SignupAdministration/deployment" # using volumes '--volume' to mount only the needed directories to the container. # using ':ro' to make scrip directories etc. read-only. Only config and log directories are writable. docker run \ + --platform linux/amd64 \ --interactive \ --tty \ --rm \