Saturday, 29 October 2022

Use Template Parameter to Create Array in Bash Task in Azure Pipelines

 Converting Azure pipeline parameter type of object, which contain an array of strings, to an array object in bash script task is not clearly documented. We can use the join expression for Azure pipeline tasks to achive this requirement. Let's look at how to do with an example.

Saturday, 22 October 2022

Writing a json Easily and Elegently in in C# 11

 In the previous post "No More " Escaping Needed with C# 11" we have discussed, how the json can be writen in C# code, without having to escape each occurance of double quote, when we use the new C# 11 feature Raw String Literals. You might not want to hardcode the entire json in code, instead may want to use variables dynamically setting the json body content. Let's see how we can use String interpolation, in Raw String Leiterals to write json body elegently, and have variables dynamically set values in the josn.

Saturday, 15 October 2022

No More " Escaping Needed with C# 11

Writing json body in C# code as a string variable value to pass on to a method or service, is something you may hate as you need to escape every " that you use in your json specification, even though you could use @ (verbatim string literals) to write multi-line strings.  With new Raw String Literals in c# 11, we can write " as content of the strings wihtout having to escape each instance. Let's explore bit about escaping double qutes with Raw String Literals.

Saturday, 8 October 2022

Check The C# Language Version of a Project

 C# Language version used in your project is determined by the .NET Framework you are using. We can set specific language version for a project if required for exxampe if we need to use the preview features we can add in the <LangVersion>preview</LangVersion> .csproj file <PropertyGroup>. If the language version is not specifically set and if you want to check the language versio used by your project, the following explained step can be performed.

Sunday, 2 October 2022

Getting Started with GitHub Copilot with VS Code

GitHub Copilot is the AI pair programmer who will assit us in writing code efficiently, while we are working with VS Code, Visual Studio, JetBrains IDEs or Neovim. Let's explore how to get started with GitHub copilot with VS Code and C# using a console application.

Friday, 30 September 2022

Replace String in Variable in Azure DevOps YAML Pipelines

In  Azure DevOps YAML pipelines there are several functions available for you to use. replace is such a useful function, which you can use to replace string segements within a string. Let's look at how we can use replace function to replace contents of a variable. 

Use case would be: For example you have a variable value for your customer api name as cutomer-api.  You may need to use it and generate customer_api value for another variable which you want to use in a namig of resouce, for consitency purpose with _ in naming instead of -.

Tuesday, 27 September 2022

Setup jsonnet-bundler in WSL2

 We need jsonnet-bundler to package the jsonnet projects For example, to generate the required Prometheus rules and Grafana dashboards in kubernetes-mixin project used for Kubernetes monitoring,  requires jsonnet-bundler. Let's see how we can setup jsonnet-bundler in Windows Subsystem for Linux (WSL2) to use it as a package tool.

Friday, 23 September 2022

Resolve "Unable to connect to the server: getting credentials: exec: executable kubelogin not found" in AKS

az aks get-credentials  is used to get the kubeconfig updated so that we can access AKS clusters from a terminal (You need to first use az login and az account set --subscription to connect to your Azure subscription). You may encounter Unable to connect to the server: getting credentials: exec: executable kubelogin not found issue after geting credentials and when trying to execute kubectl commands such as kubectl get namespace. Let's see what we need to do to get the issue resolved.

Popular Posts