How to pass parameters to Azure yaml templates?
The Automation Code
by Chirag Nagrekar
2M ago
Introduction The previous article discussed the Azure templates, how to create them, and the benefits of using them at different levels (tasks, jobs, and stages). I don’t want to go through that again but in short, remember Azure templates are handy for reducing/avoiding writing the same steps for the same and different pipelines. As we are creating the common template to reduce the duplicate work, so like function there is a way that we can only pass parameters to the template and it can accept the different values. For example, I need to create a template that can accept different database ..read more
Visit website
How to create Azure Pipeline templates?
The Automation Code
by Chirag Nagrekar
2M ago
Introduction In Azure Pipeline, we can create YAML-based templates. Templates are used to avoid creating the same multiple tasks and you can call them in the multiple pipelines. Like modules/functions, you can use them as many times to avoid code repetition. Templates can be created at the task, job, or stage level. Check this link below to understand the pipeline definition structure. https://learn.microsoft.com/en-us/azure/devops/pipelines/yaml-schema/pipeline?view=azure-pipelines If you check the above definition structure, we can define template parameters for task, job, and stage. We can ..read more
Visit website
How to declare variables in Golang?
The Automation Code
by Chirag Nagrekar
3M ago
Declaring Variables in Go: A Simple Guide When learning a new programming language, understanding how to declare and use variables is crucial. In Go, also known as Golang, variable declaration is straightforward and supports several forms. In this article, we’ll explore the various methods you can use to declare variables in Go. The var Keyword The most basic form of declaring a variable in Go is using the var keyword. This is typically accompanied by the variable’s name and type. Here’s the syntax: var variableName type For example, to declare an integer variable called age, you would write ..read more
Visit website
How to authenticate to Azure using Python?
The Automation Code
by Chirag Nagrekar
3M ago
Introduction: As businesses increasingly move towards cloud-based solutions, Azure has emerged as a prominent choice for hosting various services and applications. Python, one of the most popular programming languages, offers a plethora of libraries and tools to interact with Azure services. However, before accessing Azure resources programmatically, it’s crucial to understand the authentication mechanisms provided by Azure Active Directory (Azure AD). In this article, we’ll explore different methods to authenticate Azure services using Python. 1. Understanding Azure Authentication: Azure Auth ..read more
Visit website
How to concatenate strings in Python?
The Automation Code
by Chirag Nagrekar
6M ago
a. Concat String with ‘+’ Operator In Python concatenating strings are easy. For example, let’s say you have two strings to merge then you put the plus (‘+’) operator to merge two strings. str1 = "Hello" str2 = "World" str = str1 + ' ' + str2 print(str) The output will be “Hello World“. If you have more strings then just add more operators to merge the strings. b. Concat string with Join function Another way to merge the string is by using the Join() function of the string. For example, str1 = "Hello" str2 = "Python" str3 = "World" str = ' '.join([str1,str2,str3]) print(str) The output ..read more
Visit website
How to create a dictionary in Python?
The Automation Code
by Chirag Nagrekar
6M ago
create a dictionary in Python A dictionary in Python is a key-value pair of objects. Key-value pairs can be different data types. To create an empty dictionary, below is the syntax. dict_example = {} Let’s create a dictionary with some data. car_models = { "Creta": 2024, "Venue" : 2023, "Nexon":2022 } Print this dictionary. Let’s check the datatype of the dictionary. print("\nCheck Datatype") print(type(car_models)) Data type ‘dict’ as you see refers to the class dictionary. To print the specific value. print(f"Creta Model : {car_models['Creta']}") print(f"Venue Model : {car ..read more
Visit website
How to: Error response from daemon: Bad response from Docker engine
The Automation Code
by Chirag Nagrekar
7M ago
Error: response from daemon: Bad response from Docker engine When you run docker commands you may have encountered the error “ERROR: Error response from daemon: Bad response from Docker engine” sometimes on Windows and Linux OS when running the docker desktop. For example, Workaround Check if the docker desktop is running. If the docker desktop is running, check if the docker desktop service is running. for Windows OS, you can check the docker-desktop service using, Get-Service "Docker Desktop Service" To start the docker desktop service on the windows run the below command. Start-Serv ..read more
Visit website
How to set environment variables in Azure Pipeline?
The Automation Code
by Chirag Nagrekar
7M ago
You can set environment variables in Azure Pipeline so they can be used in the scripts and application code. This variable is process level means it is available during that pipeline run only. To set environment variables in Azure Pipeline, the env variable is used in the steps subtasks. Below are the steps subtasks. steps: [ task | script | powershell | pwsh | bash | checkout | download | downloadBuild | getPackage | publish | template | reviewApp ] Let’s take some examples to understand the same. Using the env variable at the task level trigger: - none pool: vmImage: windows-latest jo ..read more
Visit website
How to create dynamic array in PowerShell?
The Automation Code
by Chirag Nagrekar
7M ago
There are two types of arrays in PowerShell. Fixed array Dynamic Array Fixed Array Fixed arrays are the ones whose values cannot be removed or added. Their sizes are fixed. For example, below is the fixed-size array. $array1 = @("Cat","Dog","Cow") If you try to add/remove elements, it will fail. $array1.add("Tiger") Some programs you write may need the array dynamically allocated so the elements can be added or removed when needed. ArrayList This dynamic array is called the arraylist in PowerShell. There are two ways to create dynamic arrays (ArrayList). $array2 =New-Object -TypeNam ..read more
Visit website
How to Set Environment Variable in Windows using GoLang?
The Automation Code
by Chirag Nagrekar
7M ago
In the previous articles, we mentioned setting up environment variables using PowerShell and Python in Windows OS. In this article, we will set up environment variables with GoLang. Set up environment variables with GoLang. a. Process Level Setting up environment variables at the process level is easy with GoLang. Below is an example of that. package main import ( "fmt" "os" ) func main(){ env_key := "azSub" env_value := "TestSub1" err := os.Setenv(env_key,env_value) if err != nil { fmt.Println("Error Setting up process level ..read more
Visit website

Follow The Automation Code on FeedSpot

Continue with Google
Continue with Apple
OR