parameters: - name: target_environment displayName: Target Environment type: string default: qa values: - qa - uat - prd - name: k8s_namespace displayName: K8s Namespace to deploy to type: string default: landmarkcu values: - landmarkcu variables: - template: ./config-files/${{ parameters.target_environment }}-pvars.yaml - name: source_branch_name value: $[replace(replace(variables['Build.SourceBranch'], 'refs/heads/', ''), '/', '-')] - name: docker_container_repository_name value: landmarkcu/lcu.api.internal.coreapiwrapper-coreapiwrapper resources: repositories: - repository: azdo_pipeline_templates type: git name: Infrastructure Platform/azdo-pipeline-templates ref: main stages: # DOTNET BUILD AND NUGET PUSH - stage: dotnet_nuget displayName: Restore / Build / Upload Nuget packages jobs: - job: build_and_push displayName: Dotnet Nuget pool: name: $(pvar_azdo_agent_pool_nuget) demands: - msbuild steps: - task: DotNetCoreCLI@2 displayName: Nuget Restore inputs: command: 'restore' feedsToUse: 'select' projects: '**/*.csproj' vstsFeed: 'LCU-Internal' - task: DotNetCoreCLI@2 displayName: Nuget Build inputs: command: 'build' projects: '**/*.csproj' arguments: '--configuration Release' - task: DotNetCoreCLI@2 displayName: Nuget Test inputs: command: test projects: '**/*Test.csproj' arguments: '--configuration Release --collect "Code coverage"' - ${{ if eq(variables['Build.SourceBranchName'], 'develop') }}: - task: NuGetCommand@2 displayName: NuGet Push inputs: command: 'push' packagesToPush: '$(Pipeline.Workspace)/**/*.nupkg' publishVstsFeed: 'LCU-Internal' allowPackageConflicts: true # DOCKER BUILD AND PUSH - template: docker-build-push.yaml@azdo_pipeline_templates parameters: azdo_agent_pool: $(pvar_azdo_agent_pool) docker_registry_service_connection: $(pvar_docker_registry_service_connection) docker_container_repository_name: $(docker_container_repository_name) dockerfile_path: ./Dockerfile docker_image_tags: | build-$(Build.BuildId) $(source_branch_name) # K8S DEPLOY - template: k8s-deploy.yaml@azdo_pipeline_templates parameters: dependsOn: CI condition: or(eq(variables['Build.SourceBranchName'], 'develop'), eq(variables['Build.SourceBranchName'], 'main')) azdo_agent_pool: $(pvar_azdo_agent_pool) kubectl_version: $(pvar_kubectl_version) k8s_service_connection: $(pvar_k8s_service_connection) k8s_namespace: ${{ parameters.k8s_namespace }} k8s_kustomization_path: ./kustomize/overlays/${{ parameters.target_environment }} docker_registry_service_connection: $(pvar_docker_registry_service_connection) docker_image_to_deploy: $(docker_container_repository_name):build-$(Build.BuildId)