From 50a8b2f8cf41ff38e72ade0e4d788f0d9a94393b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Fri, 7 Jul 2023 17:12:06 -0400 Subject: [PATCH 01/54] initial changes for including arm64 binaries --- azure-pipelines.yml | 541 +++++++++++++++++- .../endpointmanagerlauncher.csproj | 2 +- src/LocalAgent/LocalAgent.csproj | 2 +- src/common/common.csproj | 2 +- .../devhostAgent.restorationjob.csproj | 2 +- src/devhostagent/devhostAgent.csproj | 2 +- src/dsc/dsc.csproj | 2 +- src/endpointmanager/endpointmanager.csproj | 2 +- src/library/library.csproj | 2 +- src/routingmanager/routingmanager.csproj | 2 +- 10 files changed, 542 insertions(+), 17 deletions(-) diff --git a/azure-pipelines.yml b/azure-pipelines.yml index d0a1ce0f..c743119b 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 @@ -593,6 +841,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 +870,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 +890,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 +912,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 +932,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 +950,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 +969,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 +1055,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 +1145,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 +1239,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 +1297,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 +1311,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 +1325,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 +1353,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 +1369,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 +1385,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/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj b/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj index e84d7e08..c0568e67 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 16d0066d..fe8a047a 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/common.csproj b/src/common/common.csproj index 2fb2b90b..9f5251ac 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/devhostAgent.restorationjob.csproj b/src/devhostagent.restorationjob/devhostAgent.restorationjob.csproj index a867d5ef..ce39ec3e 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/devhostAgent.csproj b/src/devhostagent/devhostAgent.csproj index 9800fec6..78e0b066 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 145afa78..1b2a7a2a 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 b41fba7d..9fdbeccd 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 9fcbee9a..fd437e05 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/routingmanager.csproj b/src/routingmanager/routingmanager.csproj index 33d4b98e..e1b30e7f 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 From ad7e502414bf3d9e90f97ebc4092f458dbc3546a Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 10:51:11 -0400 Subject: [PATCH 02/54] changes for arm64 for build pipelines --- .github/workflows/release.yml | 2 +- azure-pipelines.yml | 9 +++ build-pipelines-PR.yml | 111 ++++++++++++++++++++++++++++++++++ 3 files changed, 121 insertions(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 253ad41a..cace9a0e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ 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] steps: - uses: actions/checkout@v3 - name: Setup .NET diff --git a/azure-pipelines.yml b/azure-pipelines.yml index c743119b..1d160739 100644 --- a/azure-pipelines.yml +++ b/azure-pipelines.yml @@ -715,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: diff --git a/build-pipelines-PR.yml b/build-pipelines-PR.yml index 90d12a01..8b083bb8 100644 --- a/build-pipelines-PR.yml +++ b/build-pipelines-PR.yml @@ -72,6 +72,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 @@ -124,6 +134,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 @@ -135,6 +156,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 @@ -146,6 +178,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 @@ -157,6 +200,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: @@ -166,6 +220,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) @@ -198,6 +261,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 @@ -229,6 +302,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: @@ -238,6 +322,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: @@ -247,6 +340,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: @@ -256,4 +358,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 ... From 02df4873c31c785fc34b45ce44c5ba6082fcbab4 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 11:53:32 -0400 Subject: [PATCH 03/54] add arm64 steps to workflow --- .github/workflows/release.yml | 49 +++++++++++++++++++++++++++++++---- 1 file changed, 44 insertions(+), 5 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index cace9a0e..ea3c4eda 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,25 +23,37 @@ jobs: run: dotnet publish src\EndpointManagerLauncher\endpointmanagerlauncher.csproj -r win-x64 -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' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe' + $dir = 'win' + $file = 'kubectl.exe' + } elseif ('${{ matrix.mode }}' -eq 'win-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/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' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl' + $dir = 'osx' + $file = 'kubectl' + } elseif ('${{ matrix.mode }}' -eq 'osx-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl' $dir = 'osx' $file = 'kubectl' + } elseif ('${{ matrix.mode }}' -eq 'linux-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl' + $dir = 'linux' + $file = 'kubectl' } else { - $url = 'https://storage.googleapis.com/kubernetes-release/release/v1.21.2/bin/linux/amd64/kubectl' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl' $dir = 'linux' $file = 'kubectl' } @@ -99,6 +111,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 +129,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 +147,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 From c5cb9d96f29e13446fce71290d27b9bb439c2b1b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 12:01:21 -0400 Subject: [PATCH 04/54] add if condition to cover EPM launcher --- .github/workflows/release.yml | 3 ++- .vscode/settings.json | 3 +++ 2 files changed, 5 insertions(+), 1 deletion(-) create mode 100644 .vscode/settings.json diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ea3c4eda..be67a143 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,8 @@ 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' || matrix.mode == 'win-arm64'}} diff --git a/.vscode/settings.json b/.vscode/settings.json new file mode 100644 index 00000000..89be5ba2 --- /dev/null +++ b/.vscode/settings.json @@ -0,0 +1,3 @@ +{ + "dotnet.defaultSolution": "src/all.sln" +} \ No newline at end of file From a50e7af6e5a2eb8fe4d171563e5c8d2c0307da9b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 12:26:06 -0400 Subject: [PATCH 05/54] set validation level for GH release --- .github/workflows/release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be67a143..7bddb10d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,6 +91,7 @@ jobs: id: changelog_reader uses: mindsers/changelog-reader-action@v2 with: + validation_level: error path: ./CHANGELOG.md - name: Create Release id: create_release From 73ba95e2886e31bab233d7df2994ce645fe93b01 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 14:30:48 -0400 Subject: [PATCH 06/54] remove error warning --- .github/workflows/release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 7bddb10d..be67a143 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -91,7 +91,6 @@ jobs: id: changelog_reader uses: mindsers/changelog-reader-action@v2 with: - validation_level: error path: ./CHANGELOG.md - name: Create Release id: create_release From c80066890795cbc0f9cbf733871b2bff305f372b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 18 Jul 2023 15:24:39 -0400 Subject: [PATCH 07/54] remove settings json --- .vscode/settings.json | 3 --- 1 file changed, 3 deletions(-) delete mode 100644 .vscode/settings.json diff --git a/.vscode/settings.json b/.vscode/settings.json deleted file mode 100644 index 89be5ba2..00000000 --- a/.vscode/settings.json +++ /dev/null @@ -1,3 +0,0 @@ -{ - "dotnet.defaultSolution": "src/all.sln" -} \ No newline at end of file From 83f031a6ac3679580f41450e83beadd3feee125f Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 20 Jul 2023 16:17:31 +0000 Subject: [PATCH 08/54] add arch variables to support arm64 images --- src/devhostagent/Dockerfile | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/devhostagent/Dockerfile b/src/devhostagent/Dockerfile index 960b5239..04b130ad 100644 --- a/src/devhostagent/Dockerfile +++ b/src/devhostagent/Dockerfile @@ -1,5 +1,6 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG ARCH=amd64 +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build RUN tdnf clean all && \ tdnf check-update && \ @@ -22,7 +23,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /src/publish devhostAgent.csproj # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final RUN tdnf clean all && \ tdnf check-update && \ From 78e99a57b4c2da784a2300f8cf85f891e16d9d6e Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 20 Jul 2023 16:37:00 +0000 Subject: [PATCH 09/54] changes for arm64 for restore and routing manager --- src/devhostagent.restorationjob/Dockerfile | 5 +++-- src/routingmanager/Dockerfile | 5 +++-- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/src/devhostagent.restorationjob/Dockerfile b/src/devhostagent.restorationjob/Dockerfile index 76b1b7e0..f1aa330f 100644 --- a/src/devhostagent.restorationjob/Dockerfile +++ b/src/devhostagent.restorationjob/Dockerfile @@ -1,5 +1,6 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG ARCH=amd64 +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT @@ -18,7 +19,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /output devhostAgent.restorationjob.csproj # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final # Setup common tools RUN tdnf clean all && \ diff --git a/src/routingmanager/Dockerfile b/src/routingmanager/Dockerfile index 5505fc59..cebbd20f 100644 --- a/src/routingmanager/Dockerfile +++ b/src/routingmanager/Dockerfile @@ -1,5 +1,6 @@ # Build container -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG ARCH=amd64 +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT @@ -18,7 +19,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /src/publish # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final # Setup common tools RUN tdnf clean all && \ From cdb8a8b2d6171566980d85b1d8f1b4abef7436fa Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 11 Oct 2023 19:38:22 +0000 Subject: [PATCH 10/54] changes to pull arm64 images based on node arch --- src/common/Constants.cs | 12 ++++++ src/common/Kubernetes/IKubernetesClient.cs | 7 ++++ src/common/Kubernetes/KubernetesClient.cs | 23 +++++++++- src/library/ImageProvider.cs | 49 +++++++++++++++------- 4 files changed, 73 insertions(+), 18 deletions(-) diff --git a/src/common/Constants.cs b/src/common/Constants.cs index bac25ccf..215e3f9e 100644 --- a/src/common/Constants.cs +++ b/src/common/Constants.cs @@ -219,6 +219,18 @@ internal static class ManagedIdentity internal static class ImageName { public const string RemoteAgentImageName = "lpkremoteagent"; + public const string RestorationJobImageName = "lpkrestorationjob"; + } + + internal static class ImageTag + { + public const string RoutingManagerImageTag = "stable"; + } + + internal static class Architecture + { + public const string Arm64 = "arm64"; + public const string Amd64 = "amd64"; } internal static class Https diff --git a/src/common/Kubernetes/IKubernetesClient.cs b/src/common/Kubernetes/IKubernetesClient.cs index 36f377ae..04d780e0 100644 --- a/src/common/Kubernetes/IKubernetesClient.cs +++ b/src/common/Kubernetes/IKubernetesClient.cs @@ -133,6 +133,13 @@ internal interface IKubernetesClient /// Task ListNamespacesAsync(IEnumerable> labels = null, CancellationToken cancellationToken = default(CancellationToken)); + /// + /// Retrieve the list of k8s nodes. + /// + /// + /// + Task ListNodes(CancellationToken cancellationToken = default); + #region Pods /// diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index b4b0a63b..0968ac53 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -107,6 +107,25 @@ public KubernetesClient( #endregion List namespaces + #region List nodes + + /// + /// + /// + /// + /// + public async Task ListNodes(CancellationToken cancellationToken = default) + { + var result = await ClientInvokeWrapperAsync(async () => + { + return await RestClient.CoreV1.ListNodeAsync(cancellationToken: cancellationToken); + }, nameof(ListNodes), cancellationToken); + + return result?.Items == null ? new V1NodeList(new List()) : result; + } + + #endregion List nodes + #region Deployments /// @@ -399,7 +418,7 @@ await RestClient.CoreV1.ListServiceForAllNamespacesAsync(labelSelector: labelSel } catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.Conflict) { - try + try { _log.Warning("Initial CreateNamespacedServiceAsync failed, deleting namespace"); await RestClient.CoreV1.DeleteNamespacedServiceAsync(service.Metadata.Name, namespaceName); @@ -1015,7 +1034,7 @@ public async Task> GetContainerEnvironmentAsync(stri $"exec {podName} -c {containerName} -n {namespaceName} -- env", onStdOut: outputHandler, onStdErr: (string error) => errorSb.Append(error), - cancellationToken:cancellationToken); + cancellationToken: cancellationToken); if (exitCode == 0) { return true; diff --git a/src/library/ImageProvider.cs b/src/library/ImageProvider.cs index f55a1249..9c1bf120 100644 --- a/src/library/ImageProvider.cs +++ b/src/library/ImageProvider.cs @@ -5,7 +5,11 @@ using System; using System.Collections.Generic; +using System.Linq; +using System.Threading.Tasks; +using k8s.Models; using Microsoft.BridgeToKubernetes.Common; +using Microsoft.BridgeToKubernetes.Common.Kubernetes; using Microsoft.BridgeToKubernetes.Common.Logging; using Microsoft.BridgeToKubernetes.Library.Utilities; @@ -16,6 +20,8 @@ internal class ImageProvider : IImageProvider private readonly ILog _log; private readonly IEnvironmentVariables _environmentVariables; + private readonly IKubernetesClient _kubernetesClient; + private Lazy _devHostImage; private Lazy _devHostRestorationJobImage; private Lazy _routingManagerImage; @@ -33,13 +39,11 @@ internal static class DevHost { // To change DevHostImageName tag, please update deployment\settings\services\imagetag.setting accordingly // During development, use environment variable LPK_DEVHOSTIMAGENAME to override the default devhostAgent image name - private static Lazy _name = new Lazy(() => - { - string tag = EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_TAG"); - return $"{Common.Constants.ImageName.RemoteAgentImageName}:{tag}"; - }); - public static string Name => _name.Value; + private static Lazy _tag = new(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_TAG")); + public static string Version => _tag.Value; + + public static string Name => Common.Constants.ImageName.RemoteAgentImageName; /// /// These entrypoints are supported by the devhostAgent image - they all point to the same start entrypoint. @@ -62,41 +66,54 @@ internal static class DevHostRestorationJob { // To change RestorationJobImageName tag, please update deployment\settings\services\imagetag.setting accordingly // During development, use environment variable LPK_RESTORATIONJOBIMAGENAME to override the default restorationjob image name - private static Lazy _tag = new Lazy(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG")); + private static Lazy _tag = new(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG")); public static string Version => _tag.Value; - internal static string Name => $"lpkrestorationjob:{_tag.Value}"; + internal static string Name => Common.Constants.ImageName.RestorationJobImageName; } private static class RoutingManager { - internal static string Name => $"{Common.Constants.Routing.RoutingManagerNameLower}:stable"; + public static string Version => Common.Constants.ImageTag.RoutingManagerImageTag; + internal static string Name => Common.Constants.Routing.RoutingManagerNameLower; } - public ImageProvider(ILog log, IEnvironmentVariables environmentVariables) + public ImageProvider(ILog log, IEnvironmentVariables environmentVariables, IKubernetesClient kubernetesClient) { _log = log; _environmentVariables = environmentVariables; + _kubernetesClient = kubernetesClient; + + // determine if nodes are running arm architecture + Task nodes = _kubernetesClient.ListNodes(); + nodes.Wait(); + bool isAllNodesArmArch = nodes.Result.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); - _devHostImage = new Lazy(() => GetImage(_environmentVariables.DevHostImageName, DevHost.Name)); - _devHostRestorationJobImage = new Lazy(() => GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name)); - _routingManagerImage = new Lazy(() => GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name)); + + _devHostImage = new Lazy(() => GetImage(_environmentVariables.DevHostImageName, DevHost.Name, DevHost.Version, isAllNodesArmArch)); + _devHostRestorationJobImage = new Lazy(() => GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name, DevHostRestorationJob.Version, isAllNodesArmArch)); + _routingManagerImage = new Lazy(() => GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name, RoutingManager.Version ,isAllNodesArmArch)); } public string DevHostImage => _devHostImage.Value; public string DevHostRestorationJobImage => _devHostRestorationJobImage.Value; public string RoutingManagerImage => _routingManagerImage.Value; - private string GetImage(string overrideImage, string defaultImage) + private string GetImage(string overrideImage, string defaultImage, string tag, bool isAllNodesArmArch) { if (!string.IsNullOrWhiteSpace(overrideImage)) { _log.Warning($"Overriding default image '{defaultImage}' with '{overrideImage}'"); - return overrideImage; + return isAllNodesArmArch ? overrideImage + "-arm64" : overrideImage; + } + + if (isAllNodesArmArch) + { + return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}-arm64:{tag}"; } - return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}"; + return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}:{tag}"; } } } \ No newline at end of file From b81b9f9b6c59518fd10453a2a218e6d3e145cf3b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 11 Oct 2023 19:57:14 +0000 Subject: [PATCH 11/54] override image changes --- src/library/ImageProvider.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/library/ImageProvider.cs b/src/library/ImageProvider.cs index 9c1bf120..0e77ff86 100644 --- a/src/library/ImageProvider.cs +++ b/src/library/ImageProvider.cs @@ -105,7 +105,7 @@ private string GetImage(string overrideImage, string defaultImage, string tag, b if (!string.IsNullOrWhiteSpace(overrideImage)) { _log.Warning($"Overriding default image '{defaultImage}' with '{overrideImage}'"); - return isAllNodesArmArch ? overrideImage + "-arm64" : overrideImage; + return overrideImage; } if (isAllNodesArmArch) From 18c2e0cc3cf5bf931bb9363d04f38082d6a5f058 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 11 Oct 2023 20:55:06 +0000 Subject: [PATCH 12/54] rearrange doker instructions --- src/devhostagent.restorationjob/Dockerfile | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/src/devhostagent.restorationjob/Dockerfile b/src/devhostagent.restorationjob/Dockerfile index f1aa330f..3a3adf7c 100644 --- a/src/devhostagent.restorationjob/Dockerfile +++ b/src/devhostagent.restorationjob/Dockerfile @@ -30,12 +30,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 From 6db90d948286aef9114803b89cbb2cd0d5fe0cfe Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 12 Oct 2023 03:09:01 +0000 Subject: [PATCH 13/54] update todoapp to arm based and push to ACR --- samples/todo-app/database-api/Dockerfile | 5 +- samples/todo-app/deployment-arm.yaml | 224 +++++++++++++++++++++++ samples/todo-app/deployment.yaml | 8 +- samples/todo-app/frontend/Dockerfile | 3 +- samples/todo-app/stats-api/Dockerfile | 3 +- samples/todo-app/stats-worker/Dockerfile | 3 +- 6 files changed, 237 insertions(+), 9 deletions(-) create mode 100644 samples/todo-app/deployment-arm.yaml diff --git a/samples/todo-app/database-api/Dockerfile b/samples/todo-app/database-api/Dockerfile index f364455b..0c3ee009 100644 --- a/samples/todo-app/database-api/Dockerfile +++ b/samples/todo-app/database-api/Dockerfile @@ -1,8 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +ARG ARCH=amd64 +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} AS base 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-${ARCH} AS build WORKDIR /src COPY ["databaseApi.csproj", ""] RUN dotnet restore "./databaseApi.csproj" diff --git a/samples/todo-app/deployment-arm.yaml b/samples/todo-app/deployment-arm.yaml new file mode 100644 index 00000000..927c8851 --- /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 6f92bf05..1d0a2330 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:v2 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:v2 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:v2 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:v2 env: - name: MONGO_CONNECTION_STRING value: mongodb://todos-db diff --git a/samples/todo-app/frontend/Dockerfile b/samples/todo-app/frontend/Dockerfile index 480447ca..e7435998 100644 --- a/samples/todo-app/frontend/Dockerfile +++ b/samples/todo-app/frontend/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-api/Dockerfile b/samples/todo-app/stats-api/Dockerfile index 38f9ba8d..b5ed0c0c 100644 --- a/samples/todo-app/stats-api/Dockerfile +++ b/samples/todo-app/stats-api/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-worker/Dockerfile b/samples/todo-app/stats-worker/Dockerfile index 60a393ce..6ac3e7d3 100644 --- a/samples/todo-app/stats-worker/Dockerfile +++ b/samples/todo-app/stats-worker/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} WORKDIR /app COPY package*.json ./ From 50b1d4fa49ab04d4c1582ea1e28f3a1b185b001d Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 12 Oct 2023 16:05:07 +0000 Subject: [PATCH 14/54] update iamge provider to use lazyasync and client factory --- src/library/AppContainerConfig.cs | 10 +++++ .../IKubernetesManagementClient.cs | 8 ++++ .../KubernetesManagementClient.cs | 23 ++++++++++ src/library/ImageProvider.cs | 43 ++++++++++--------- src/library/Logging/Events.cs | 1 + 5 files changed, 65 insertions(+), 20 deletions(-) diff --git a/src/library/AppContainerConfig.cs b/src/library/AppContainerConfig.cs index 9661a611..41c40427 100644 --- a/src/library/AppContainerConfig.cs +++ b/src/library/AppContainerConfig.cs @@ -17,6 +17,7 @@ using Microsoft.BridgeToKubernetes.Common.Socket; using Microsoft.BridgeToKubernetes.Common.Utilities; using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; +using Microsoft.BridgeToKubernetes.Library.ClientFactory; using Microsoft.BridgeToKubernetes.Library.Connect; using Microsoft.BridgeToKubernetes.Library.Connect.Environment; using Microsoft.BridgeToKubernetes.Library.EndpointManagement; @@ -224,6 +225,15 @@ static AppContainerConfig() MacAddressHash = (c) => c.Resolve().MacAddressHash }); + builder.Register(c => + { + ManagementClientFactory.IsTelemetryEnabledCallback = c.Resolve().IsTelemetryEnabledCallback; // Set the IsTelemetryEnabled callback, in order to instantiate the SDK with the same telemetry collection settings as the CLI + ManagementClientFactory.IsLogFileEnabled = c.Resolve().LogFileEnabled; + return new ManagementClientFactory(c.Resolve().UserAgent, c.Resolve().CorrelationId); + }) + .As() + .SingleInstance(); + // Common Module builder.RegisterModule(); diff --git a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs index 4ea697f6..1e350601 100644 --- a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs +++ b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs @@ -7,6 +7,7 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; +using k8s.Models; using Microsoft.BridgeToKubernetes.Library.Models; namespace Microsoft.BridgeToKubernetes.Library.Client.ManagementClients @@ -48,6 +49,13 @@ public interface IKubernetesManagementClient : IDisposable /// Task>> ListServicesInNamespacesAsync(string namespaceName, CancellationToken cancellationToken, bool excludeSystemServices = true); + /// + /// List all nodes in the cluster + /// + /// + /// + Task> ListNodes(CancellationToken cancellationToken); + /// /// Lists all the public Urls in the specified namespace /// diff --git a/src/library/Client/ManagementClients/KubernetesManagementClient.cs b/src/library/Client/ManagementClients/KubernetesManagementClient.cs index 310933a7..b725bc76 100644 --- a/src/library/Client/ManagementClients/KubernetesManagementClient.cs +++ b/src/library/Client/ManagementClients/KubernetesManagementClient.cs @@ -207,6 +207,29 @@ public async Task>> ListServicesInNamespac new PII(namespaceName))); } + public async Task> ListNodes(CancellationToken cancellationToken) + { + return await this._managementClientExceptionStrategy.RunWithHandlingAsync( + async () => + { + using (var perfLogger = _log.StartPerformanceLogger( + Events.KubernetesManagementClient.AreaName, + Events.KubernetesManagementClient.Operations.ListNodes)) + { + V1NodeList result = await _kubernetesRestClientExceptionStrategy.RunWithHandlingAsync( + async () => + { + return await _kubernetesClient.ListNodes(cancellationToken: cancellationToken); + }, + new KubernetesRestClientExceptionStrategy.FailureConfig("Failed to list nodes.")); + + perfLogger.SetSucceeded(); + return new OperationResponse(result, _operationContext); + } + }, + new ManagementClientExceptionStrategy.FailureConfig("Failed to list nodes.")); + } + public async Task>> ListPublicUrlsInNamespaceAsync(string namespaceName, CancellationToken cancellationToken, string routingHeaderValue = null) { return await this._managementClientExceptionStrategy.RunWithHandlingAsync( diff --git a/src/library/ImageProvider.cs b/src/library/ImageProvider.cs index 0e77ff86..0f59bfcd 100644 --- a/src/library/ImageProvider.cs +++ b/src/library/ImageProvider.cs @@ -6,11 +6,15 @@ using System; using System.Collections.Generic; using System.Linq; +using System.Threading; using System.Threading.Tasks; using k8s.Models; using Microsoft.BridgeToKubernetes.Common; using Microsoft.BridgeToKubernetes.Common.Kubernetes; using Microsoft.BridgeToKubernetes.Common.Logging; +using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; +using Microsoft.BridgeToKubernetes.Library.ClientFactory; +using Microsoft.BridgeToKubernetes.Library.ManagementClients; using Microsoft.BridgeToKubernetes.Library.Utilities; namespace Microsoft.BridgeToKubernetes.Library @@ -20,11 +24,11 @@ internal class ImageProvider : IImageProvider private readonly ILog _log; private readonly IEnvironmentVariables _environmentVariables; - private readonly IKubernetesClient _kubernetesClient; + private readonly IKubernetesManagementClient _kubernetesManagementClient; - private Lazy _devHostImage; - private Lazy _devHostRestorationJobImage; - private Lazy _routingManagerImage; + private AsyncLazy _devHostImage; + private AsyncLazy _devHostRestorationJobImage; + private AsyncLazy _routingManagerImage; private static readonly IReadOnlyDictionary ContainerRegistries = new Dictionary() { @@ -79,29 +83,28 @@ private static class RoutingManager internal static string Name => Common.Constants.Routing.RoutingManagerNameLower; } - public ImageProvider(ILog log, IEnvironmentVariables environmentVariables, IKubernetesClient kubernetesClient) + public ImageProvider(ILog log, IEnvironmentVariables environmentVariables, IManagementClientFactory managementClientFactory) { _log = log; _environmentVariables = environmentVariables; - _kubernetesClient = kubernetesClient; - - // determine if nodes are running arm architecture - Task nodes = _kubernetesClient.ListNodes(); - nodes.Wait(); - bool isAllNodesArmArch = nodes.Result.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); - - - _devHostImage = new Lazy(() => GetImage(_environmentVariables.DevHostImageName, DevHost.Name, DevHost.Version, isAllNodesArmArch)); - _devHostRestorationJobImage = new Lazy(() => GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name, DevHostRestorationJob.Version, isAllNodesArmArch)); - _routingManagerImage = new Lazy(() => GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name, RoutingManager.Version ,isAllNodesArmArch)); + var kubeConfigManagementClient = managementClientFactory.CreateKubeConfigClient(); + var kubeConfigDetails = kubeConfigManagementClient.GetKubeConfigDetails(); + _kubernetesManagementClient = managementClientFactory.CreateKubernetesManagementClient(kubeConfigDetails); + _devHostImage = new AsyncLazy(async () => await GetImage(_environmentVariables.DevHostImageName, DevHost.Name, DevHost.Version)); + _devHostRestorationJobImage = new AsyncLazy(async () => await GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name, DevHostRestorationJob.Version)); + _routingManagerImage = new AsyncLazy(async () => await GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name, RoutingManager.Version)); } - public string DevHostImage => _devHostImage.Value; - public string DevHostRestorationJobImage => _devHostRestorationJobImage.Value; - public string RoutingManagerImage => _routingManagerImage.Value; + public string DevHostImage => _devHostImage.GetAwaiter().GetResult(); + public string DevHostRestorationJobImage => _devHostRestorationJobImage.GetAwaiter().GetResult(); + public string RoutingManagerImage => _routingManagerImage.GetAwaiter().GetResult(); - private string GetImage(string overrideImage, string defaultImage, string tag, bool isAllNodesArmArch) + public async Task GetImage(string overrideImage, string defaultImage, string tag) { + // determine if nodes are running arm architecture + V1NodeList nodes = (await _kubernetesManagementClient.ListNodes(new CancellationToken())).Value; + bool isAllNodesArmArch = nodes.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); + if (!string.IsNullOrWhiteSpace(overrideImage)) { _log.Warning($"Overriding default image '{defaultImage}' with '{overrideImage}'"); diff --git a/src/library/Logging/Events.cs b/src/library/Logging/Events.cs index 95dd3b82..234d70ed 100644 --- a/src/library/Logging/Events.cs +++ b/src/library/Logging/Events.cs @@ -16,6 +16,7 @@ public static class Operations public const string CheckCredentialsAsync = "CheckCredentialsAsync"; public const string ListNamespacesAsync = "ListNamespacesAsync"; public const string ListServicesInNamespacesAsync = "ListServicesInNamespacesAsync"; + public const string ListNodes = "ListNodes"; public const string ListPublicUrlsInNamespaceAsync = "ListPublicUrlsInNamespaceAsync"; public const string GetRoutingHeaderValue = "GetRoutingHeaderValue"; public const string IsRoutingSupported = "IsRoutingSupported"; From 6983fb8d76ce2ccd174b03b120d2ae66a818ce9f Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 17 Oct 2023 01:50:20 +0000 Subject: [PATCH 15/54] changes needed for isolated mode --- build/setup-kubectl.sh | 42 +++++++++++++++++---------------- src/routingmanager/Constants.cs | 2 +- src/routingmanager/Dockerfile | 8 +++++-- 3 files changed, 29 insertions(+), 23 deletions(-) mode change 100644 => 100755 build/setup-kubectl.sh diff --git a/build/setup-kubectl.sh b/build/setup-kubectl.sh old mode 100644 new mode 100755 index 1f180053..8d7b7fae --- a/build/setup-kubectl.sh +++ b/build/setup-kubectl.sh @@ -1,31 +1,33 @@ #!/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 + # Map arm64v8 architecture to arm64 + if [ "$arch" == "arm64v8" ]; then + echo "setting arch to arm64" + arch="arm64" 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://storage.googleapis.com/kubernetes-release/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/src/routingmanager/Constants.cs b/src/routingmanager/Constants.cs index f7268259..87ea5e4d 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 cebbd20f..32f69e84 100644 --- a/src/routingmanager/Dockerfile +++ b/src/routingmanager/Dockerfile @@ -1,10 +1,10 @@ # Build container ARG ARCH=amd64 FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build - ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT ARG MindaroBuildNumber=0.0 +ARG ARCH WORKDIR /src/routingmanager COPY /src/routingmanager/routingmanager.csproj . @@ -21,6 +21,10 @@ RUN dotnet publish -c ${Configuration} -o /src/publish # Final container FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final +ARG ARCH +ARG KUBECTL_VERSION=v1.27.3 +ARG INSTALL_LOCATION=/app/kubectl/linux + # Setup common tools RUN tdnf clean all && \ tdnf check-update && \ @@ -32,7 +36,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} ${ARCH} \ && rm -f ./setup-kubectl.sh WORKDIR /src/routingmanager From 0e43a11eeb6b86e8b786e3d97417580bfdeb2747 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 17 Oct 2023 20:48:07 +0000 Subject: [PATCH 16/54] fix failing UT's. --- src/library.tests/EmbeddedFileTests.cs | 58 ++++++++++++++++++++++++-- src/library/ImageProvider.cs | 16 ++++--- 2 files changed, 64 insertions(+), 10 deletions(-) diff --git a/src/library.tests/EmbeddedFileTests.cs b/src/library.tests/EmbeddedFileTests.cs index 6ceb23ec..09e6be48 100644 --- a/src/library.tests/EmbeddedFileTests.cs +++ b/src/library.tests/EmbeddedFileTests.cs @@ -4,8 +4,17 @@ // -------------------------------------------------------------------------------------------- using System; +using System.Threading; +using System.Threading.Tasks; +using FakeItEasy; +using k8s.Models; +using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; +using Microsoft.BridgeToKubernetes.Library.ClientFactory; +using Microsoft.BridgeToKubernetes.Library.ManagementClients; +using Microsoft.BridgeToKubernetes.Library.Models; using Microsoft.BridgeToKubernetes.TestHelpers; using Xunit; +using static Microsoft.BridgeToKubernetes.Common.Constants; namespace Microsoft.BridgeToKubernetes.Library.Tests { @@ -14,22 +23,60 @@ namespace Microsoft.BridgeToKubernetes.Library.Tests /// public class EmbeddedFileTests : TestsBase { - private readonly ImageProvider _imageProvider; + private ImageProvider _imageProvider; + private readonly IManagementClientFactory _managementClientFactory = A.Fake(); + private readonly IKubeConfigManagementClient _kubeConfigManagementClient = A.Fake(); + private readonly IKubernetesManagementClient _kubernetesManagementClient = A.Fake(); public EmbeddedFileTests() { + _managementClientFactory = _autoFake.Resolve(); + _autoFake.Provide(_managementClientFactory); + _autoFake.Provide(_kubeConfigManagementClient); + _autoFake.Provide(_kubernetesManagementClient); + A.CallTo(() => _managementClientFactory.CreateKubeConfigClient(A.Ignored)).Returns(_kubeConfigManagementClient); + A.CallTo(() => _kubeConfigManagementClient.GetKubeConfigDetails()).Returns(new KubeConfigDetails("", null, null, null, null)); + A.CallTo(() => _managementClientFactory.CreateKubernetesManagementClient(A.Ignored)).Returns(_kubernetesManagementClient); + A.CallTo(() => _kubernetesManagementClient.ListNodes(A._)).Returns(CreateV1NodeList()); _imageProvider = _autoFake.Resolve(); } [Fact] - public void DevHostAgentImageTag() - => ImageTagTest(() => _imageProvider.DevHostImage); + public void DevHostAgentImageTag() { + ImageTagTest(() => _imageProvider.DevHostImage); + } [Fact] public void RestorationJobImageTag() => ImageTagTest(() => _imageProvider.DevHostRestorationJobImage); - private static void ImageTagTest(Func tagProperty) + [Fact] + public void RoutingManagerImageTag() + => ImageTagTest(() => _imageProvider.RoutingManagerImage); + + [Fact] + public void DevHostAgentImageTagForArmArch() { + ImageTagTest(() => _imageProvider.DevHostImage, true); + } + + private static Task> CreateV1NodeList() + { + var v1NodeList = new V1NodeList(); + var v1Node = new V1Node(); + var v1NodeStatus = new V1NodeStatus + { + NodeInfo = new V1NodeSystemInfo() + }; + v1NodeStatus.NodeInfo.Architecture = Architecture.Arm64.ToString(); + v1Node.Status = v1NodeStatus; + v1NodeList.Items = new System.Collections.Generic.List + { + v1Node + }; + return Task.FromResult(new OperationResponse(v1NodeList, null)); + } + + private static void ImageTagTest(Func tagProperty, bool isArmArch = false) { string image = tagProperty.Invoke(); Assert.False(string.IsNullOrWhiteSpace(image)); @@ -37,6 +84,9 @@ private static void ImageTagTest(Func tagProperty) Assert.NotEqual(-1, i); string tag = image.Substring(i + 1); Assert.False(string.IsNullOrWhiteSpace(tag)); + if (isArmArch) { + Assert.Contains("-"+Architecture.Arm64.ToString(), image); + } } } } \ No newline at end of file diff --git a/src/library/ImageProvider.cs b/src/library/ImageProvider.cs index 0f59bfcd..62a0f9f4 100644 --- a/src/library/ImageProvider.cs +++ b/src/library/ImageProvider.cs @@ -10,11 +10,9 @@ using System.Threading.Tasks; using k8s.Models; using Microsoft.BridgeToKubernetes.Common; -using Microsoft.BridgeToKubernetes.Common.Kubernetes; using Microsoft.BridgeToKubernetes.Common.Logging; using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; using Microsoft.BridgeToKubernetes.Library.ClientFactory; -using Microsoft.BridgeToKubernetes.Library.ManagementClients; using Microsoft.BridgeToKubernetes.Library.Utilities; namespace Microsoft.BridgeToKubernetes.Library @@ -101,16 +99,22 @@ public ImageProvider(ILog log, IEnvironmentVariables environmentVariables, IMana public async Task GetImage(string overrideImage, string defaultImage, string tag) { - // determine if nodes are running arm architecture - V1NodeList nodes = (await _kubernetesManagementClient.ListNodes(new CancellationToken())).Value; - bool isAllNodesArmArch = nodes.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); - if (!string.IsNullOrWhiteSpace(overrideImage)) { _log.Warning($"Overriding default image '{defaultImage}' with '{overrideImage}'"); return overrideImage; } + // determine if nodes are running arm architecture + V1NodeList nodes = (await _kubernetesManagementClient.ListNodes(new CancellationToken())).Value; + // this can never happen or timed out while getting nodes + if (nodes?.Items == null || !nodes.Items.Any()) + { + _log.Warning($"No nodes found in cluster. Using default image '{defaultImage}' with '{tag}'"); + return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}:{tag}"; + } + bool isAllNodesArmArch = nodes.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); + if (isAllNodesArmArch) { return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}-arm64:{tag}"; From 0c09970f94226a789c87db29eccc1743281800d3 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 18 Oct 2023 18:58:13 +0000 Subject: [PATCH 17/54] revert back to previous commit and add acr workflow --- .github/workflows/acr-build-publish.yml | 43 ++++++++++++ build/setup-kubectl.sh | 4 +- src/common/Constants.cs | 12 ---- src/common/Kubernetes/IKubernetesClient.cs | 7 -- src/common/Kubernetes/KubernetesClient.cs | 19 ------ src/devhostagent.restorationjob/Dockerfile | 5 +- src/devhostagent/Dockerfile | 5 +- src/library.tests/EmbeddedFileTests.cs | 58 ++-------------- src/library/AppContainerConfig.cs | 9 --- .../IKubernetesManagementClient.cs | 7 -- .../KubernetesManagementClient.cs | 23 ------- src/library/ImageProvider.cs | 68 ++++++------------- src/routingmanager/Dockerfile | 4 +- 13 files changed, 77 insertions(+), 187 deletions(-) create mode 100644 .github/workflows/acr-build-publish.yml diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml new file mode 100644 index 00000000..09380ffb --- /dev/null +++ b/.github/workflows/acr-build-publish.yml @@ -0,0 +1,43 @@ +name: build and push to acr +on: [workflow_dispatch] + +jobs: + docker: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + registry: "mindarodev.azurecr.io" + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + + - name: Build and push for devhostagent + uses: docker/build-push-action@v5 + with: + file: src/devhostagent/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: mindarodev.azurecr.io/lpkremoteagent:latest + + - name: Build and push for devhostagent.restorationjob + uses: docker/build-push-action@v5 + with: + file: src/devhostagent.restorationjob/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: mindarodev.azurecr.io/lpkrestorationjob:latest + + - name: Build and push for routingmanager + uses: docker/build-push-action@v5 + with: + file: src/routingmanager/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: mindarodev.azurecr.io/routingmanager:latest diff --git a/build/setup-kubectl.sh b/build/setup-kubectl.sh index 8d7b7fae..a564deff 100755 --- a/build/setup-kubectl.sh +++ b/build/setup-kubectl.sh @@ -20,8 +20,8 @@ function install_kubectl { arch="arm64" fi - echo "Setting up kubectl $kubectl_version in $install_location with arch $arch" - curl -LO "https://storage.googleapis.com/kubernetes-release/release/$kubectl_version/bin/linux/$arch/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 "$install_location" mv kubectl "$install_location" diff --git a/src/common/Constants.cs b/src/common/Constants.cs index 215e3f9e..bac25ccf 100644 --- a/src/common/Constants.cs +++ b/src/common/Constants.cs @@ -219,18 +219,6 @@ internal static class ManagedIdentity internal static class ImageName { public const string RemoteAgentImageName = "lpkremoteagent"; - public const string RestorationJobImageName = "lpkrestorationjob"; - } - - internal static class ImageTag - { - public const string RoutingManagerImageTag = "stable"; - } - - internal static class Architecture - { - public const string Arm64 = "arm64"; - public const string Amd64 = "amd64"; } internal static class Https diff --git a/src/common/Kubernetes/IKubernetesClient.cs b/src/common/Kubernetes/IKubernetesClient.cs index 04d780e0..36f377ae 100644 --- a/src/common/Kubernetes/IKubernetesClient.cs +++ b/src/common/Kubernetes/IKubernetesClient.cs @@ -133,13 +133,6 @@ internal interface IKubernetesClient /// Task ListNamespacesAsync(IEnumerable> labels = null, CancellationToken cancellationToken = default(CancellationToken)); - /// - /// Retrieve the list of k8s nodes. - /// - /// - /// - Task ListNodes(CancellationToken cancellationToken = default); - #region Pods /// diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index 0968ac53..3e189dc2 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -107,25 +107,6 @@ public KubernetesClient( #endregion List namespaces - #region List nodes - - /// - /// - /// - /// - /// - public async Task ListNodes(CancellationToken cancellationToken = default) - { - var result = await ClientInvokeWrapperAsync(async () => - { - return await RestClient.CoreV1.ListNodeAsync(cancellationToken: cancellationToken); - }, nameof(ListNodes), cancellationToken); - - return result?.Items == null ? new V1NodeList(new List()) : result; - } - - #endregion List nodes - #region Deployments /// diff --git a/src/devhostagent.restorationjob/Dockerfile b/src/devhostagent.restorationjob/Dockerfile index 3a3adf7c..b664be5c 100644 --- a/src/devhostagent.restorationjob/Dockerfile +++ b/src/devhostagent.restorationjob/Dockerfile @@ -1,6 +1,5 @@ # Build container -ARG ARCH=amd64 -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT @@ -19,7 +18,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /output devhostAgent.restorationjob.csproj # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final # Setup common tools RUN tdnf clean all && \ diff --git a/src/devhostagent/Dockerfile b/src/devhostagent/Dockerfile index 04b130ad..960b5239 100644 --- a/src/devhostagent/Dockerfile +++ b/src/devhostagent/Dockerfile @@ -1,6 +1,5 @@ # Build container -ARG ARCH=amd64 -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build RUN tdnf clean all && \ tdnf check-update && \ @@ -23,7 +22,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /src/publish devhostAgent.csproj # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final RUN tdnf clean all && \ tdnf check-update && \ diff --git a/src/library.tests/EmbeddedFileTests.cs b/src/library.tests/EmbeddedFileTests.cs index 09e6be48..6ceb23ec 100644 --- a/src/library.tests/EmbeddedFileTests.cs +++ b/src/library.tests/EmbeddedFileTests.cs @@ -4,17 +4,8 @@ // -------------------------------------------------------------------------------------------- using System; -using System.Threading; -using System.Threading.Tasks; -using FakeItEasy; -using k8s.Models; -using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; -using Microsoft.BridgeToKubernetes.Library.ClientFactory; -using Microsoft.BridgeToKubernetes.Library.ManagementClients; -using Microsoft.BridgeToKubernetes.Library.Models; using Microsoft.BridgeToKubernetes.TestHelpers; using Xunit; -using static Microsoft.BridgeToKubernetes.Common.Constants; namespace Microsoft.BridgeToKubernetes.Library.Tests { @@ -23,60 +14,22 @@ namespace Microsoft.BridgeToKubernetes.Library.Tests /// public class EmbeddedFileTests : TestsBase { - private ImageProvider _imageProvider; - private readonly IManagementClientFactory _managementClientFactory = A.Fake(); - private readonly IKubeConfigManagementClient _kubeConfigManagementClient = A.Fake(); - private readonly IKubernetesManagementClient _kubernetesManagementClient = A.Fake(); + private readonly ImageProvider _imageProvider; public EmbeddedFileTests() { - _managementClientFactory = _autoFake.Resolve(); - _autoFake.Provide(_managementClientFactory); - _autoFake.Provide(_kubeConfigManagementClient); - _autoFake.Provide(_kubernetesManagementClient); - A.CallTo(() => _managementClientFactory.CreateKubeConfigClient(A.Ignored)).Returns(_kubeConfigManagementClient); - A.CallTo(() => _kubeConfigManagementClient.GetKubeConfigDetails()).Returns(new KubeConfigDetails("", null, null, null, null)); - A.CallTo(() => _managementClientFactory.CreateKubernetesManagementClient(A.Ignored)).Returns(_kubernetesManagementClient); - A.CallTo(() => _kubernetesManagementClient.ListNodes(A._)).Returns(CreateV1NodeList()); _imageProvider = _autoFake.Resolve(); } [Fact] - public void DevHostAgentImageTag() { - ImageTagTest(() => _imageProvider.DevHostImage); - } + public void DevHostAgentImageTag() + => ImageTagTest(() => _imageProvider.DevHostImage); [Fact] public void RestorationJobImageTag() => ImageTagTest(() => _imageProvider.DevHostRestorationJobImage); - [Fact] - public void RoutingManagerImageTag() - => ImageTagTest(() => _imageProvider.RoutingManagerImage); - - [Fact] - public void DevHostAgentImageTagForArmArch() { - ImageTagTest(() => _imageProvider.DevHostImage, true); - } - - private static Task> CreateV1NodeList() - { - var v1NodeList = new V1NodeList(); - var v1Node = new V1Node(); - var v1NodeStatus = new V1NodeStatus - { - NodeInfo = new V1NodeSystemInfo() - }; - v1NodeStatus.NodeInfo.Architecture = Architecture.Arm64.ToString(); - v1Node.Status = v1NodeStatus; - v1NodeList.Items = new System.Collections.Generic.List - { - v1Node - }; - return Task.FromResult(new OperationResponse(v1NodeList, null)); - } - - private static void ImageTagTest(Func tagProperty, bool isArmArch = false) + private static void ImageTagTest(Func tagProperty) { string image = tagProperty.Invoke(); Assert.False(string.IsNullOrWhiteSpace(image)); @@ -84,9 +37,6 @@ private static void ImageTagTest(Func tagProperty, bool isArmArch = fals Assert.NotEqual(-1, i); string tag = image.Substring(i + 1); Assert.False(string.IsNullOrWhiteSpace(tag)); - if (isArmArch) { - Assert.Contains("-"+Architecture.Arm64.ToString(), image); - } } } } \ No newline at end of file diff --git a/src/library/AppContainerConfig.cs b/src/library/AppContainerConfig.cs index 41c40427..8eeff4d4 100644 --- a/src/library/AppContainerConfig.cs +++ b/src/library/AppContainerConfig.cs @@ -225,15 +225,6 @@ static AppContainerConfig() MacAddressHash = (c) => c.Resolve().MacAddressHash }); - builder.Register(c => - { - ManagementClientFactory.IsTelemetryEnabledCallback = c.Resolve().IsTelemetryEnabledCallback; // Set the IsTelemetryEnabled callback, in order to instantiate the SDK with the same telemetry collection settings as the CLI - ManagementClientFactory.IsLogFileEnabled = c.Resolve().LogFileEnabled; - return new ManagementClientFactory(c.Resolve().UserAgent, c.Resolve().CorrelationId); - }) - .As() - .SingleInstance(); - // Common Module builder.RegisterModule(); diff --git a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs index 1e350601..7ab6dab5 100644 --- a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs +++ b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs @@ -49,13 +49,6 @@ public interface IKubernetesManagementClient : IDisposable /// Task>> ListServicesInNamespacesAsync(string namespaceName, CancellationToken cancellationToken, bool excludeSystemServices = true); - /// - /// List all nodes in the cluster - /// - /// - /// - Task> ListNodes(CancellationToken cancellationToken); - /// /// Lists all the public Urls in the specified namespace /// diff --git a/src/library/Client/ManagementClients/KubernetesManagementClient.cs b/src/library/Client/ManagementClients/KubernetesManagementClient.cs index b725bc76..310933a7 100644 --- a/src/library/Client/ManagementClients/KubernetesManagementClient.cs +++ b/src/library/Client/ManagementClients/KubernetesManagementClient.cs @@ -207,29 +207,6 @@ public async Task>> ListServicesInNamespac new PII(namespaceName))); } - public async Task> ListNodes(CancellationToken cancellationToken) - { - return await this._managementClientExceptionStrategy.RunWithHandlingAsync( - async () => - { - using (var perfLogger = _log.StartPerformanceLogger( - Events.KubernetesManagementClient.AreaName, - Events.KubernetesManagementClient.Operations.ListNodes)) - { - V1NodeList result = await _kubernetesRestClientExceptionStrategy.RunWithHandlingAsync( - async () => - { - return await _kubernetesClient.ListNodes(cancellationToken: cancellationToken); - }, - new KubernetesRestClientExceptionStrategy.FailureConfig("Failed to list nodes.")); - - perfLogger.SetSucceeded(); - return new OperationResponse(result, _operationContext); - } - }, - new ManagementClientExceptionStrategy.FailureConfig("Failed to list nodes.")); - } - public async Task>> ListPublicUrlsInNamespaceAsync(string namespaceName, CancellationToken cancellationToken, string routingHeaderValue = null) { return await this._managementClientExceptionStrategy.RunWithHandlingAsync( diff --git a/src/library/ImageProvider.cs b/src/library/ImageProvider.cs index 62a0f9f4..f55a1249 100644 --- a/src/library/ImageProvider.cs +++ b/src/library/ImageProvider.cs @@ -5,14 +5,8 @@ using System; using System.Collections.Generic; -using System.Linq; -using System.Threading; -using System.Threading.Tasks; -using k8s.Models; using Microsoft.BridgeToKubernetes.Common; using Microsoft.BridgeToKubernetes.Common.Logging; -using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; -using Microsoft.BridgeToKubernetes.Library.ClientFactory; using Microsoft.BridgeToKubernetes.Library.Utilities; namespace Microsoft.BridgeToKubernetes.Library @@ -22,11 +16,9 @@ internal class ImageProvider : IImageProvider private readonly ILog _log; private readonly IEnvironmentVariables _environmentVariables; - private readonly IKubernetesManagementClient _kubernetesManagementClient; - - private AsyncLazy _devHostImage; - private AsyncLazy _devHostRestorationJobImage; - private AsyncLazy _routingManagerImage; + private Lazy _devHostImage; + private Lazy _devHostRestorationJobImage; + private Lazy _routingManagerImage; private static readonly IReadOnlyDictionary ContainerRegistries = new Dictionary() { @@ -41,11 +33,13 @@ internal static class DevHost { // To change DevHostImageName tag, please update deployment\settings\services\imagetag.setting accordingly // During development, use environment variable LPK_DEVHOSTIMAGENAME to override the default devhostAgent image name + private static Lazy _name = new Lazy(() => + { + string tag = EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_TAG"); + return $"{Common.Constants.ImageName.RemoteAgentImageName}:{tag}"; + }); - private static Lazy _tag = new(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_TAG")); - public static string Version => _tag.Value; - - public static string Name => Common.Constants.ImageName.RemoteAgentImageName; + public static string Name => _name.Value; /// /// These entrypoints are supported by the devhostAgent image - they all point to the same start entrypoint. @@ -68,36 +62,33 @@ internal static class DevHostRestorationJob { // To change RestorationJobImageName tag, please update deployment\settings\services\imagetag.setting accordingly // During development, use environment variable LPK_RESTORATIONJOBIMAGENAME to override the default restorationjob image name - private static Lazy _tag = new(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG")); + private static Lazy _tag = new Lazy(() => EmbeddedFileUtilities.GetImageTag("MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG")); public static string Version => _tag.Value; - internal static string Name => Common.Constants.ImageName.RestorationJobImageName; + internal static string Name => $"lpkrestorationjob:{_tag.Value}"; } private static class RoutingManager { - public static string Version => Common.Constants.ImageTag.RoutingManagerImageTag; - internal static string Name => Common.Constants.Routing.RoutingManagerNameLower; + internal static string Name => $"{Common.Constants.Routing.RoutingManagerNameLower}:stable"; } - public ImageProvider(ILog log, IEnvironmentVariables environmentVariables, IManagementClientFactory managementClientFactory) + public ImageProvider(ILog log, IEnvironmentVariables environmentVariables) { _log = log; _environmentVariables = environmentVariables; - var kubeConfigManagementClient = managementClientFactory.CreateKubeConfigClient(); - var kubeConfigDetails = kubeConfigManagementClient.GetKubeConfigDetails(); - _kubernetesManagementClient = managementClientFactory.CreateKubernetesManagementClient(kubeConfigDetails); - _devHostImage = new AsyncLazy(async () => await GetImage(_environmentVariables.DevHostImageName, DevHost.Name, DevHost.Version)); - _devHostRestorationJobImage = new AsyncLazy(async () => await GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name, DevHostRestorationJob.Version)); - _routingManagerImage = new AsyncLazy(async () => await GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name, RoutingManager.Version)); + + _devHostImage = new Lazy(() => GetImage(_environmentVariables.DevHostImageName, DevHost.Name)); + _devHostRestorationJobImage = new Lazy(() => GetImage(_environmentVariables.DevHostRestorationJobImageName, DevHostRestorationJob.Name)); + _routingManagerImage = new Lazy(() => GetImage(_environmentVariables.RoutingManagerImageName, RoutingManager.Name)); } - public string DevHostImage => _devHostImage.GetAwaiter().GetResult(); - public string DevHostRestorationJobImage => _devHostRestorationJobImage.GetAwaiter().GetResult(); - public string RoutingManagerImage => _routingManagerImage.GetAwaiter().GetResult(); + public string DevHostImage => _devHostImage.Value; + public string DevHostRestorationJobImage => _devHostRestorationJobImage.Value; + public string RoutingManagerImage => _routingManagerImage.Value; - public async Task GetImage(string overrideImage, string defaultImage, string tag) + private string GetImage(string overrideImage, string defaultImage) { if (!string.IsNullOrWhiteSpace(overrideImage)) { @@ -105,22 +96,7 @@ public async Task GetImage(string overrideImage, string defaultImage, st return overrideImage; } - // determine if nodes are running arm architecture - V1NodeList nodes = (await _kubernetesManagementClient.ListNodes(new CancellationToken())).Value; - // this can never happen or timed out while getting nodes - if (nodes?.Items == null || !nodes.Items.Any()) - { - _log.Warning($"No nodes found in cluster. Using default image '{defaultImage}' with '{tag}'"); - return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}:{tag}"; - } - bool isAllNodesArmArch = nodes.Items.All(node => node?.Status?.NodeInfo?.Architecture == Common.Constants.Architecture.Arm64); - - if (isAllNodesArmArch) - { - return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}-arm64:{tag}"; - } - - return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}:{tag}"; + return $"{ContainerRegistries[_environmentVariables.ReleaseEnvironment]}/{defaultImage}"; } } } \ No newline at end of file diff --git a/src/routingmanager/Dockerfile b/src/routingmanager/Dockerfile index 32f69e84..cb30ea6e 100644 --- a/src/routingmanager/Dockerfile +++ b/src/routingmanager/Dockerfile @@ -1,6 +1,6 @@ # Build container ARG ARCH=amd64 -FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0-${ARCH} AS build +FROM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build ARG Configuration=Release ARG TelemetryType=TELEMETRY_DEVELOPMENT ARG MindaroBuildNumber=0.0 @@ -19,7 +19,7 @@ ENV MINDARO_BUILD_NUMBER=${MindaroBuildNumber} RUN dotnet publish -c ${Configuration} -o /src/publish # Final container -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} as final +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 as final ARG ARCH ARG KUBECTL_VERSION=v1.27.3 From 5472fcc6ac21ef6f488af97172e79817c96ae08b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 18 Oct 2023 19:01:03 +0000 Subject: [PATCH 18/54] remove unused imports --- src/library/AppContainerConfig.cs | 1 - .../Client/ManagementClients/IKubernetesManagementClient.cs | 1 - 2 files changed, 2 deletions(-) diff --git a/src/library/AppContainerConfig.cs b/src/library/AppContainerConfig.cs index 8eeff4d4..9661a611 100644 --- a/src/library/AppContainerConfig.cs +++ b/src/library/AppContainerConfig.cs @@ -17,7 +17,6 @@ using Microsoft.BridgeToKubernetes.Common.Socket; using Microsoft.BridgeToKubernetes.Common.Utilities; using Microsoft.BridgeToKubernetes.Library.Client.ManagementClients; -using Microsoft.BridgeToKubernetes.Library.ClientFactory; using Microsoft.BridgeToKubernetes.Library.Connect; using Microsoft.BridgeToKubernetes.Library.Connect.Environment; using Microsoft.BridgeToKubernetes.Library.EndpointManagement; diff --git a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs index 7ab6dab5..4ea697f6 100644 --- a/src/library/Client/ManagementClients/IKubernetesManagementClient.cs +++ b/src/library/Client/ManagementClients/IKubernetesManagementClient.cs @@ -7,7 +7,6 @@ using System.Collections.Generic; using System.Threading; using System.Threading.Tasks; -using k8s.Models; using Microsoft.BridgeToKubernetes.Library.Models; namespace Microsoft.BridgeToKubernetes.Library.Client.ManagementClients From 4f81d46d9e063fd9736302f7af69f862bed37f5f Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 19:46:17 +0000 Subject: [PATCH 19/54] docker files changes to support multi arch --- .github/workflows/acr-build-publish.yml | 14 ++++++-------- build/setup-kubectl.sh | 6 ------ deployment/settings/services/imagetag.setting | 6 +++--- src/devhostagent.restorationjob/Dockerfile | 8 ++++---- src/devhostagent/Dockerfile | 11 ++++------- src/routingmanager/Dockerfile | 15 +++++++-------- 6 files changed, 24 insertions(+), 36 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 09380ffb..56c4efee 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -7,24 +7,22 @@ jobs: steps: - name: Checkout uses: actions/checkout@v4 - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 - name: Login to Docker Hub uses: docker/login-action@v3 with: - registry: "mindarodev.azurecr.io" + registry: ${{ secrets.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - + - name: Build and push for devhostagent uses: docker/build-push-action@v5 with: file: src/devhostagent/Dockerfile - platforms: linux/amd64,linux/arm64 + platforms: linux/arm64,linux-amd64 push: true - tags: mindarodev.azurecr.io/lpkremoteagent:latest + tags: ${{ secrets.ACR_REGISTRY }}/lpkremoteagent:1.3.4 - name: Build and push for devhostagent.restorationjob uses: docker/build-push-action@v5 @@ -32,7 +30,7 @@ jobs: file: src/devhostagent.restorationjob/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: mindarodev.azurecr.io/lpkrestorationjob:latest + tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest - name: Build and push for routingmanager uses: docker/build-push-action@v5 @@ -40,4 +38,4 @@ jobs: file: src/routingmanager/Dockerfile platforms: linux/amd64,linux/arm64 push: true - tags: mindarodev.azurecr.io/routingmanager:latest + tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest diff --git a/build/setup-kubectl.sh b/build/setup-kubectl.sh index a564deff..cb229922 100755 --- a/build/setup-kubectl.sh +++ b/build/setup-kubectl.sh @@ -14,12 +14,6 @@ function install_kubectl { install_location="${2:-$DEFAULT_INSTALL_LOCATION}" arch="${3:-$DEFAULT_ARCH}" - # Map arm64v8 architecture to arm64 - if [ "$arch" == "arm64v8" ]; then - echo "setting arch to arm64" - arch="arm64" - fi - 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 diff --git a/deployment/settings/services/imagetag.setting b/deployment/settings/services/imagetag.setting index 13749dca..b2b08cb3 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/src/devhostagent.restorationjob/Dockerfile b/src/devhostagent.restorationjob/Dockerfile index b664be5c..c7b01fbf 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 diff --git a/src/devhostagent/Dockerfile b/src/devhostagent/Dockerfile index 960b5239..aa8656f9 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/routingmanager/Dockerfile b/src/routingmanager/Dockerfile index cb30ea6e..cf62c4a6 100644 --- a/src/routingmanager/Dockerfile +++ b/src/routingmanager/Dockerfile @@ -1,27 +1,26 @@ # Build container -ARG ARCH=amd64 -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 -ARG ARCH + 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 ARCH +ARG TARGETARCH ARG KUBECTL_VERSION=v1.27.3 ARG INSTALL_LOCATION=/app/kubectl/linux @@ -36,7 +35,7 @@ RUN tdnf install -y \ COPY /build/setup-kubectl.sh . RUN chmod +x ./setup-kubectl.sh \ - && ./setup-kubectl.sh ${KUBECTL_VERSION} ${INSTALL_LOCATION} ${ARCH} \ + && ./setup-kubectl.sh ${KUBECTL_VERSION} ${INSTALL_LOCATION} ${TARGETARCH} \ && rm -f ./setup-kubectl.sh WORKDIR /src/routingmanager From 7eba6caf5edf8b79007ac7457c5ff5342b9d4232 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:50:26 -0400 Subject: [PATCH 20/54] Arm64 changes (#43) --- .github/workflows/acr-build-publish.yml | 41 ++ .github/workflows/release.yml | 54 +- azure-pipelines.yml | 550 +++++++++++++++++- build-pipelines-PR.yml | 111 ++++ build/setup-kubectl.sh | 40 +- deployment/settings/services/imagetag.setting | 6 +- samples/todo-app/database-api/Dockerfile | 5 +- samples/todo-app/deployment-arm.yaml | 224 +++++++ samples/todo-app/deployment.yaml | 8 +- samples/todo-app/frontend/Dockerfile | 3 +- samples/todo-app/stats-api/Dockerfile | 3 +- samples/todo-app/stats-worker/Dockerfile | 3 +- .../endpointmanagerlauncher.csproj | 2 +- src/LocalAgent/LocalAgent.csproj | 2 +- src/common/Kubernetes/KubernetesClient.cs | 4 +- 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/Logging/Events.cs | 1 + src/library/library.csproj | 2 +- src/routingmanager/Constants.cs | 2 +- src/routingmanager/Dockerfile | 14 +- src/routingmanager/routingmanager.csproj | 2 +- 27 files changed, 1030 insertions(+), 83 deletions(-) create mode 100644 .github/workflows/acr-build-publish.yml mode change 100644 => 100755 build/setup-kubectl.sh create mode 100644 samples/todo-app/deployment-arm.yaml diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml new file mode 100644 index 00000000..56c4efee --- /dev/null +++ b/.github/workflows/acr-build-publish.yml @@ -0,0 +1,41 @@ +name: build and push to acr +on: [workflow_dispatch] + +jobs: + docker: + runs-on: ubuntu-latest + 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: ${{ secrets.ACR_REGISTRY }} + username: ${{ secrets.ACR_USERNAME }} + password: ${{ secrets.ACR_PASSWORD }} + + - name: Build and push for devhostagent + uses: docker/build-push-action@v5 + with: + file: src/devhostagent/Dockerfile + platforms: linux/arm64,linux-amd64 + push: true + tags: ${{ secrets.ACR_REGISTRY }}/lpkremoteagent:1.3.4 + + - name: Build and push for devhostagent.restorationjob + uses: docker/build-push-action@v5 + with: + file: src/devhostagent.restorationjob/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest + + - name: Build and push for routingmanager + uses: docker/build-push-action@v5 + with: + file: src/routingmanager/Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 253ad41a..be67a143 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -6,7 +6,7 @@ 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] steps: - uses: actions/checkout@v3 - name: Setup .NET @@ -20,28 +20,41 @@ 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' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe' + $dir = 'win' + $file = 'kubectl.exe' + } elseif ('${{ matrix.mode }}' -eq 'win-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/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' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl' + $dir = 'osx' + $file = 'kubectl' + } elseif ('${{ matrix.mode }}' -eq 'osx-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl' $dir = 'osx' $file = 'kubectl' + } elseif ('${{ matrix.mode }}' -eq 'linux-arm64') { + $url = 'https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl' + $dir = 'linux' + $file = 'kubectl' } else { - $url = 'https://storage.googleapis.com/kubernetes-release/release/v1.21.2/bin/linux/amd64/kubectl' + $url = 'https://dl.k8s.io/release/v1.27.3/bin/linux/amd64/kubectl' $dir = 'linux' $file = 'kubectl' } @@ -99,6 +112,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 +130,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 +148,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 d0a1ce0f..1d160739 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 90d12a01..8b083bb8 100644 --- a/build-pipelines-PR.yml +++ b/build-pipelines-PR.yml @@ -72,6 +72,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 @@ -124,6 +134,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 @@ -135,6 +156,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 @@ -146,6 +178,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 @@ -157,6 +200,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: @@ -166,6 +220,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) @@ -198,6 +261,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 @@ -229,6 +302,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: @@ -238,6 +322,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: @@ -247,6 +340,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: @@ -256,4 +358,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 1f180053..cb229922 --- 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 13749dca..b2b08cb3 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/samples/todo-app/database-api/Dockerfile b/samples/todo-app/database-api/Dockerfile index f364455b..0c3ee009 100644 --- a/samples/todo-app/database-api/Dockerfile +++ b/samples/todo-app/database-api/Dockerfile @@ -1,8 +1,9 @@ -FROM mcr.microsoft.com/dotnet/aspnet:7.0 AS base +ARG ARCH=amd64 +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} AS base 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-${ARCH} AS build WORKDIR /src COPY ["databaseApi.csproj", ""] RUN dotnet restore "./databaseApi.csproj" diff --git a/samples/todo-app/deployment-arm.yaml b/samples/todo-app/deployment-arm.yaml new file mode 100644 index 00000000..927c8851 --- /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 6f92bf05..1d0a2330 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:v2 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:v2 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:v2 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:v2 env: - name: MONGO_CONNECTION_STRING value: mongodb://todos-db diff --git a/samples/todo-app/frontend/Dockerfile b/samples/todo-app/frontend/Dockerfile index 480447ca..e7435998 100644 --- a/samples/todo-app/frontend/Dockerfile +++ b/samples/todo-app/frontend/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-api/Dockerfile b/samples/todo-app/stats-api/Dockerfile index 38f9ba8d..b5ed0c0c 100644 --- a/samples/todo-app/stats-api/Dockerfile +++ b/samples/todo-app/stats-api/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-worker/Dockerfile b/samples/todo-app/stats-worker/Dockerfile index 60a393ce..6ac3e7d3 100644 --- a/samples/todo-app/stats-worker/Dockerfile +++ b/samples/todo-app/stats-worker/Dockerfile @@ -1,4 +1,5 @@ -FROM node:lts-alpine +ARG ARCH=amd64 +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} WORKDIR /app COPY package*.json ./ diff --git a/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj b/src/EndpointManagerLauncher/endpointmanagerlauncher.csproj index e84d7e08..c0568e67 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 16d0066d..fe8a047a 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 b4b0a63b..3e189dc2 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -399,7 +399,7 @@ await RestClient.CoreV1.ListServiceForAllNamespacesAsync(labelSelector: labelSel } catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.Conflict) { - try + try { _log.Warning("Initial CreateNamespacedServiceAsync failed, deleting namespace"); await RestClient.CoreV1.DeleteNamespacedServiceAsync(service.Metadata.Name, namespaceName); @@ -1015,7 +1015,7 @@ public async Task> GetContainerEnvironmentAsync(stri $"exec {podName} -c {containerName} -n {namespaceName} -- env", onStdOut: outputHandler, onStdErr: (string error) => errorSb.Append(error), - cancellationToken:cancellationToken); + cancellationToken: cancellationToken); if (exitCode == 0) { return true; diff --git a/src/common/common.csproj b/src/common/common.csproj index 2fb2b90b..9f5251ac 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 76b1b7e0..c7b01fbf 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 a867d5ef..ce39ec3e 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 960b5239..aa8656f9 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 9800fec6..78e0b066 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 145afa78..1b2a7a2a 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 b41fba7d..9fdbeccd 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/Logging/Events.cs b/src/library/Logging/Events.cs index 95dd3b82..234d70ed 100644 --- a/src/library/Logging/Events.cs +++ b/src/library/Logging/Events.cs @@ -16,6 +16,7 @@ public static class Operations public const string CheckCredentialsAsync = "CheckCredentialsAsync"; public const string ListNamespacesAsync = "ListNamespacesAsync"; public const string ListServicesInNamespacesAsync = "ListServicesInNamespacesAsync"; + public const string ListNodes = "ListNodes"; public const string ListPublicUrlsInNamespaceAsync = "ListPublicUrlsInNamespaceAsync"; public const string GetRoutingHeaderValue = "GetRoutingHeaderValue"; public const string IsRoutingSupported = "IsRoutingSupported"; diff --git a/src/library/library.csproj b/src/library/library.csproj index 9fcbee9a..fd437e05 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 f7268259..87ea5e4d 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 5505fc59..cf62c4a6 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 33d4b98e..e1b30e7f 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 From fbfbc865c41a0d34abcc48812e2b603804c2a991 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 15:53:39 -0400 Subject: [PATCH 21/54] update arch in the workflow --- .github/workflows/acr-build-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 56c4efee..760dd2d6 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -20,7 +20,7 @@ jobs: uses: docker/build-push-action@v5 with: file: src/devhostagent/Dockerfile - platforms: linux/arm64,linux-amd64 + platforms: linux/arm64,linux/amd64 push: true tags: ${{ secrets.ACR_REGISTRY }}/lpkremoteagent:1.3.4 From 78a8a313a15ad27f23ccbbe56bf14a10bc295400 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 20:19:53 +0000 Subject: [PATCH 22/54] make jobs parallel --- .github/workflows/acr-build-publish.yml | 39 +++++++++++++------------ 1 file changed, 21 insertions(+), 18 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 56c4efee..4005f0de 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -3,6 +3,9 @@ on: [workflow_dispatch] jobs: docker: + strategy: + matrix: + components: [devhostagent, devhostagent.restorationjob, routingmanager] runs-on: ubuntu-latest steps: - name: Checkout @@ -16,26 +19,26 @@ jobs: username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Build and push for devhostagent + - name: Build and push for {{ matrix.components }} uses: docker/build-push-action@v5 with: - file: src/devhostagent/Dockerfile - platforms: linux/arm64,linux-amd64 + file: src/{{ matrix.components }}/Dockerfile + platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/lpkremoteagent:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/{{ matrix.components }}:1.3.4 - - name: Build and push for devhostagent.restorationjob - uses: docker/build-push-action@v5 - with: - file: src/devhostagent.restorationjob/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest + # - name: Build and push for devhostagent.restorationjob + # uses: docker/build-push-action@v5 + # with: + # file: src/devhostagent.restorationjob/Dockerfile + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest - - name: Build and push for routingmanager - uses: docker/build-push-action@v5 - with: - file: src/routingmanager/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest + # - name: Build and push for routingmanager + # uses: docker/build-push-action@v5 + # with: + # file: src/routingmanager/Dockerfile + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest From 9f5eb4bd090ec0ef844c292b897fff9a8fa90779 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:22:47 -0400 Subject: [PATCH 23/54] make jobs parallel --- .github/workflows/acr-build-publish.yml | 37 +++++++++++++------------ 1 file changed, 20 insertions(+), 17 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 760dd2d6..4005f0de 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -3,6 +3,9 @@ on: [workflow_dispatch] jobs: docker: + strategy: + matrix: + components: [devhostagent, devhostagent.restorationjob, routingmanager] runs-on: ubuntu-latest steps: - name: Checkout @@ -16,26 +19,26 @@ jobs: username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Build and push for devhostagent + - name: Build and push for {{ matrix.components }} uses: docker/build-push-action@v5 with: - file: src/devhostagent/Dockerfile + file: src/{{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/lpkremoteagent:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/{{ matrix.components }}:1.3.4 - - name: Build and push for devhostagent.restorationjob - uses: docker/build-push-action@v5 - with: - file: src/devhostagent.restorationjob/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest + # - name: Build and push for devhostagent.restorationjob + # uses: docker/build-push-action@v5 + # with: + # file: src/devhostagent.restorationjob/Dockerfile + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest - - name: Build and push for routingmanager - uses: docker/build-push-action@v5 - with: - file: src/routingmanager/Dockerfile - platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest + # - name: Build and push for routingmanager + # uses: docker/build-push-action@v5 + # with: + # file: src/routingmanager/Dockerfile + # platforms: linux/amd64,linux/arm64 + # push: true + # tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest From 35e2d7ab03304d42d8b5fc39f6d541f5523ac8a4 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 16:24:42 -0400 Subject: [PATCH 24/54] add the missing $ --- .github/workflows/acr-build-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 4005f0de..6cdafc0a 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -19,13 +19,13 @@ jobs: username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Build and push for {{ matrix.components }} + - name: Build and push for ${{ matrix.components }} uses: docker/build-push-action@v5 with: - file: src/{{ matrix.components }}/Dockerfile + file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/{{ matrix.components }}:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.components }}:1.3.4 # - name: Build and push for devhostagent.restorationjob # uses: docker/build-push-action@v5 From 7ba6910feb8f1ba7ce0e205c76234d64a9ebb0ba Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 20:26:44 +0000 Subject: [PATCH 25/54] add the missing $ --- .github/workflows/acr-build-publish.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 4005f0de..6cdafc0a 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -19,13 +19,13 @@ jobs: username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Build and push for {{ matrix.components }} + - name: Build and push for ${{ matrix.components }} uses: docker/build-push-action@v5 with: - file: src/{{ matrix.components }}/Dockerfile + file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/{{ matrix.components }}:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.components }}:1.3.4 # - name: Build and push for devhostagent.restorationjob # uses: docker/build-push-action@v5 From 83c5b800e048966ce208171f8b0be76ee02b090d Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:00:22 -0400 Subject: [PATCH 26/54] try with include --- .github/workflows/acr-build-publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 6cdafc0a..ea9d7c80 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -5,7 +5,13 @@ jobs: docker: strategy: matrix: - components: [devhostagent, devhostagent.restorationjob, routingmanager] + include: + - components: devhostagent + imageName: lpkremoteagent + - components: devhostagent.restorationjob + imageName: lpkrestorationjob + - components: routingmanager + imageName: routingmanager runs-on: ubuntu-latest steps: - name: Checkout @@ -25,7 +31,7 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.components }}:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:1.3.4 # - name: Build and push for devhostagent.restorationjob # uses: docker/build-push-action@v5 From 655701666fb132e5669b6bef03c75c321a0e30aa Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 21:01:38 +0000 Subject: [PATCH 27/54] try with include for key/value pair --- .github/workflows/acr-build-publish.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 6cdafc0a..ea9d7c80 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -5,7 +5,13 @@ jobs: docker: strategy: matrix: - components: [devhostagent, devhostagent.restorationjob, routingmanager] + include: + - components: devhostagent + imageName: lpkremoteagent + - components: devhostagent.restorationjob + imageName: lpkrestorationjob + - components: routingmanager + imageName: routingmanager runs-on: ubuntu-latest steps: - name: Checkout @@ -25,7 +31,7 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.components }}:1.3.4 + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:1.3.4 # - name: Build and push for devhostagent.restorationjob # uses: docker/build-push-action@v5 From 141ce73015614d2d01fe933f3261159f46776be9 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:42:55 -0400 Subject: [PATCH 28/54] read version from image tag file --- .github/workflows/acr-build-publish.yml | 32 +++++++++++-------------- 1 file changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index ea9d7c80..4c7cf225 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -24,27 +24,23 @@ jobs: registry: ${{ secrets.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - + - name: Read version for tag + shell: bash + id: version + run: | + exec bash ./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting + printenv | grep "MINDARO" + if [ ${{ matrix.components}} === "devhostagent" ]; then + echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV + elif [ ${{ matrix.components}} === "devhostagent.restorationjob" ]; then + echo "version=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV + else + echo "version=$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: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:1.3.4 - - # - name: Build and push for devhostagent.restorationjob - # uses: docker/build-push-action@v5 - # with: - # file: src/devhostagent.restorationjob/Dockerfile - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest - - # - name: Build and push for routingmanager - # uses: docker/build-push-action@v5 - # with: - # file: src/routingmanager/Dockerfile - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.version }} From c4d1983e6df95d3e45a922c26cb0fb8f6fc53048 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 21:43:53 +0000 Subject: [PATCH 29/54] read version from image tag settings --- .github/workflows/acr-build-publish.yml | 32 ++++++++----------- .../settings/setenvironmentvariables.sh | 0 2 files changed, 14 insertions(+), 18 deletions(-) mode change 100644 => 100755 deployment/settings/setenvironmentvariables.sh diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index ea9d7c80..4c7cf225 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -24,27 +24,23 @@ jobs: registry: ${{ secrets.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - + - name: Read version for tag + shell: bash + id: version + run: | + exec bash ./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting + printenv | grep "MINDARO" + if [ ${{ matrix.components}} === "devhostagent" ]; then + echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV + elif [ ${{ matrix.components}} === "devhostagent.restorationjob" ]; then + echo "version=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV + else + echo "version=$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: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:1.3.4 - - # - name: Build and push for devhostagent.restorationjob - # uses: docker/build-push-action@v5 - # with: - # file: src/devhostagent.restorationjob/Dockerfile - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ secrets.ACR_REGISTRY }}/lpkrestorationjob:latest - - # - name: Build and push for routingmanager - # uses: docker/build-push-action@v5 - # with: - # file: src/routingmanager/Dockerfile - # platforms: linux/amd64,linux/arm64 - # push: true - # tags: ${{ secrets.ACR_REGISTRY }}/routingmanager:latest + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.version }} diff --git a/deployment/settings/setenvironmentvariables.sh b/deployment/settings/setenvironmentvariables.sh old mode 100644 new mode 100755 From 1dd57269cbb10864d0fd9a1ca1648b5c5469ae46 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:49:05 -0400 Subject: [PATCH 30/54] try with backtick to exec shell --- .github/workflows/acr-build-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 4c7cf225..174f9f2e 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -28,7 +28,7 @@ jobs: shell: bash id: version run: | - exec bash ./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting + `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" if [ ${{ matrix.components}} === "devhostagent" ]; then echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV From fe0d827432c0a963c12962bdded10f72e2e6e3d7 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 21:49:52 +0000 Subject: [PATCH 31/54] try with backtick --- .github/workflows/acr-build-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 4c7cf225..174f9f2e 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -28,7 +28,7 @@ jobs: shell: bash id: version run: | - exec bash ./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting + `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" if [ ${{ matrix.components}} === "devhostagent" ]; then echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV From 6e6896992340c40995096b93c446c5f4255f8a71 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:51:01 -0400 Subject: [PATCH 32/54] try with chmod --- .github/workflows/acr-build-publish.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 174f9f2e..69e704d5 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -28,6 +28,7 @@ jobs: 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 From ec8182d153e5c3e89213d4f2b67054913d274069 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:53:19 -0400 Subject: [PATCH 33/54] try with double equal signs --- .github/workflows/acr-build-publish.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 69e704d5..6d708e49 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -31,9 +31,9 @@ jobs: chmod +x ./deployment/settings/setenvironmentvariables.sh `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" - if [ ${{ matrix.components}} === "devhostagent" ]; then + if [ ${{ matrix.components}} == "devhostagent" ]; then echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV - elif [ ${{ matrix.components}} === "devhostagent.restorationjob" ]; then + elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then echo "version=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV else echo "version=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV From cc66d31a7b28e7b5479bfae8a1a1e8cbde469e77 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:55:43 -0400 Subject: [PATCH 34/54] add echo statements --- .github/workflows/acr-build-publish.yml | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 6d708e49..df291a2a 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -32,11 +32,12 @@ jobs: `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" if [ ${{ matrix.components}} == "devhostagent" ]; then - echo "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV + echo "tag is:$$MINDARO_DEVHOSTAGENT_TAG" + echo "tag=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then - echo "version=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV + echo "tag=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV else - echo "version=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV + echo "tag=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV fi - name: Build and push for ${{ matrix.components }} uses: docker/build-push-action@v5 @@ -44,4 +45,4 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.version }} + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.tag }} From 8ae79d84e7bb1510b5ce81b9ca484b1f7f6d4f50 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:57:02 -0400 Subject: [PATCH 35/54] add more echo statements --- .github/workflows/acr-build-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index df291a2a..2504cda9 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -32,7 +32,7 @@ jobs: `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" if [ ${{ matrix.components}} == "devhostagent" ]; then - echo "tag is:$$MINDARO_DEVHOSTAGENT_TAG" + echo "tag is:$MINDARO_DEVHOSTAGENT_TAG" echo "tag=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then echo "tag=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV From 9397adb3e0f087e8259406d8ca2e653bfbba42a0 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 17:59:09 -0400 Subject: [PATCH 36/54] try with env variable --- .github/workflows/acr-build-publish.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 2504cda9..bda8e8f4 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -45,4 +45,4 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.tag }} + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} From a85139f9d5a2739aedfef84a9cd7bd7d1417d6d5 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 22:01:03 +0000 Subject: [PATCH 37/54] add permissions and env variable --- .github/workflows/acr-build-publish.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 174f9f2e..8959cfda 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -28,14 +28,15 @@ jobs: 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 "version=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV - elif [ ${{ matrix.components}} === "devhostagent.restorationjob" ]; then - echo "version=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV + 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 "version=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV + echo "tag=$MINDARO_ROUTINGMANAGER_TAG" >> $GITHUB_ENV fi - name: Build and push for ${{ matrix.components }} uses: docker/build-push-action@v5 @@ -43,4 +44,4 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ steps.version.outputs.version }} + tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} From 05837d1b3355ac92587da2f7a6f46872b6d9cc73 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 18:12:41 -0400 Subject: [PATCH 38/54] rename step and add set telemtry var --- .github/workflows/acr-build-publish.yml | 11 +++++++++-- 1 file changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index bda8e8f4..a2836650 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -24,7 +24,15 @@ jobs: registry: ${{ secrets.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Read version for tag + - 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: | @@ -32,7 +40,6 @@ jobs: `./deployment/settings/setenvironmentvariables.sh deployment/settings/services/imagetag.setting` printenv | grep "MINDARO" if [ ${{ matrix.components}} == "devhostagent" ]; then - echo "tag is:$MINDARO_DEVHOSTAGENT_TAG" echo "tag=$MINDARO_DEVHOSTAGENT_TAG" >> $GITHUB_ENV elif [ ${{ matrix.components}} == "devhostagent.restorationjob" ]; then echo "tag=$MINDARO_DEVHOSTAGENT_RESTORATIONJOB_TAG" >> $GITHUB_ENV From 0ebe02493ead1f864f9362bb004725c2b036f2ce Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Thu, 19 Oct 2023 22:14:17 +0000 Subject: [PATCH 39/54] rename step and add set telemtry var --- .github/workflows/acr-build-publish.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 8959cfda..a2836650 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -24,7 +24,15 @@ jobs: registry: ${{ secrets.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - - name: Read version for tag + - 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: | From c1a60f059304c59836583822a6a728646abcbb6d Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:18:37 -0400 Subject: [PATCH 40/54] add environment choice --- .github/workflows/acr-build-publish.yml | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index a2836650..482e6913 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -1,6 +1,16 @@ name: build and push to acr -on: [workflow_dispatch] - +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to build' + required: true + default: 'development' + type: choice + options: + - development + - staging + - prod jobs: docker: strategy: From 847fe650356040721b6e13c7f086bc4380ba951b Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Thu, 19 Oct 2023 21:30:56 -0400 Subject: [PATCH 41/54] add environment profile --- .github/workflows/acr-build-publish.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index 482e6913..3b9bbbc5 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -23,6 +23,7 @@ jobs: - components: routingmanager imageName: routingmanager runs-on: ubuntu-latest + environment: ${{ github.event.inputs.environment }} steps: - name: Checkout uses: actions/checkout@v4 @@ -31,7 +32,7 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - registry: ${{ secrets.ACR_REGISTRY }} + registry: ${{ vars.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - name: Set telemetry variables @@ -62,4 +63,4 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} + tags: ${{ vars.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} From 8049d02cf799409655cd6d8ab4b621118b34b560 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Fri, 20 Oct 2023 01:57:34 +0000 Subject: [PATCH 42/54] add environment to workflow --- .github/workflows/acr-build-publish.yml | 19 +++++++++++++++---- 1 file changed, 15 insertions(+), 4 deletions(-) diff --git a/.github/workflows/acr-build-publish.yml b/.github/workflows/acr-build-publish.yml index a2836650..3b9bbbc5 100644 --- a/.github/workflows/acr-build-publish.yml +++ b/.github/workflows/acr-build-publish.yml @@ -1,6 +1,16 @@ name: build and push to acr -on: [workflow_dispatch] - +on: + workflow_dispatch: + inputs: + environment: + description: 'Environment to build' + required: true + default: 'development' + type: choice + options: + - development + - staging + - prod jobs: docker: strategy: @@ -13,6 +23,7 @@ jobs: - components: routingmanager imageName: routingmanager runs-on: ubuntu-latest + environment: ${{ github.event.inputs.environment }} steps: - name: Checkout uses: actions/checkout@v4 @@ -21,7 +32,7 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v3 with: - registry: ${{ secrets.ACR_REGISTRY }} + registry: ${{ vars.ACR_REGISTRY }} username: ${{ secrets.ACR_USERNAME }} password: ${{ secrets.ACR_PASSWORD }} - name: Set telemetry variables @@ -52,4 +63,4 @@ jobs: file: src/${{ matrix.components }}/Dockerfile platforms: linux/arm64,linux/amd64 push: true - tags: ${{ secrets.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} + tags: ${{ vars.ACR_REGISTRY }}/${{ matrix.imageName }}:${{ env.tag }} From 36bddb1080c2b7e80f1d6b1236848da4f3d01aa1 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Mon, 23 Oct 2023 01:32:38 +0000 Subject: [PATCH 43/54] add pr build workflow --- .github/workflows/pr-build.yml | 48 +++++++++++++++++++++++++++++++ src/unittest.sln | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/pr-build.yml create mode 100644 src/unittest.sln diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 00000000..949277fe --- /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/src/unittest.sln b/src/unittest.sln new file mode 100644 index 00000000..4f2a0fdb --- /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 From b697018e630591f11b8a19ee6476829f2026058a Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian <105889062+hsubramanianaks@users.noreply.github.com> Date: Sun, 22 Oct 2023 21:35:14 -0400 Subject: [PATCH 44/54] add unittest sln and pr build workflow --- .github/workflows/pr-build.yml | 48 +++++++++++++++++++++++++++++++ src/unittest.sln | 52 ++++++++++++++++++++++++++++++++++ 2 files changed, 100 insertions(+) create mode 100644 .github/workflows/pr-build.yml create mode 100644 src/unittest.sln diff --git a/.github/workflows/pr-build.yml b/.github/workflows/pr-build.yml new file mode 100644 index 00000000..85420654 --- /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/src/unittest.sln b/src/unittest.sln new file mode 100644 index 00000000..682a36e1 --- /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 From acb25cdf67e405a6ac963d49a8cb898d05c9b8a1 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Mon, 23 Oct 2023 15:43:19 +0000 Subject: [PATCH 45/54] changes for samples dockerfile for both arch --- samples/todo-app/database-api/Dockerfile | 9 +- samples/todo-app/deployment-arm.yaml | 224 ----------------------- samples/todo-app/deployment.yaml | 8 +- samples/todo-app/frontend/Dockerfile | 4 +- samples/todo-app/stats-api/Dockerfile | 4 +- samples/todo-app/stats-worker/Dockerfile | 5 +- 6 files changed, 15 insertions(+), 239 deletions(-) delete mode 100644 samples/todo-app/deployment-arm.yaml diff --git a/samples/todo-app/database-api/Dockerfile b/samples/todo-app/database-api/Dockerfile index 0c3ee009..0c657be8 100644 --- a/samples/todo-app/database-api/Dockerfile +++ b/samples/todo-app/database-api/Dockerfile @@ -1,9 +1,10 @@ -ARG ARCH=amd64 -FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0-${ARCH} AS base +FROM --platform=$BUILDPLATFORM 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-cbl-mariner2.0-${ARCH} AS build +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.0 AS build +ARG TARGETARCH WORKDIR /src COPY ["databaseApi.csproj", ""] RUN dotnet restore "./databaseApi.csproj" @@ -12,7 +13,7 @@ WORKDIR "/src/." RUN dotnet build "databaseApi.csproj" -c Release -o /app/build 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 deleted file mode 100644 index 927c8851..00000000 --- a/samples/todo-app/deployment-arm.yaml +++ /dev/null @@ -1,224 +0,0 @@ -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 1d0a2330..4c440699 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: mindarodev.azurecr.io/samples/stats-worker:v2 + image: mindarodev.azurecr.io/samples/stats-worker:v1 env: - name: STATS_QUEUE_URI value: amqp://stats-queue @@ -101,7 +101,7 @@ spec: kubernetes.io/os: linux containers: - name: stats-api - image: mindarodev.azurecr.io/samples/stats-api:v2 + image: mindarodev.azurecr.io/samples/stats-api:v1 livenessProbe: httpGet: path: /hello @@ -173,7 +173,7 @@ spec: kubernetes.io/os: linux containers: - name: frontend - image: mindarodev.azurecr.io/samples/frontend:v2 + image: mindarodev.azurecr.io/samples/frontend:v1 env: - name: STATS_QUEUE_URI value: amqp://stats-queue @@ -207,7 +207,7 @@ spec: kubernetes.io/os: linux containers: - name: database-api - image: mindarodev.azurecr.io/samples/database-api:v2 + image: mindarodev.azurecr.io/samples/database-api:v1 env: - name: MONGO_CONNECTION_STRING value: mongodb://todos-db diff --git a/samples/todo-app/frontend/Dockerfile b/samples/todo-app/frontend/Dockerfile index e7435998..d9f35a45 100644 --- a/samples/todo-app/frontend/Dockerfile +++ b/samples/todo-app/frontend/Dockerfile @@ -1,5 +1,5 @@ -ARG ARCH=amd64 -FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 +ARG TARGETARCH ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-api/Dockerfile b/samples/todo-app/stats-api/Dockerfile index b5ed0c0c..2f7d2023 100644 --- a/samples/todo-app/stats-api/Dockerfile +++ b/samples/todo-app/stats-api/Dockerfile @@ -1,5 +1,5 @@ -ARG ARCH=amd64 -FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 +ARG TARGETARCH ENV PORT 80 EXPOSE 80 diff --git a/samples/todo-app/stats-worker/Dockerfile b/samples/todo-app/stats-worker/Dockerfile index 6ac3e7d3..c1e1199b 100644 --- a/samples/todo-app/stats-worker/Dockerfile +++ b/samples/todo-app/stats-worker/Dockerfile @@ -1,6 +1,5 @@ -ARG ARCH=amd64 -FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004-${ARCH} - +FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 +ARG TARGETARCH WORKDIR /app COPY package*.json ./ RUN npm install From 14175a6d9804a14313d51919ab9753c87ff40085 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Mon, 23 Oct 2023 21:20:18 +0000 Subject: [PATCH 46/54] fix dockerfile to work for amd/arm64 --- samples/todo-app/database-api/Dockerfile | 8 ++++---- samples/todo-app/deployment.yaml | 8 ++++---- samples/todo-app/frontend/Dockerfile | 3 +-- samples/todo-app/stats-api/Dockerfile | 3 +-- samples/todo-app/stats-worker/Dockerfile | 3 +-- 5 files changed, 11 insertions(+), 14 deletions(-) diff --git a/samples/todo-app/database-api/Dockerfile b/samples/todo-app/database-api/Dockerfile index 0c657be8..39bd4284 100644 --- a/samples/todo-app/database-api/Dockerfile +++ b/samples/todo-app/database-api/Dockerfile @@ -1,16 +1,16 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 AS base +FROM mcr.microsoft.com/dotnet/aspnet:7.0-cbl-mariner2.0 AS base ARG TARGETARCH WORKDIR /app EXPOSE 80 -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:7.0-cbl-mariner2.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 -a ${TARGETARCH} -o /app/publish diff --git a/samples/todo-app/deployment.yaml b/samples/todo-app/deployment.yaml index 4c440699..cf142edf 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: mindarodev.azurecr.io/samples/stats-worker:v1 + 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: mindarodev.azurecr.io/samples/stats-api:v1 + 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: mindarodev.azurecr.io/samples/frontend:v1 + 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: mindarodev.azurecr.io/samples/database-api:v1 + 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 d9f35a45..a54604f0 100644 --- a/samples/todo-app/frontend/Dockerfile +++ b/samples/todo-app/frontend/Dockerfile @@ -1,5 +1,4 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 -ARG TARGETARCH +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 2f7d2023..50678dc1 100644 --- a/samples/todo-app/stats-api/Dockerfile +++ b/samples/todo-app/stats-api/Dockerfile @@ -1,5 +1,4 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 -ARG TARGETARCH +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 c1e1199b..1804e1c7 100644 --- a/samples/todo-app/stats-worker/Dockerfile +++ b/samples/todo-app/stats-worker/Dockerfile @@ -1,5 +1,4 @@ -FROM --platform=$BUILDPLATFORM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 -ARG TARGETARCH +FROM mcr.microsoft.com/cbl-mariner/base/nodejs:18.17.1-2-cm2.0.20231004 WORKDIR /app COPY package*.json ./ RUN npm install From 3a129dd7cb265d3d97276a6fc9b1d79a871893ff Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Mon, 23 Oct 2023 21:29:53 +0000 Subject: [PATCH 47/54] update release workflow --- .github/workflows/release.yml | 57 ++++++++++++++--------------------- 1 file changed, 23 insertions(+), 34 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be67a143..44716f7c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -7,6 +7,25 @@ jobs: strategy: matrix: 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 @@ -33,41 +52,11 @@ jobs: uses: Azure/powershell@v1 with: inlineScript: | - if ('${{ matrix.mode }}' -eq 'win-x64') { - $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/amd64/kubectl.exe' - $dir = 'win' - $file = 'kubectl.exe' - } elseif ('${{ matrix.mode }}' -eq 'win-arm64') { - $url = 'https://dl.k8s.io/release/v1.27.3/bin/windows/arm64/kubectl.exe' - $dir = 'win' - $file = 'kubectl.exe' - } elseif ('${{ matrix.mode }}' -eq 'osx-x64') { - $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/amd64/kubectl' - $dir = 'osx' - $file = 'kubectl' - } elseif ('${{ matrix.mode }}' -eq 'osx-arm64') { - $url = 'https://dl.k8s.io/release/v1.27.3/bin/darwin/arm64/kubectl' - $dir = 'osx' - $file = 'kubectl' - } elseif ('${{ matrix.mode }}' -eq 'linux-arm64') { - $url = 'https://dl.k8s.io/release/v1.27.3/bin/linux/arm64/kubectl' - $dir = 'linux' - $file = 'kubectl' - } else { - $url = 'https://dl.k8s.io/release/v1.27.3/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 From e2ba7a45a3320b737fde2da808e0856755d8f201 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 24 Oct 2023 14:44:19 +0000 Subject: [PATCH 48/54] upload release assests to matrix --- .github/workflows/release.yml | 72 ++++++++++++----------------------- 1 file changed, 24 insertions(+), 48 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 44716f7c..dd3a154d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,6 +74,27 @@ jobs: release: runs-on: ubuntu-latest needs: build + strategy: + matrix: + include: + - mode: osx-x64 + assetBuildName: lpk-osx-x64 + assetName: lpk-osx + - mode: linux-x64 + assetBuildName: lpk-linux-x64 + assetName: lpk-linux + - mode: win-x64 + assetBuildName: lpk-win-x64 + assetName: lpk-win + - mode: win-arm64 + assetBuildName: lpk-win-arm64 + assetName: lpk-win-arm64 + - mode: osx-arm64 + assetBuildName: lpk-osx-arm64 + assetName: lpk-osx-arm64 + - mode: linux-arm64 + assetBuildName: lpk-linux-arm64 + assetName: lpk-linux-arm64 steps: - uses: actions/checkout@v3 - name: Get Changelog Entry @@ -92,57 +113,12 @@ jobs: body: ${{ steps.changelog_reader.outputs.changes }} - name: Download All artifacts uses: actions/download-artifact@v3 - - name: Upload Window 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-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: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - 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: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - with: - upload_url: ${{ steps.create_release.outputs.upload_url }} - 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 + - name: Upload 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_path: ${{ github.workspace }}/${{ matrix.assetBuildName }}/${{ matrix.assetBuildName }}.zip + asset_name: ${{ matrix.assetName }}.zip asset_content_type: application/zip From b147ea66017ed4c64c81fa4490418702af6f4d47 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 24 Oct 2023 14:47:50 +0000 Subject: [PATCH 49/54] remove white spaces and unused vars --- src/common/Kubernetes/KubernetesClient.cs | 6 +++--- src/library/Logging/Events.cs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index 3e189dc2..d9a8ef0d 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -399,7 +399,7 @@ await RestClient.CoreV1.ListServiceForAllNamespacesAsync(labelSelector: labelSel } catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.Conflict) { - try + try { _log.Warning("Initial CreateNamespacedServiceAsync failed, deleting namespace"); await RestClient.CoreV1.DeleteNamespacedServiceAsync(service.Metadata.Name, namespaceName); @@ -1015,7 +1015,7 @@ public async Task> GetContainerEnvironmentAsync(stri $"exec {podName} -c {containerName} -n {namespaceName} -- env", onStdOut: outputHandler, onStdErr: (string error) => errorSb.Append(error), - cancellationToken: cancellationToken); + cancellationToken:cancellationToken); if (exitCode == 0) { return true; @@ -1152,4 +1152,4 @@ private string GetLabelSelectorString(IEnumerable> #endregion Private methods } -} +} \ No newline at end of file diff --git a/src/library/Logging/Events.cs b/src/library/Logging/Events.cs index 234d70ed..95dd3b82 100644 --- a/src/library/Logging/Events.cs +++ b/src/library/Logging/Events.cs @@ -16,7 +16,6 @@ public static class Operations public const string CheckCredentialsAsync = "CheckCredentialsAsync"; public const string ListNamespacesAsync = "ListNamespacesAsync"; public const string ListServicesInNamespacesAsync = "ListServicesInNamespacesAsync"; - public const string ListNodes = "ListNodes"; public const string ListPublicUrlsInNamespaceAsync = "ListPublicUrlsInNamespaceAsync"; public const string GetRoutingHeaderValue = "GetRoutingHeaderValue"; public const string IsRoutingSupported = "IsRoutingSupported"; From 11525d46814d9c4d9fb0458823883b8a520d8ddb Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Tue, 24 Oct 2023 14:49:01 +0000 Subject: [PATCH 50/54] remove whitespace changes --- src/common/Kubernetes/KubernetesClient.cs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index d9a8ef0d..b4b0a63b 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 +} From d6b866f27f673e93350287ee3376a53aa92a11af Mon Sep 17 00:00:00 2001 From: peterbom Date: Wed, 25 Oct 2023 10:26:28 +1300 Subject: [PATCH 51/54] Revert "upload release assests to matrix" (#45) --- .github/workflows/release.yml | 72 +++++++++++++++++++++++------------ 1 file changed, 48 insertions(+), 24 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index dd3a154d..44716f7c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -74,27 +74,6 @@ jobs: release: runs-on: ubuntu-latest needs: build - strategy: - matrix: - include: - - mode: osx-x64 - assetBuildName: lpk-osx-x64 - assetName: lpk-osx - - mode: linux-x64 - assetBuildName: lpk-linux-x64 - assetName: lpk-linux - - mode: win-x64 - assetBuildName: lpk-win-x64 - assetName: lpk-win - - mode: win-arm64 - assetBuildName: lpk-win-arm64 - assetName: lpk-win-arm64 - - mode: osx-arm64 - assetBuildName: lpk-osx-arm64 - assetName: lpk-osx-arm64 - - mode: linux-arm64 - assetBuildName: lpk-linux-arm64 - assetName: lpk-linux-arm64 steps: - uses: actions/checkout@v3 - name: Get Changelog Entry @@ -113,12 +92,57 @@ jobs: body: ${{ steps.changelog_reader.outputs.changes }} - name: Download All artifacts uses: actions/download-artifact@v3 - - name: Upload Release Assets + - name: Upload Window 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-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: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + 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: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ steps.create_release.outputs.upload_url }} + 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 }}/${{ matrix.assetBuildName }}/${{ matrix.assetBuildName }}.zip - asset_name: ${{ matrix.assetName }}.zip + asset_path: ${{ github.workspace }}/lpk-osx-arm64/lpk-osx-arm64.zip + asset_name: lpk-osx-arm64.zip asset_content_type: application/zip From 9d7099d5b2b38ea590eaa1c87099c3c1e7831a41 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 1 Nov 2023 23:33:22 +0000 Subject: [PATCH 52/54] changes for managed identity --- samples/managed-identity/Dockerfile | 20 +++-- .../KubernetesLocalProcessConfig.yaml | 2 +- samples/managed-identity/deploy-arm.yaml | 73 +++++++++++++++++++ samples/managed-identity/deploy.yaml | 3 +- samples/managed-identity/roleAssignment.sh | 9 ++- 5 files changed, 95 insertions(+), 12 deletions(-) create mode 100644 samples/managed-identity/deploy-arm.yaml diff --git a/samples/managed-identity/Dockerfile b/samples/managed-identity/Dockerfile index 8402e7cf..795b4575 100644 --- a/samples/managed-identity/Dockerfile +++ b/samples/managed-identity/Dockerfile @@ -1,27 +1,31 @@ #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 +# RUN tdnf clean all +# RUN tdnf check-update && tdnf update -y +# RUN tdnf upgrade -y +# RUN tdnf install -y libsecret-1-dev +# # RUN tdnf 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 a5cbb580..385c9090 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 00000000..de768225 --- /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 770dd40f..58f45ffb 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 de69ba5d..081d49b5 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 From 7decbe235b84bf4a90dc4c282575841a5779a367 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Wed, 1 Nov 2023 23:37:11 +0000 Subject: [PATCH 53/54] remove unused vars --- src/common/Kubernetes/KubernetesClient.cs | 6 +++--- src/library/Logging/Events.cs | 1 - 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/src/common/Kubernetes/KubernetesClient.cs b/src/common/Kubernetes/KubernetesClient.cs index 3e189dc2..d9a8ef0d 100644 --- a/src/common/Kubernetes/KubernetesClient.cs +++ b/src/common/Kubernetes/KubernetesClient.cs @@ -399,7 +399,7 @@ await RestClient.CoreV1.ListServiceForAllNamespacesAsync(labelSelector: labelSel } catch (HttpOperationException e) when (e.Response.StatusCode == HttpStatusCode.Conflict) { - try + try { _log.Warning("Initial CreateNamespacedServiceAsync failed, deleting namespace"); await RestClient.CoreV1.DeleteNamespacedServiceAsync(service.Metadata.Name, namespaceName); @@ -1015,7 +1015,7 @@ public async Task> GetContainerEnvironmentAsync(stri $"exec {podName} -c {containerName} -n {namespaceName} -- env", onStdOut: outputHandler, onStdErr: (string error) => errorSb.Append(error), - cancellationToken: cancellationToken); + cancellationToken:cancellationToken); if (exitCode == 0) { return true; @@ -1152,4 +1152,4 @@ private string GetLabelSelectorString(IEnumerable> #endregion Private methods } -} +} \ No newline at end of file diff --git a/src/library/Logging/Events.cs b/src/library/Logging/Events.cs index 234d70ed..95dd3b82 100644 --- a/src/library/Logging/Events.cs +++ b/src/library/Logging/Events.cs @@ -16,7 +16,6 @@ public static class Operations public const string CheckCredentialsAsync = "CheckCredentialsAsync"; public const string ListNamespacesAsync = "ListNamespacesAsync"; public const string ListServicesInNamespacesAsync = "ListServicesInNamespacesAsync"; - public const string ListNodes = "ListNodes"; public const string ListPublicUrlsInNamespaceAsync = "ListPublicUrlsInNamespaceAsync"; public const string GetRoutingHeaderValue = "GetRoutingHeaderValue"; public const string IsRoutingSupported = "IsRoutingSupported"; From 7f00ab013100a0ca2a437515146e5a5adf71b065 Mon Sep 17 00:00:00 2001 From: Hariharan Subramanian Date: Fri, 3 Nov 2023 12:08:19 +0000 Subject: [PATCH 54/54] remove commented lines --- samples/managed-identity/Dockerfile | 5 ----- 1 file changed, 5 deletions(-) diff --git a/samples/managed-identity/Dockerfile b/samples/managed-identity/Dockerfile index 795b4575..ec55f631 100644 --- a/samples/managed-identity/Dockerfile +++ b/samples/managed-identity/Dockerfile @@ -23,9 +23,4 @@ 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 tdnf clean all -# RUN tdnf check-update && tdnf update -y -# RUN tdnf upgrade -y -# RUN tdnf install -y libsecret-1-dev -# # RUN tdnf install -y libsecret-1-0 ENTRYPOINT ["dotnet", "mi-webapp.dll"] \ No newline at end of file