From 10a361c4f7dc03cf41b1c13ca00fcfd9222ef053 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Tue, 7 Nov 2023 09:01:02 -0500 Subject: [PATCH] changes for including arm64 binaries (#290) --- .github/workflows/acr-build-publish.yml | 66 +++ .github/workflows/pr-build.yml | 48 ++ .github/workflows/release.yml | 81 ++- azure-pipelines.yml | 550 +++++++++++++++++- build-pipelines-PR.yml | 111 ++++ build/setup-kubectl.sh | 40 +- deployment/settings/services/imagetag.setting | 6 +- .../settings/setenvironmentvariables.sh | 0 samples/managed-identity/Dockerfile | 15 +- .../KubernetesLocalProcessConfig.yaml | 2 +- samples/managed-identity/deploy-arm.yaml | 73 +++ samples/managed-identity/deploy.yaml | 3 +- samples/managed-identity/roleAssignment.sh | 9 +- samples/todo-app/database-api/Dockerfile | 12 +- samples/todo-app/deployment-arm.yaml | 224 +++++++ samples/todo-app/deployment.yaml | 8 +- samples/todo-app/frontend/Dockerfile | 2 +- samples/todo-app/stats-api/Dockerfile | 2 +- samples/todo-app/stats-worker/Dockerfile | 3 +- .../endpointmanagerlauncher.csproj | 2 +- src/LocalAgent/LocalAgent.csproj | 2 +- src/common/Kubernetes/KubernetesClient.cs | 2 +- src/common/common.csproj | 2 +- src/devhostagent.restorationjob/Dockerfile | 15 +- .../devhostAgent.restorationjob.csproj | 2 +- src/devhostagent/Dockerfile | 11 +- src/devhostagent/devhostAgent.csproj | 2 +- src/dsc/dsc.csproj | 2 +- src/endpointmanager/endpointmanager.csproj | 2 +- src/library/library.csproj | 2 +- src/routingmanager/Constants.cs | 2 +- src/routingmanager/Dockerfile | 14 +- src/routingmanager/routingmanager.csproj | 2 +- src/unittest.sln | 52 ++ 34 files changed, 1252 insertions(+), 117 deletions(-) create mode 100644 .github/workflows/acr-build-publish.yml create mode 100644 .github/workflows/pr-build.yml mode change 100644 => 100755 build/setup-kubectl.sh mode change 100644 => 100755 deployment/settings/setenvironmentvariables.sh create mode 100644 samples/managed-identity/deploy-arm.yaml create mode 100644 samples/todo-app/deployment-arm.yaml create mode 100644 src/unittest.sln diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml new file mode 100644 index 000000000..3b9bbbc5c --- /dev/null +++ b/.github/workflows/acr-build-publish.yml @@ -0,0 +1,66 @@ +name: build and push to acr +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to build' + required: true + default: 'development' + type: choice + options: + - development + - staging + - prod +jobs: + docker: + strategy: + matrix: + include: + - components: devhostagent + imageName: lpkremoteagent + - components: devhostagent.restorationjob + imageName: lpkrestorationjob + - components: routingmanager + imageName: routingmanager + runs-on: ubuntu-latest + environment: ${{ github.event.inputs.environment }} + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: ${{ vars.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + - name: Set telemetry variables + shell: bash + run: | + if [ $GITHUB_REF == "refs/heads/main" ]; then + echo "##vso[task.setvariable variable=TelemetryType]TELEMETRY_PRODUCTION" + else + echo "##vso[task.setvariable variable=TelemetryType]TELEMETRY_DEVELOPMENT" + fi + - name: Set image tags + shell: bash + id: version + run: | + chmod +x ./deployment/settings/setenvironmentvariables.sh + `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` + printenv | grep "MINDARO" + if [ ${{ matrix.components}} == "devhostagent" ]; then + echo "tag=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV + elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then + echo "tag=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV + else + echo "tag=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV + fi + - name: Build and push for ${{ matrix.components }} + uses: docker/build-push-action@v5 + with: + file: src/${{ matrix.components }}/Dockerfile + platforms: linux/arm64,linux/amd64 + push: true + tags: ${{ vars.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 000000000..949277fe4 --- /dev/null +++ b/.github/workflows/pr-build.yml @@ -0,0 +1,48 @@ +name: PR build pipeline +on: [workflow_dispatch] + +jobs: + self-contained: + runs-on: windows-latest + strategy: + matrix: + mode: [osx-x64,linux-x64,win-x64,win-arm64,osx-arm64,linux-arm64] + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 7.0.x + - name: Setup NuGet.exe for use with actions + uses: NuGet/setup-nuget@v1.0.6 + - name: Restore dependencies using Nuget + run: nuget restore src\client.sln -Verbosity Normal -NonInteractive -ConfigFile src/nuget.config + - name: dotnet Publish for ${{ matrix.mode }} + run: dotnet publish src\dsc\dsc.csproj -c Release -r ${{ matrix.mode }} --no-restore --self-contained true --verbosity normal + - name: Build endpointmanagerlauncher + if: ${{ matrix.mode == 'win-x64' || matrix.mode == 'win-arm64'}} + run: dotnet publish src\EndpointManagerLauncher\endpointmanagerlauncher.csproj -r ${{ matrix.mode }} -c Release --no-restore + - name: Run unit test cases + run: | + dotnet restore src\unittest.sln + dotnet test src\unittest.sln -c Release --no-restore --verbosity normal + non-self-contained: + runs-on: windows-latest + strategy: + matrix: + mode: [osx-x64,linux-x64,win-x64,win-arm64,osx-arm64,linux-arm64] + steps: + - uses: actions/checkout@v3 + - name: Setup .NET + uses: actions/setup-dotnet@v2 + with: + dotnet-version: 7.0.x + - name: Setup NuGet.exe for use with actions + uses: NuGet/setup-nuget@v1.0.6 + - name: Restore dependencies using Nuget + run: nuget restore src\client.sln -Verbosity Normal -NonInteractive -ConfigFile src/nuget.config + - name: dotnet Publish for ${{ matrix.mode }} + run: dotnet publish src\dsc\dsc.csproj -c Release -r ${{ matrix.mode }} --no-restore --self-contained false --verbosity normal + - name: Build endpointmanagerlauncher + if: ${{ matrix.mode == 'win-x64' || matrix.mode == 'win-arm64'}} + run: dotnet publish src\EndpointManagerLauncher\endpointmanagerlauncher.csproj -r ${{ matrix.mode }} -c Release --no-restore diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 253ad41a1..44716f7ca 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,26 @@ jobs: runs-on: windows-latest strategy: matrix: - mode: [osx-x64,linux-x64,win-x64] + mode: [osx-x64,linux-x64,win-x64,win-arm64,osx-arm64,linux-arm64] + include: + - mode: osx-x64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl' + kubectlPath: 'osx\kubectl' + - mode: linux-x64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl' + kubectlPath: 'linux\kubectl' + - mode: win-x64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe' + kubectlPath: 'win\kubectl.exe' + - mode: win-arm64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/kubectl.exe' + kubectlPath: 'win\kubectl.exe' + - mode: osx-arm64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl' + kubectlPath: 'osx\kubectl' + - mode: linux-arm64 + kubectlUrl: 'https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl' + kubectlPath: 'linux\kubectl' steps: - uses: actions/checkout@v3 - name: Setup .NET @@ -20,41 +39,24 @@ jobs: - name: dotnet Publish for ${{ matrix.mode }} run: dotnet publish src\dsc\dsc.csproj -c Release -r ${{ matrix.mode }} --no-restore --self-contained true --verbosity normal - name: Build endpointmanagerlauncher - run: dotnet publish src\EndpointManagerLauncher\endpointmanagerlauncher.csproj -r win-x64 -c Release --no-restore + if: ${{ matrix.mode == 'win-x64' || matrix.mode == 'win-arm64'}} + run: dotnet publish src\EndpointManagerLauncher\endpointmanagerlauncher.csproj -r ${{ matrix.mode }} -c Release --no-restore - name: Copy endpointmanagerlauncher uses: Azure/powershell@v1 - if: ${{ matrix.mode == 'win-x64' }} + if: ${{ matrix.mode == 'win-x64' || matrix.mode == 'win-arm64'}} with: inlineScript: | - Copy-Item -Path ${{ github.workspace }}\src\EndpointManagerLauncher\bin\Release\net7.0\win-x64\publish\ -Destination ${{ github.workspace }}\src\dsc\bin\Release\net7.0\win-x64\publish\EndpointManagerLauncher -Recurse -Exclude **/*.pdb + Copy-Item -Path ${{ github.workspace }}\src\EndpointManagerLauncher\bin\Release\net7.0\${{ matrix.mode }}\publish\ -Destination ${{ github.workspace }}\src\dsc\bin\Release\net7.0\${{ matrix.mode }}\publish\EndpointManagerLauncher -Recurse -Exclude **/*.pdb azPSVersion: '3.1.0' - name: Download Kubectl uses: Azure/powershell@v1 with: inlineScript: | - if ('${{ matrix.mode }}' -eq 'win-x64') { - $url = 'https://storage.googleapis.com/kubernetes-release/release/v1.21.2/bin/windows/amd64/kubectl.exe' - $dir = 'win' - $file = 'kubectl.exe' - } elseif ('${{ matrix.mode }}' -eq 'osx-x64') { - $url = 'https://storage.googleapis.com/kubernetes-release/release/v1.21.2/bin/darwin/amd64/kubectl' - $dir = 'osx' - $file = 'kubectl' - } else { - $url = 'https://storage.googleapis.com/kubernetes-release/release/v1.21.2/bin/linux/amd64/kubectl' - $dir = 'linux' - $file = 'kubectl' - } - Write-Output "url is: "$url - Write-Output "directory is: "$dir - Write-Output "file is: "$file New-Item -Path '${{ github.workspace }}\src\dsc\bin\Release\net7.0\${{ matrix.mode }}\publish\kubectl' -ItemType Directory - $filePath = '${{ github.workspace }}\src\dsc\bin\Release\net7.0\${{ matrix.mode }}\publish\kubectl\'+$dir - Write-Output "file path is: "$filePath - New-Item -Path $filePath -ItemType Directory - $fileName = $filePath + '\' + $file - Write-Output "file name is: "$fileName - curl.exe $url -o $fileName + $kubectlPath = '${{ github.workspace }}\src\dsc\bin\Release\net7.0\${{ matrix.mode }}\publish\kubectl\${{ matrix.kubectlPath }}' + $kubectlDir = Split-Path $kubectlPath + New-Item -Path $kubectlDir -ItemType Directory + curl.exe $url -o $kubectlPath azPSVersion: '3.1.0' - name: Create .Zip files (${{ matrix.mode }}) uses: TheDoctor0/zip-release@0.6.2 @@ -99,6 +101,15 @@ jobs: asset_path: ${{ github.workspace }}/lpk-win-x64/lpk-win-x64.zip asset_name: lpk-win.zip asset_content_type: application/zip + - name: Upload Window ARM64 Release Assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/lpk-win-arm64/lpk-win-arm64.zip + asset_name: lpk-win-arm64.zip + asset_content_type: application/zip - name: Upload Linux Release Assets uses: actions/upload-release-asset@v1 env: @@ -108,6 +119,15 @@ jobs: asset_path: ${{ github.workspace }}/lpk-linux-x64/lpk-linux-x64.zip asset_name: lpk-linux.zip asset_content_type: application/zip + - name: Upload Linux ARM64 Release Assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/lpk-linux-arm64/lpk-linux-arm64.zip + asset_name: lpk-linux-arm64.zip + asset_content_type: application/zip - name: Upload OSX Release Assets uses: actions/upload-release-asset@v1 env: @@ -117,3 +137,12 @@ jobs: asset_path: ${{ github.workspace }}/lpk-osx-x64/lpk-osx-x64.zip asset_name: lpk-osx.zip asset_content_type: application/zip + - name: Upload OSX ARM64 Release Assets + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + asset_path: ${{ github.workspace }}/lpk-osx-arm64/lpk-osx-arm64.zip + asset_name: lpk-osx-arm64.zip + asset_content_type: application/zip diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d0a1ce0f5..1d1607392 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -112,6 +112,16 @@ jobs: selectOrConfig: config nugetConfigPath: src/nuget.config externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b + - task: DotNetCoreCLI@2 + displayName: restore EndpointManager for arm64 (Windows) (to download runtime pack) + enabled: True + inputs: + command: restore + projects: src\endpointmanager\endpointmanager.csproj + restoreArguments: -r win-arm64 + selectOrConfig: config + nugetConfigPath: src/nuget.config + externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b - task: NuGetToolInstaller@1 name: '' displayName: Use NuGet 5.9.x @@ -189,6 +199,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm 64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish EndpointManagerLauncher(Windows) enabled: True @@ -200,6 +221,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish EndpointManagerLauncher for arm64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\EndpointManagerLauncher\endpointmanagerlauncher.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: CopyFiles@2 displayName: Copy EndpointManager Launcher to dsc folder enabled: True @@ -211,6 +243,17 @@ jobs: !**/*.pdb TargetFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/EndpointManagerLauncher OverWrite: true + - task: CopyFiles@2 + displayName: Copy EndpointManager Launcher to dsc folder for arm 64 + enabled: True + inputs: + SourceFolder: src/EndpointManagerLauncher/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/ + Contents: >- + **/* + + !**/*.pdb + TargetFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/EndpointManagerLauncher + OverWrite: true - task: DotNetCoreCLI@2 displayName: publish DSC (OSX) enabled: True @@ -222,6 +265,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm64 (OSX) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r osx-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish DSC (Linux) enabled: True @@ -233,6 +287,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm64 (Linux) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r linux-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: PowerShell@2 displayName: Download kubectl continueOnError: True @@ -244,21 +309,46 @@ jobs: New-Item -Path './src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/windows/amd64/kubectl.exe -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win/kubectl.exe + curl https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win/kubectl.exe New-Item -Path './src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl' -ItemType Directory New-Item -Path './src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/darwin/amd64/kubectl -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx/kubectl + curl https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx/kubectl New-Item -Path './src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl' -ItemType Directory New-Item -Path './src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/linux/amd64/kubectl -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux/kubectl + curl https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl -OutFile ./src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux/kubectl + - task: PowerShell@2 + displayName: Download kubectl for arm64 + continueOnError: True + inputs: + targetType: inline + script: > + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl/win' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/kubectl.exe -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl/win/kubectl.exe + + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl/osx' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl/osx/kubectl + + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl/linux' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl/linux/kubectl - task: VSBuild@1 name: '' displayName: Sign Files @@ -307,6 +397,46 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/win + - task: CopyFiles@2 + displayName: Collect files for .zip (Windows) for arm64 + enabled: True + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish + Contents: >- + **/* + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/winarm64 - task: CopyFiles@2 displayName: Collect files for .zip (OSX) enabled: True @@ -351,6 +481,50 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/osx + - task: CopyFiles@2 + displayName: Collect files for .zip (OSX) for arm64 + enabled: True + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish + Contents: >- + **/* + + src/resources/license.rtf + + src/vscode/ThirdPartyNotices.txt + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/osxarm64 - task: CopyFiles@2 displayName: Collect files for .zip (Linux) enabled: True @@ -395,6 +569,50 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/linux + - task: CopyFiles@2 + displayName: Collect files for .zip (Linux) for arm64 + enabled: True + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish + Contents: >- + **/* + + src/resources/license.rtf + + src/vscode/ThirdPartyNotices.txt + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/linuxarm64 - task: ArchiveFiles@2 displayName: Create .zip file (Windows) enabled: True @@ -403,6 +621,14 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-win.zip + - task: ArchiveFiles@2 + displayName: Create .zip file (Windows) for arm64 + enabled: True + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/winarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-win-arm64.zip - task: ArchiveFiles@2 displayName: Create .zip file (OSX) enabled: True @@ -411,6 +637,14 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-osx.zip + - task: ArchiveFiles@2 + displayName: Create .zip file (OSX) for arm64 + enabled: True + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/osxarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-osx-arm64.zip - task: ArchiveFiles@2 displayName: Create .zip file (Linux) enabled: True @@ -419,6 +653,14 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-linux.zip + - task: ArchiveFiles@2 + displayName: Create .zip file (Linux) for arm64 + enabled: True + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/linuxarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-linux-arm64.zip - task: PowerShell@2 displayName: Generate lks.json for .zip files enabled: True @@ -437,7 +679,13 @@ jobs: $Linux = @{ url="$BlobUrl/lpk-linux.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-linux.zip).Hash)" } - $Json = @{ version="1.0.$env:BUILD_BUILDNUMBER"; win = $Win; osx = $OSX; linux = $Linux } | ConvertTo-Json + $Win_Arm64 = @{ url="$BlobUrl/lpk-win-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-win-arm64.zip).Hash)" } + + $OSX_Arm64 = @{ url="$BlobUrl/lpk-osx-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-osx-arm64.zip).Hash)" } + + $Linux_Arm64 = @{ url="$BlobUrl/lpk-linux-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-linux-arm64.zip).Hash)" } + + $Json = @{ version="1.0.$env:BUILD_BUILDNUMBER"; win = $Win; osx = $OSX; linux = $Linux; win_arm64 = $Win_Arm64; linux_arm64 = $Linux_Arm64; osx_arm64 = $OSX_Arm64 } | ConvertTo-Json $Json | Out-File -FilePath $ZipDir/lks.json -Encoding ascii @@ -467,6 +715,15 @@ jobs: packDirectory: '$(Build.ArtifactStagingDirectory)/nuget' nobuild: true buildProperties: 'Configuration=${{ parameters.BuildConfiguration }};NuspecFile=bin\${{ parameters.BuildConfiguration }}\$(BuildParameters.dotnetversionforbuild)\win-x64\publish\dsc.nuspec' + - task: DotNetCoreCLI@2 + displayName: 'dotnet pack CLI NuGet for arm64 (Windows)' + inputs: + command: pack + feedsToUse: config + packagesToPack: src/dsc/dsc.csproj + packDirectory: '$(Build.ArtifactStagingDirectory)/nuget' + nobuild: true + buildProperties: 'Configuration=${{ parameters.BuildConfiguration }};NuspecFile=bin\${{ parameters.BuildConfiguration }}\$(BuildParameters.dotnetversionforbuild)\win-arm64\publish\dsc.nuspec' - task: AzureArtifacts.manifest-generator-task.manifest-generator-task.ManifestGeneratorTask@0 displayName: 'Manifest Generator for nuget' inputs: @@ -593,6 +850,15 @@ jobs: selectOrConfig: config nugetConfigPath: src/nuget.config externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b + - task: DotNetCoreCLI@2 + displayName: restore EndpointManager for ARM 64 (Windows) (to download runtime pack) + inputs: + command: restore + projects: src\endpointmanager\endpointmanager.csproj + restoreArguments: -r win-arm64 + selectOrConfig: config + nugetConfigPath: src/nuget.config + externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b - task: NuGetToolInstaller@1 displayName: Use NuGet 6.1.x inputs: @@ -613,6 +879,15 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r win-x64 --self-contained false --no-restore --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm64 (Windows) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --self-contained false --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false - task: DotNetCoreCLI@2 displayName: publish EndpointManagerLauncher(Windows) enabled: True @@ -624,6 +899,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish EndpointManagerLauncher for arm64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\EndpointManagerLauncher\endpointmanagerlauncher.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: CopyFiles@2 displayName: Copy EndpointManager Launcher to dsc folder enabled: True @@ -635,6 +921,17 @@ jobs: !**/*.pdb TargetFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/EndpointManagerLauncher OverWrite: true + - task: CopyFiles@2 + displayName: Copy EndpointManager Launcher to dsc folder for arm64 + enabled: True + inputs: + SourceFolder: src/EndpointManagerLauncher/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/ + Contents: >- + **/* + + !**/*.pdb + TargetFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/EndpointManagerLauncher + OverWrite: true - task: DotNetCoreCLI@2 displayName: publish DSC (OSX) inputs: @@ -644,6 +941,15 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r osx-x64 --no-restore --self-contained false --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm64 (OSX) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r osx-arm64 --no-restore --self-contained false --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false - task: DotNetCoreCLI@2 displayName: publish DSC (Linux) inputs: @@ -653,6 +959,15 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r linux-x64 --no-restore --self-contained false --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for arm64 (Linux) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r linux-arm64 --no-restore --self-contained false --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false - task: PowerShell@2 displayName: Download kubectl continueOnError: True @@ -663,21 +978,46 @@ jobs: New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/windows/amd64/kubectl.exe -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win/kubectl.exe + curl https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-x64/publish/kubectl/win/kubectl.exe New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl' -ItemType Directory New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/darwin/amd64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx/kubectl + curl https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-x64/publish/kubectl/osx/kubectl New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl' -ItemType Directory New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux' -ItemType Directory - curl https://dl.k8s.io/release/v1.21.2/bin/linux/amd64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux/kubectl + curl https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-x64/publish/kubectl/linux/kubectl + - task: PowerShell@2 + displayName: Download kubectl for arm64 + continueOnError: True + inputs: + targetType: inline + script: > + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl/win' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/kubectl.exe -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish/kubectl/win/kubectl.exe + + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl/osx' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish/kubectl/osx/kubectl + + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl' -ItemType Directory + + New-Item -Path '$(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl/linux' -ItemType Directory + + curl https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl -OutFile $(Build.SourcesDirectory)/src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish/kubectl/linux/kubectl - task: VSBuild@1 displayName: Sign Files enabled: True @@ -724,10 +1064,53 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/win + - task: CopyFiles@2 + displayName: Collect files for .zip for arm64 (Windows) + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/win-arm64/publish + Contents: >- + **/* + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/winarm64 - task: CodeSign@1 displayName: Validate Signatures inputs: Path: '$(Agent.TempDirectory)/zip/win' + - task: CodeSign@1 + displayName: Validate Signatures for arm64 + inputs: + Path: '$(Agent.TempDirectory)/zip/winarm64' - task: CopyFiles@2 displayName: Collect files for .zip (OSX) inputs: @@ -771,10 +1154,57 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/osx + - task: CopyFiles@2 + displayName: Collect files for .zip for arm64 (OSX) + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/osx-arm64/publish + Contents: >- + **/* + + src/resources/license.rtf + + src/vscode/ThirdPartyNotices.txt + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/osxarm64 - task: CodeSign@1 displayName: Validate Signatures OSX inputs: Path: '$(Agent.TempDirectory)/zip/osx' + - task: CodeSign@1 + displayName: Validate Signatures OSX for arm64 + inputs: + Path: '$(Agent.TempDirectory)/zip/osxarm64' - task: CopyFiles@2 displayName: Collect files for .zip (Linux) inputs: @@ -818,10 +1248,57 @@ jobs: !**/zh-Hant/* TargetFolder: $(Agent.TempDirectory)/zip/linux + - task: CopyFiles@2 + displayName: Collect files for .zip for arm64 (Linux) + inputs: + SourceFolder: src/dsc/bin/${{ parameters.BuildConfiguration }}/$(BuildParameters.dotnetversionforbuild)/linux-arm64/publish + Contents: >- + **/* + + src/resources/license.rtf + + src/vscode/ThirdPartyNotices.txt + + !**/*.pdb + + !**/*.xml + + !**/*.nuspec + + !**/cs/* + + !**/de/* + + !**/es/* + + !**/fr/* + + !**/it/* + + !**/ja/* + + !**/ko/* + + !**/pl/* + + !**/pt-BR/* + + !**/ru/* + + !**/tr/* + + !**/zh-Hans/* + + !**/zh-Hant/* + TargetFolder: $(Agent.TempDirectory)/zip/linuxarm64 - task: CodeSign@1 displayName: Validate Signatures linux inputs: Path: '$(Agent.TempDirectory)/zip/linux' + - task: CodeSign@1 + displayName: Validate Signatures linux for arm64 + inputs: + Path: '$(Agent.TempDirectory)/zip/linuxarm64' - task: ArchiveFiles@2 displayName: Create .zip file (Windows) inputs: @@ -829,6 +1306,13 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-win.zip + - task: ArchiveFiles@2 + displayName: Create .zip file for arm64 (Windows) + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/winarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-win-arm64.zip - task: ArchiveFiles@2 displayName: Create .zip file (OSX) inputs: @@ -836,6 +1320,13 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-osx.zip + - task: ArchiveFiles@2 + displayName: Create .zip file for arm64 (OSX) + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/osxarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-osx-arm64.zip - task: ArchiveFiles@2 displayName: Create .zip file (Linux) inputs: @@ -843,6 +1334,13 @@ jobs: includeRootFolder: false sevenZipCompression: 5 archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-linux.zip + - task: ArchiveFiles@2 + displayName: Create .zip file for arm64 (Linux) + inputs: + rootFolderOrFile: $(Agent.TempDirectory)/zip/linuxarm64 + includeRootFolder: false + sevenZipCompression: 5 + archiveFile: $(Build.ArtifactStagingDirectory)/zip/lpk-linux-arm64.zip - task: PowerShell@2 displayName: Generate lks.json for .zip files inputs: @@ -864,6 +1362,14 @@ jobs: $Cli_Linux = @{ url="$BlobUrl/lpk-linux.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-linux.zip).Hash)" } + # CLI binaries for arm64 + + $Cli_Win_Arm64 = @{ url="$BlobUrl/lpk-win-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-win-arm64.zip).Hash)" } + + $Cli_Osx_Arm64 = @{ url="$BlobUrl/lpk-osx-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-osx-arm64.zip).Hash)" } + + $Cli_Linux_Arm64 = @{ url="$BlobUrl/lpk-linux-arm64.zip"; sha256hash="$((Get-FileHash $ZipDir\lpk-linux-arm64.zip).Hash)" } + # Kubectl binaries $Kubectl_Win = @{ url="$BlobLKSUrl/kubectl-win.zip"; sha256hash="5490F9B60E4C2C4229CA00FBFA946AE65655F0739BE9714C6A0A0FB7BE2A6F2C" } @@ -872,6 +1378,14 @@ jobs: $Kubectl_Linux = @{ url="$BlobLKSUrl/kubectl-linux.zip"; sha256hash="01B76D4E4A9081452932F27C767C9D8F3507C8AD3CC9269CEB16729F4D0ED900" } + # Kubectl binaries for arm64 + + $Kubectl_Win_Arm64 = @{ url="$BlobLKSUrl/kubectl-win-arm64.zip"; sha256hash="5490F9B60E4C2C4229CA00FBFA946AE65655F0739BE9714C6A0A0FB7BE2A6F2C" } + + $Kubectl_Osx_Arm64 = @{ url="$BlobLKSUrl/kubectl-osx-arm64.zip"; sha256hash="D24EAFEC39EB2393DBA0088B762953BEDCC04156AC9E324FA290476BD3C888B9" } + + $Kubectl_Linux_Arm64 = @{ url="$BlobLKSUrl/kubectl-linux-arm64.zip"; sha256hash="01B76D4E4A9081452932F27C767C9D8F3507C8AD3CC9269CEB16729F4D0ED900" } + #dotnet runtime binaries $Dotnet_Win = @{ url="$BlobLKSUrl/dotnetruntime-win.zip"; sha256hash="0FCA9F2AB829C85615007EA646CF436D2E90C9A4095C84C2F9EB3EC0754468A8" } @@ -880,19 +1394,39 @@ jobs: $Dotnet_Linux = @{ url="$BlobLKSUrl/dotnetruntime-linux.zip"; sha256hash="801D9D251D07B9A88195450FCBFD70C7507CEEEF05D5F0E88CC14CEBFCC10F4B" } + #dotnet runtime binaries for arm64 + + $Dotnet_Win_Arm64 = @{ url="$BlobLKSUrl/dotnetruntime-win-arm64.zip"; sha512hash="902488cbfee81dd5e1009eb86ab82d479ed7d9c44e4e4b6bb3df90a68eea65c0140978b02f46f9f6d0847466e1de73e9551688a79082e0679350a46276f441f9" } + + $Dotnet_Osx_Arm64 = @{ url="$BlobLKSUrl/dotnetruntime-osx-arm64.zip"; sha512hash="e6979ab34bea777f1f48bf9208a024b33b1685ec236f13c609975ebc7e1f641806b47daefb9ff1f74f675ee6242b628edd615982bc9c014d18e18cd2662171a8" } + + $Dotnet_Linux_Arm64 = @{ url="$BlobLKSUrl/dotnetruntime-linux-arm64.zip"; sha512hash="814db12231db89d9935404ec6693b3fb50ad022c0affbc131d657878e194274f1af5e92dd32c2c4f2a78a7e38d0c18a46ba4ecc67630ca3adf5b7550367c2366" } + # Win Json $Win = @{ dotnetruntime = $Dotnet_Win; kubectl = $Kubectl_Win; bridge = $Cli_Win } + # Win Json for arm64 + + $Win_Arm64 = @{ dotnetruntime = $Dotnet_Win_Arm64; kubectl = $Kubectl_Win_Arm64; bridge = $Cli_Win_Arm64 } + # OSX Json $OSX = @{ dotnetruntime = $Dotnet_Osx; kubectl = $Kubectl_Osx; bridge = $Cli_Osx } + # OSX Json for arm64 + + $OSX_Arm64 = @{ dotnetruntime = $Dotnet_Osx_Arm64; kubectl = $Kubectl_Osx_Arm64; bridge = $Cli_Osx_Arm64 } + # Linux Json $Linux = @{ dotnetruntime = $Dotnet_Linux; kubectl = $Kubectl_Linux; bridge = $Cli_Linux } - $Json = @{ version="1.0.$env:BUILD_BUILDNUMBER"; win = $Win; osx = $OSX; linux = $Linux } | ConvertTo-Json + # Linux Json for arm64 + + $Linux_Arm64 = @{ dotnetruntime = $Dotnet_Linux_Arm64; kubectl = $Kubectl_Linux_Arm64; bridge = $Cli_Linux_Arm64 } + + $Json = @{ version="1.0.$env:BUILD_BUILDNUMBER"; win = $Win; osx = $OSX; linux = $Linux; win_arm64 = $Win_Arm64; osx_arm64 = $OSX_Arm64; linux_arm64 = $Linux_Arm64} | ConvertTo-Json $Json | Out-File -FilePath $ZipDir/lks.json -Encoding ascii diff --git a/build-pipelines-PR.yml b/build-pipelines-PR.yml index ebab48ca5..029d3c7b3 100644 --- a/build-pipelines-PR.yml +++ b/build-pipelines-PR.yml @@ -68,6 +68,16 @@ jobs: selectOrConfig: config nugetConfigPath: src/nuget.config externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b + - task: DotNetCoreCLI@2 + displayName: restore EndpointManager for arm64 (Windows) (to download runtime pack) + enabled: True + inputs: + command: restore + projects: src\endpointmanager\endpointmanager.csproj + restoreArguments: -r win-arm64 + selectOrConfig: config + nugetConfigPath: src/nuget.config + externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b - task: NuGetToolInstaller@1 name: '' displayName: Use NuGet 5.9.x @@ -120,6 +130,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for self contained for arm64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish EndpointManagerLauncher(Windows) enabled: True @@ -131,6 +152,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish EndpointManagerLauncher for arm64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\EndpointManagerLauncher\endpointmanagerlauncher.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish DSC for self contained (OSX) enabled: True @@ -142,6 +174,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for self contained for arm64 (OSX) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r osx-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish DSC for self contained (Linux) enabled: True @@ -153,6 +196,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish DSC for self contained for arm64 (Linux) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r linux-arm64 --no-restore --self-contained true --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: 'dotnet pack CLI NuGet (Windows)' inputs: @@ -162,6 +216,15 @@ jobs: packDirectory: '$(Build.ArtifactStagingDirectory)/nuget' nobuild: true buildProperties: 'NuspecFile=bin\${{ parameters.BuildConfiguration }}\$(BuildParameters.dotnetversionforbuild)\win-x64\publish\dsc.nuspec' + - task: DotNetCoreCLI@2 + displayName: 'dotnet pack CLI NuGet for arm64 (Windows)' + inputs: + command: pack + feedsToUse: config + packagesToPack: src/dsc/dsc.csproj + packDirectory: '$(Build.ArtifactStagingDirectory)/nuget' + nobuild: true + buildProperties: 'NuspecFile=bin\${{ parameters.BuildConfiguration }}\$(BuildParameters.dotnetversionforbuild)\win-arm64\publish\dsc.nuspec' - job: Phase_2 displayName: Run NON self-contained build (binaries V2, where the binaries are downloaded in parallel) @@ -194,6 +257,16 @@ jobs: selectOrConfig: config nugetConfigPath: src/nuget.config externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b + - task: DotNetCoreCLI@2 + displayName: restore EndpointManager for arm64 (Windows) (to download runtime pack) + enabled: True + inputs: + command: restore + projects: src\endpointmanager\endpointmanager.csproj + restoreArguments: -r win-arm64 + selectOrConfig: config + nugetConfigPath: src/nuget.config + externalEndpoints: dba0ba50-2d4e-4f12-9f5a-42a638da803b - task: NuGetToolInstaller@1 name: '' displayName: Use NuGet 5.9.x @@ -225,6 +298,17 @@ jobs: zipAfterPublish: false modifyOutputPath: false selectOrConfig: config + - task: DotNetCoreCLI@2 + displayName: publish EndpointManagerLauncher for arm64 (Windows) + enabled: True + inputs: + command: publish + publishWebProjects: false + projects: src\EndpointManagerLauncher\endpointmanagerlauncher.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false + selectOrConfig: config - task: DotNetCoreCLI@2 displayName: publish DSC for non self contained (Windows) inputs: @@ -234,6 +318,15 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r win-x64 --self-contained false --no-restore --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for non self contained for arm64 (Windows) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r win-arm64 --self-contained false --no-restore --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false - task: DotNetCoreCLI@2 displayName: publish DSC for non self contained (Linux) inputs: @@ -243,6 +336,15 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r linux-x64 --no-restore --self-contained false --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for non self contained for arm64 (Linux) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r linux-arm64 --no-restore --self-contained false --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false - task: DotNetCoreCLI@2 displayName: publish DSC for non self contained (OSX) inputs: @@ -252,4 +354,13 @@ jobs: arguments: -c ${{ parameters.BuildConfiguration }} -r osx-x64 --no-restore --self-contained false --verbosity detailed zipAfterPublish: false modifyOutputPath: false + - task: DotNetCoreCLI@2 + displayName: publish DSC for non self contained for arm64 (OSX) + inputs: + command: publish + publishWebProjects: false + projects: src\dsc\dsc.csproj + arguments: -c ${{ parameters.BuildConfiguration }} -r osx-arm64 --no-restore --self-contained false --verbosity detailed + zipAfterPublish: false + modifyOutputPath: false ... diff --git a/build/setup-kubectl.sh b/build/setup-kubectl.sh old mode 100644 new mode 100755 index 1f180053c..cb2299229 --- a/build/setup-kubectl.sh +++ b/build/setup-kubectl.sh @@ -1,31 +1,27 @@ #!/bin/bash set -e +# Default values for kubectl version, install location, and architecture +DEFAULT_KUBECTL_VERSION="v1.27.3" DEFAULT_INSTALL_LOCATION="/app/kubectl/linux" -DEFAULT_KUBECTL_VERSION="v1.21.2" +DEFAULT_ARCH="amd64" -# Arguments: kubectl version, install location -function installKubectl { - local loc_kube_version=$1 - local loc_setup_location=$2 +# Function to install kubectl +# Arguments: kubectl version, install location, architecture +function install_kubectl { + # Set default values if arguments are not provided + kubectl_version="${1:-$DEFAULT_KUBECTL_VERSION}" + install_location="${2:-$DEFAULT_INSTALL_LOCATION}" + arch="${3:-$DEFAULT_ARCH}" - if [ -z "$loc_kube_version" ]; then - loc_kube_version=$DEFAULT_KUBECTL_VERSION - fi - - if [ -z "$loc_setup_location" ]; then - loc_setup_location=$DEFAULT_INSTALL_LOCATION - fi - - echo "Setting up kubectl $loc_kube_version in $loc_setup_location" - curl -LO https://storage.googleapis.com/kubernetes-release/release/${loc_kube_version}/bin/linux/amd64/kubectl + echo "Setting up kubectl $kubectl_version in $install_location with arch $arch" + curl -LO "https://dl.k8s.io/release/$kubectl_version/bin/linux/$arch/kubectl" chmod +x kubectl - mkdir -p $loc_setup_location - mv kubectl $loc_setup_location + mkdir -p "$install_location" + mv kubectl "$install_location" } -if [ -z "$@" ]; then - installKubectl -else - "$@" -fi \ No newline at end of file +kubectl_version=$1 +install_location=$2 +arch=$3 +install_kubectl "$kubectl_version" "$install_location" "$arch" \ No newline at end of file diff --git a/deployment/settings/services/imagetag.setting b/deployment/settings/services/imagetag.setting index 13749dcaf..b2b08cb30 100644 --- a/deployment/settings/services/imagetag.setting +++ b/deployment/settings/services/imagetag.setting @@ -1,4 +1,4 @@ -MINDARO_DEVHOSTAGENT_TAG=1.3.2 -MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG=1.3.2 -MINDARO_ROUTINGMANAGER_TAG=1.2.2 +MINDARO_DEVHOSTAGENT_TAG=1.3.4 +MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG=1.3.4 +MINDARO_ROUTINGMANAGER_TAG=1.2.3 MINDARO_LOCALAGENT_TAG=1.1.0 diff --git a/deployment/settings/setenvironmentvariables.sh b/deployment/settings/setenvironmentvariables.sh old mode 100644 new mode 100755 diff --git a/samples/managed-identity/Dockerfile b/samples/managed-identity/Dockerfile index 8402e7cfb..ec55f631e 100644 --- a/samples/managed-identity/Dockerfile +++ b/samples/managed-identity/Dockerfile @@ -1,27 +1,26 @@ #See https://aka.ms/containerfastmode to understand how Visual Studio uses this Dockerfile to build your images for faster debugging. -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 AS base +ARG TARGETARCH WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH WORKDIR /src COPY "mi-webapp.csproj" . -RUN dotnet restore "mi-webapp.csproj" +RUN dotnet restore "mi-webapp.csproj" -a ${TARGETARCH} COPY . . WORKDIR "/src/." -RUN dotnet build "mi-webapp.csproj" -c Release -o /app/build +RUN dotnet build "mi-webapp.csproj" -c Release -o /app/build -a ${TARGETARCH} FROM build AS publish -RUN dotnet publish "mi-webapp.csproj" -c Release -o /app/publish +RUN dotnet publish "mi-webapp.csproj" -c Release -o /app/publish -a ${TARGETARCH} FROM base AS final WORKDIR /app COPY --from=publish /app/publish . -RUN apt-get update -y -RUN apt-get upgrade -y -RUN apt-get install -y libsecret-1-0 ENTRYPOINT ["dotnet", "mi-webapp.dll"] \ No newline at end of file diff --git a/samples/managed-identity/KubernetesLocalProcessConfig.yaml b/samples/managed-identity/KubernetesLocalProcessConfig.yaml index a5cbb580a..385c90906 100644 --- a/samples/managed-identity/KubernetesLocalProcessConfig.yaml +++ b/samples/managed-identity/KubernetesLocalProcessConfig.yaml @@ -5,6 +5,6 @@ env: - name: STORAGE_CONTAINER_NAME value: "mitestsa-container" - name: MI_CLIENT_ID - value: "b24d4637-3453-4f6f-8187-228a5442a675" + value: "a2cc59eb-fa11-485c-9bee-c84aa4cb97d0" #b24d4637-3453-4f6f-8187-228a5442a675 for non arm clusters, please change value and test. enableFeatures: - ManagedIdentity \ No newline at end of file diff --git a/samples/managed-identity/deploy-arm.yaml b/samples/managed-identity/deploy-arm.yaml new file mode 100644 index 000000000..de7682259 --- /dev/null +++ b/samples/managed-identity/deploy-arm.yaml @@ -0,0 +1,73 @@ +#this deploy yaml is for arm clusters so that managed identity can be kept separate for arm clusters. +apiVersion: apps/v1 +kind: Deployment +metadata: + name: mi-webapp + namespace: mi-webapp +spec: + replicas: 1 + selector: + matchLabels: + app: mi-webapp + template: + metadata: + labels: + app: mi-webapp + # Label for pod identity + aadpodidbinding: mi-test-arm + spec: + containers: + - image: mindarodev.azurecr.io/samples/mi-webapp:v1 + imagePullPolicy: IfNotPresent + name: mi-webapp + env: + # the below environment variable values come from the below sub and rg: + # Sub: Mindaro Testing (c2e0f009-a61a-4578-8a6d-5715ee782648) + # RG: testing-scenario + # Storage account name: mitestsa + # Managed identity name: mi-test + - name: STORAGE_ACCOUNT_NAME + value: "mitestsa" + - name: STORAGE_CONTAINER_NAME + value: "mitestsa-container" + - name: MI_CLIENT_ID + value: "a2cc59eb-fa11-485c-9bee-c84aa4cb97d0" + ports: + - containerPort: 80 + +--- + +apiVersion: v1 +kind: Service +metadata: + name: mi-webapp-service + namespace: mi-webapp +spec: + selector: + app: mi-webapp + ports: + - protocol: TCP + port: 80 + targetPort: 80 + type: LoadBalancer + +--- +# AzureIdentity resource for pod identity +apiVersion: "aadpodidentity.k8s.io/v1" +kind: AzureIdentity +metadata: + name: mi-test-arm +spec: + type: 0 + resourceID: "/subscriptions/c2e0f009-a61a-4578-8a6d-5715ee782648/resourcegroups/MC_testing-scenario_testing-scenarios-arm_westeurope/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-test" + clientID: "a2cc59eb-fa11-485c-9bee-c84aa4cb97d0" + +--- +# AzureIdentityBinding resource for pod identity +apiVersion: "aadpodidentity.k8s.io/v1" +kind: AzureIdentityBinding +metadata: + name: mi-test-binding +spec: + azureIdentity: mi-test-arm + selector: mi-test-arm \ No newline at end of file diff --git a/samples/managed-identity/deploy.yaml b/samples/managed-identity/deploy.yaml index 770dd40f2..58f45ffbc 100644 --- a/samples/managed-identity/deploy.yaml +++ b/samples/managed-identity/deploy.yaml @@ -16,7 +16,7 @@ spec: aadpodidbinding: mi-test spec: containers: - - image: azdspublic/mi-webapp + - image: mindarodev.azurecr.io/samples/mi-webapp:v1 imagePullPolicy: IfNotPresent name: mi-webapp env: @@ -60,7 +60,6 @@ spec: type: 0 resourceID: "/subscriptions/c2e0f009-a61a-4578-8a6d-5715ee782648/resourcegroups/MC_testing-scenario_testing-scenarios_westeurope/providers/Microsoft.ManagedIdentity/userAssignedIdentities/mi-test" clientID: "b24d4637-3453-4f6f-8187-228a5442a675" - --- # AzureIdentityBinding resource for pod identity apiVersion: "aadpodidentity.k8s.io/v1" diff --git a/samples/managed-identity/roleAssignment.sh b/samples/managed-identity/roleAssignment.sh index de69ba5da..081d49b52 100755 --- a/samples/managed-identity/roleAssignment.sh +++ b/samples/managed-identity/roleAssignment.sh @@ -2,4 +2,11 @@ export SUBSCRIPTION_ID="c2e0f009-a61a-4578-8a6d-5715ee782648" export RESOURCE_GROUP="testing-scenario" export CLUSTER_NAME="testing-scenarios" -curl -s https://raw.githubusercontent.com/Azure/aad-pod-identity/master/hack/role-assignment.sh | bash \ No newline at end of file +curl -s https://raw.githubusercontent.com/Azure/aad-pod-identity/master/hack/role-assignment.sh | bash + +#RUN this for arm clusters +export SUBSCRIPTION_ID="c2e0f009-a61a-4578-8a6d-5715ee782648" +export RESOURCE_GROUP="testing-scenario" +export CLUSTER_NAME="testing-scenarios-arm" + +curl -s https://raw.githubusercontent.com/Azure/aad-pod-identity/master/hack/role-assignment.sh | bash diff --git a/samples/todo-app/database-api/Dockerfile b/samples/todo-app/database-api/Dockerfile index f364455b6..39bd42849 100644 --- a/samples/todo-app/database-api/Dockerfile +++ b/samples/todo-app/database-api/Dockerfile @@ -1,17 +1,19 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 AS base +ARG TARGETARCH WORKDIR /app EXPOSE 80 -FROM mcr.microsoft.com/dotnet/sdk:7.0 AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH WORKDIR /src COPY ["databaseApi.csproj", ""] -RUN dotnet restore "./databaseApi.csproj" +RUN dotnet restore "./databaseApi.csproj" -a ${TARGETARCH} COPY . . WORKDIR "/src/." -RUN dotnet build "databaseApi.csproj" -c Release -o /app/build +RUN dotnet build "databaseApi.csproj" -c Release -o /app/build -a ${TARGETARCH} FROM build AS publish -RUN dotnet publish "databaseApi.csproj" -c Release -o /app/publish +RUN dotnet publish "databaseApi.csproj" -c Release -a ${TARGETARCH} -o /app/publish FROM base AS final WORKDIR /app diff --git a/samples/todo-app/deployment-arm.yaml b/samples/todo-app/deployment-arm.yaml new file mode 100644 index 000000000..927c8851a --- /dev/null +++ b/samples/todo-app/deployment-arm.yaml @@ -0,0 +1,224 @@ +apiVersion: apps/v1 +kind: Deployment +metadata: + name: stats-cache +spec: + selector: + matchLabels: + name: stats-cache + template: + metadata: + labels: + name: stats-cache + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: cache + image: redis:5-alpine +--- +apiVersion: v1 +kind: Service +metadata: + name: stats-cache +spec: + selector: + name: stats-cache + ports: + - port: 6379 + targetPort: 6379 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: stats-queue +spec: + selector: + matchLabels: + name: stats-queue + template: + metadata: + labels: + name: stats-queue + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: queue + image: rabbitmq:3-alpine +--- +apiVersion: v1 +kind: Service +metadata: + name: stats-queue +spec: + selector: + name: stats-queue + ports: + - port: 5672 + targetPort: 5672 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: stats-worker +spec: + selector: + matchLabels: + name: stats-worker + template: + metadata: + labels: + name: stats-worker + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: stats-worker + image: mindarodev.azurecr.io/samples/stats-worker-arm64:v2 + env: + - name: STATS_QUEUE_URI + value: amqp://stats-queue + - name: REDIS_HOST + value: stats-cache + - name: REDIS_PORT + value: "6379" +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: stats-api +spec: + selector: + matchLabels: + name: stats-api + template: + metadata: + labels: + name: stats-api + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: stats-api + image: mindarodev.azurecr.io/samples/stats-api-arm64:v2 + livenessProbe: + httpGet: + path: /hello + port: 80 + initialDelaySeconds: 5 + periodSeconds: 3 + readinessProbe: + httpGet: + path: /hello + port: 80 + initialDelaySeconds: 15 + periodSeconds: 5 +--- +apiVersion: v1 +kind: Service +metadata: + name: stats-api +spec: + selector: + name: stats-api + ports: + - port: 80 + targetPort: 80 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: todos-db +spec: + selector: + matchLabels: + name: todos-db + template: + metadata: + labels: + name: todos-db + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: todos-db + image: mongo:4 +--- +apiVersion: v1 +kind: Service +metadata: + name: todos-db +spec: + selector: + name: todos-db + ports: + - port: 27017 + targetPort: 27017 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: frontend +spec: + selector: + matchLabels: + name: frontend + template: + metadata: + labels: + name: frontend + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: frontend + image: mindarodev.azurecr.io/samples/frontend-arm64:v2 + env: + - name: STATS_QUEUE_URI + value: amqp://stats-queue +--- +apiVersion: v1 +kind: Service +metadata: + name: frontend +spec: + type: LoadBalancer + selector: + name: frontend + ports: + - port: 80 + targetPort: 80 +--- +apiVersion: apps/v1 +kind: Deployment +metadata: + name: database-api +spec: + selector: + matchLabels: + name: database-api + template: + metadata: + labels: + name: database-api + spec: + nodeSelector: + kubernetes.io/os: linux + containers: + - name: database-api + image: mindarodev.azurecr.io/samples/database-api-arm64:v2 + env: + - name: MONGO_CONNECTION_STRING + value: mongodb://todos-db +--- +apiVersion: v1 +kind: Service +metadata: + name: database-api +spec: + selector: + name: database-api + ports: + - port: 80 + targetPort: 80 diff --git a/samples/todo-app/deployment.yaml b/samples/todo-app/deployment.yaml index 6f92bf050..cf142edfb 100644 --- a/samples/todo-app/deployment.yaml +++ b/samples/todo-app/deployment.yaml @@ -75,7 +75,7 @@ spec: kubernetes.io/os: linux containers: - name: stats-worker - image: azdspublic/todo-app-stats-worker + image: mindarodev.azurecr.io/samples/stats-worker:v4 env: - name: STATS_QUEUE_URI value: amqp://stats-queue @@ -101,7 +101,7 @@ spec: kubernetes.io/os: linux containers: - name: stats-api - image: azdspublic/todo-app-stats-api + image: mindarodev.azurecr.io/samples/stats-api:v4 livenessProbe: httpGet: path: /hello @@ -173,7 +173,7 @@ spec: kubernetes.io/os: linux containers: - name: frontend - image: azdspublic/todo-app-frontend + image: mindarodev.azurecr.io/samples/frontend:v4 env: - name: STATS_QUEUE_URI value: amqp://stats-queue @@ -207,7 +207,7 @@ spec: kubernetes.io/os: linux containers: - name: database-api - image: azdspublic/todo-app-database-api + image: mindarodev.azurecr.io/samples/database-api:v4 env: - name: MONGO_CONNECTION_STRING value: mongodb://todos-db diff --git a/samples/todo-app/frontend/Dockerfile b/samples/todo-app/frontend/Dockerfile index 480447ca5..a54604f09 100644 --- a/samples/todo-app/frontend/Dockerfile +++ b/samples/todo-app/frontend/Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts-alpine +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-api/Dockerfile b/samples/todo-app/stats-api/Dockerfile index 38f9ba8d2..50678dc1d 100644 --- a/samples/todo-app/stats-api/Dockerfile +++ b/samples/todo-app/stats-api/Dockerfile @@ -1,4 +1,4 @@ -FROM node:lts-alpine +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-worker/Dockerfile b/samples/todo-app/stats-worker/Dockerfile index 60a393ce7..1804e1c79 100644 --- a/samples/todo-app/stats-worker/Dockerfile +++ b/samples/todo-app/stats-worker/Dockerfile @@ -1,5 +1,4 @@ -FROM node:lts-alpine - +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 WORKDIR /app COPY package*.json ./ RUN npm install diff --git a/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj b/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj index e84d7e08a..c0568e671 100644 --- a/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj +++ b/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj @@ -3,7 +3,7 @@ net7.0 true - win-x64 + win-x64;win-arm64 portable EndpointManager Exe diff --git a/src/LocalAgent/LocalAgent.csproj b/src/LocalAgent/LocalAgent.csproj index 16d0066d6..fe8a047ae 100644 --- a/src/LocalAgent/LocalAgent.csproj +++ b/src/LocalAgent/LocalAgent.csproj @@ -5,7 +5,7 @@ true Microsoft.BridgeToKubernetes.LocalAgent Microsoft.BridgeToKubernetes.LocalAgent - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 AnyCPU portable Linux diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index b4b0a63b0..d9a8ef0df 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -1152,4 +1152,4 @@ private string GetLabelSelectorString(IEnumerable> #endregion Private methods } -} +} \ No newline at end of file diff --git a/src/common/common.csproj b/src/common/common.csproj index 2fb2b90b0..9f5251ac2 100644 --- a/src/common/common.csproj +++ b/src/common/common.csproj @@ -3,7 +3,7 @@ net7.0 Microsoft.BridgeToKubernetes.Common - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 AnyCPU false false diff --git a/src/devhostagent.restorationjob/Dockerfile b/src/devhostagent.restorationjob/Dockerfile index 76b1b7e0d..c7b01fbfd 100644 --- a/src/devhostagent.restorationjob/Dockerfile +++ b/src/devhostagent.restorationjob/Dockerfile @@ -1,6 +1,6 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build - +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT ARG MindaroBuildNumber=0.0 @@ -8,14 +8,14 @@ ARG MindaroBuildNumber=0.0 WORKDIR /src/devhostagent.restorationjob COPY /src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj . COPY /src/common/common.csproj /src/common/ -RUN dotnet restore +RUN dotnet restore -a ${TARGETARCH} COPY /src/devhostagent.restorationjob/ . COPY /src/common/ /src/common/ COPY /build/ /build/ ENV TelemetryType=${TelemetryType} ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} -RUN dotnet publish -c ${Configuration} -o /output devhostAgent.restorationjob.csproj +RUN dotnet publish -c ${Configuration} -a ${TARGETARCH} --self-contained false --no-restore -o /output devhostAgent.restorationjob.csproj # Final container FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final @@ -29,12 +29,7 @@ RUN tdnf install -y \ procps \ bind-utils -COPY /build/setup-kubectl.sh . -RUN chmod +x ./setup-kubectl.sh \ - && ./setup-kubectl.sh \ - && rm -f ./setup-kubectl.sh - WORKDIR /app +COPY --from=build /output /app ENTRYPOINT ["/app/restorationjob"] -COPY --from=build /output /app \ No newline at end of file diff --git a/src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj b/src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj index a867d5ef9..ce39ec3e8 100644 --- a/src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj +++ b/src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj @@ -6,7 +6,7 @@ net7.0 true true - linux-x64;linux-arm64;linux-musl-arm64;linux-musl-x64;win-x64 + linux-x64;linux-arm64;linux-musl-arm64;linux-musl-x64;win-x64;win-arm64 1.0 Microsoft.BridgeToKubernetes.DevHostAgent.RestorationJob true diff --git a/src/devhostagent/Dockerfile b/src/devhostagent/Dockerfile index 960b5239e..aa8656f97 100644 --- a/src/devhostagent/Dockerfile +++ b/src/devhostagent/Dockerfile @@ -1,10 +1,7 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build - -RUN tdnf clean all && \ - tdnf check-update && \ - tdnf upgrade -y +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT ARG MindaroBuildNumber=0.0 @@ -12,14 +9,14 @@ ARG MindaroBuildNumber=0.0 WORKDIR /src/devhostagent COPY /src/devhostagent/devhostAgent.csproj . COPY /src/common/common.csproj /src/common/ -RUN dotnet restore +RUN dotnet restore -a ${TARGETARCH} COPY /src/devhostagent/ /src/devhostagent/ COPY /src/common/ /src/common/ COPY /build/ /build/ ENV TelemetryType=${TelemetryType} ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} -RUN dotnet publish -c ${Configuration} -o /src/publish devhostAgent.csproj +RUN dotnet publish -c ${Configuration} -a ${TARGETARCH} --self-contained false --no-restore -o /src/publish devhostAgent.csproj # Final container FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final diff --git a/src/devhostagent/devhostAgent.csproj b/src/devhostagent/devhostAgent.csproj index 9800fec65..78e0b0663 100644 --- a/src/devhostagent/devhostAgent.csproj +++ b/src/devhostagent/devhostAgent.csproj @@ -6,7 +6,7 @@ net7.0 true true - linux-x64;linux-arm64;linux-musl-arm64;linux-musl-x64;win-x64 + linux-x64;linux-arm64;linux-musl-arm64;linux-musl-x64;win-x64;win-arm64 Microsoft.BridgeToKubernetes.DevHostAgent 1.0 Exe diff --git a/src/dsc/dsc.csproj b/src/dsc/dsc.csproj index 145afa784..1b2a7a2a6 100644 --- a/src/dsc/dsc.csproj +++ b/src/dsc/dsc.csproj @@ -3,7 +3,7 @@ Exe net7.0 true - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 portable dsc false diff --git a/src/endpointmanager/endpointmanager.csproj b/src/endpointmanager/endpointmanager.csproj index b41fba7d7..9fdbeccdb 100644 --- a/src/endpointmanager/endpointmanager.csproj +++ b/src/endpointmanager/endpointmanager.csproj @@ -3,7 +3,7 @@ net7.0 true - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 portable EndpointManager Exe diff --git a/src/library/library.csproj b/src/library/library.csproj index 9fcbee9a0..fd437e050 100644 --- a/src/library/library.csproj +++ b/src/library/library.csproj @@ -1,7 +1,7 @@  net7.0 - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 AnyCPU Microsoft.BridgeToKubernetes.Library Microsoft.BridgeToKubernetes.Library diff --git a/src/routingmanager/Constants.cs b/src/routingmanager/Constants.cs index f7268259d..87ea5e4d1 100644 --- a/src/routingmanager/Constants.cs +++ b/src/routingmanager/Constants.cs @@ -24,7 +24,7 @@ internal static class Constants // This label is used in user's original service to select over envoy pods public const string EntityLabel = Common.Constants.Routing.RoutingLabelPrefix + "entity"; - public const string EnvoyImageName = "envoyproxy/envoy:v1.14.1"; + public const string EnvoyImageName = "envoyproxy/envoy:v1.16.5"; public const string OriginalServiceSelectorAnnotation = Common.Constants.Routing.RoutingLabelPrefix + "originalServiceSelector"; public const string ClonedFromAnnotation = Common.Constants.Routing.RoutingLabelPrefix + "clonedFrom"; diff --git a/src/routingmanager/Dockerfile b/src/routingmanager/Dockerfile index 5505fc593..cf62c4a66 100644 --- a/src/routingmanager/Dockerfile +++ b/src/routingmanager/Dockerfile @@ -1,24 +1,28 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build - +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT ARG MindaroBuildNumber=0.0 + WORKDIR /src/routingmanager COPY /src/routingmanager/routingmanager.csproj . COPY /src/common/common.csproj /src/common/ -RUN dotnet restore +RUN dotnet restore -a ${TARGETARCH} COPY /src/routingmanager/ /src/routingmanager/ COPY /src/common/ /src/common/ COPY /build/ /build/ ENV TelemetryType=${TelemetryType} ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} -RUN dotnet publish -c ${Configuration} -o /src/publish +RUN dotnet publish -c ${Configuration} -a ${TARGETARCH} --self-contained false --no-restore -o /src/publish # Final container FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final +ARG TARGETARCH +ARG KUBECTL_VERSION=v1.27.3 +ARG INSTALL_LOCATION=/app/kubectl/linux # Setup common tools RUN tdnf clean all && \ @@ -31,7 +35,7 @@ RUN tdnf install -y \ COPY /build/setup-kubectl.sh . RUN chmod +x ./setup-kubectl.sh \ - && ./setup-kubectl.sh \ + && ./setup-kubectl.sh ${KUBECTL_VERSION} ${INSTALL_LOCATION} ${TARGETARCH} \ && rm -f ./setup-kubectl.sh WORKDIR /src/routingmanager diff --git a/src/routingmanager/routingmanager.csproj b/src/routingmanager/routingmanager.csproj index 33d4b98e5..e1b30e7fe 100644 --- a/src/routingmanager/routingmanager.csproj +++ b/src/routingmanager/routingmanager.csproj @@ -5,7 +5,7 @@ true Microsoft.BridgeToKubernetes.RoutingManager Microsoft.BridgeToKubernetes.RoutingManager - win-x64;osx-x64;osx-arm64;linux-x64;linux-arm64 + win-x64;win-arm64;osx-x64;osx-arm64;linux-x64;linux-arm64 AnyCPU portable true diff --git a/src/unittest.sln b/src/unittest.sln new file mode 100644 index 000000000..4f2a0fdbe --- /dev/null +++ b/src/unittest.sln @@ -0,0 +1,52 @@ + +Microsoft Visual Studio Solution File, Format Version 12.00 +# Visual Studio Version 17 +VisualStudioVersion = 17.0.31903.59 +MinimumVisualStudioVersion = 10.0.40219.1 +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "dsc.tests", "dsc.tests\dsc.tests.csproj", "{8BC5BADD-5E16-4144-820C-9714321C6AAD}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "common.tests", "common.tests\common.tests.csproj", "{74C94065-702C-474B-80CA-673572DF23E8}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "library.tests", "library.tests\library.tests.csproj", "{782EE760-1A03-40E4-BA3B-DEAE6E88B338}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "routingmanager.tests", "routingmanager.tests\routingmanager.tests.csproj", "{C7BE177D-7606-4C64-861E-CA8148F68D70}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "endpointmanager.tests", "endpointmanager.tests\endpointmanager.tests.csproj", "{F15D1D94-6F73-44FB-988B-2F429EE64108}" +EndProject +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "devhostAgent.restorationjob.tests", "devhostAgent.restorationjob.tests\devhostAgent.restorationjob.tests.csproj", "{0F2441A5-E65F-4F84-B8E9-D58252FEE771}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Any CPU = Debug|Any CPU + Release|Any CPU = Release|Any CPU + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {8BC5BADD-5E16-4144-820C-9714321C6AAD}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8BC5BADD-5E16-4144-820C-9714321C6AAD}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8BC5BADD-5E16-4144-820C-9714321C6AAD}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8BC5BADD-5E16-4144-820C-9714321C6AAD}.Release|Any CPU.Build.0 = Release|Any CPU + {74C94065-702C-474B-80CA-673572DF23E8}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {74C94065-702C-474B-80CA-673572DF23E8}.Debug|Any CPU.Build.0 = Debug|Any CPU + {74C94065-702C-474B-80CA-673572DF23E8}.Release|Any CPU.ActiveCfg = Release|Any CPU + {74C94065-702C-474B-80CA-673572DF23E8}.Release|Any CPU.Build.0 = Release|Any CPU + {782EE760-1A03-40E4-BA3B-DEAE6E88B338}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {782EE760-1A03-40E4-BA3B-DEAE6E88B338}.Debug|Any CPU.Build.0 = Debug|Any CPU + {782EE760-1A03-40E4-BA3B-DEAE6E88B338}.Release|Any CPU.ActiveCfg = Release|Any CPU + {782EE760-1A03-40E4-BA3B-DEAE6E88B338}.Release|Any CPU.Build.0 = Release|Any CPU + {C7BE177D-7606-4C64-861E-CA8148F68D70}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {C7BE177D-7606-4C64-861E-CA8148F68D70}.Debug|Any CPU.Build.0 = Debug|Any CPU + {C7BE177D-7606-4C64-861E-CA8148F68D70}.Release|Any CPU.ActiveCfg = Release|Any CPU + {C7BE177D-7606-4C64-861E-CA8148F68D70}.Release|Any CPU.Build.0 = Release|Any CPU + {F15D1D94-6F73-44FB-988B-2F429EE64108}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {F15D1D94-6F73-44FB-988B-2F429EE64108}.Debug|Any CPU.Build.0 = Debug|Any CPU + {F15D1D94-6F73-44FB-988B-2F429EE64108}.Release|Any CPU.ActiveCfg = Release|Any CPU + {F15D1D94-6F73-44FB-988B-2F429EE64108}.Release|Any CPU.Build.0 = Release|Any CPU + {0F2441A5-E65F-4F84-B8E9-D58252FEE771}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {0F2441A5-E65F-4F84-B8E9-D58252FEE771}.Debug|Any CPU.Build.0 = Debug|Any CPU + {0F2441A5-E65F-4F84-B8E9-D58252FEE771}.Release|Any CPU.ActiveCfg = Release|Any CPU + {0F2441A5-E65F-4F84-B8E9-D58252FEE771}.Release|Any CPU.Build.0 = Release|Any CPU + EndGlobalSection +EndGlobal \ No newline at end of file