If you have Azure Log Analytics or Application Insights, where you have different data sources, like exceptions, requests, traces, customEvents, you may want to search for some certain phrase everywhere, because you don’t know in which data source you should check or in which column.
There is quite handy way of doing that – search in query.
Quick example:
search in (exceptions, requests, traces, customEvents) "ManagedIdentityCredential"
Adding a tag to your build in Azure DevOps is very useful – you can use it later on with releases to accept only builds with certain tags. That comes in handy when you are building a project with many different configurations which you will, later on, deploy via different releases. For example:
You can use it on client basis or environment basis like dev, uat, prod.
You can add as tag whatever you want. For example variable value that you can set, when you are starting the build. You can skip next step if you want to use existing variable in your pipeline.
Create variable in your build pipeline
Create or edit your existing pipeline.
Go to Variables/Pipeline variables tab.
Add your variable, for example EnvironmentTag and add default value.
Select Settable at queue time to make sure that you can change it when you are scheduling your build.
Add a stage to tag your build
Go to the Tasks tab.
It’s good to have 2 stages – one to perform all the tasks related to your build and the other to tag the build.
Add PowerShell or Bash task that will add tag based on EnvironmentTag variable value: Write-Host "##vso[build.addbuildtag]$(EnvironmentTag)"
Execute pipeline
When you go to the build pipeline summary and go to Run pipeline you should be able to go to Variables and change EnvironmentTag value.
Check your tag
Once your build is completed you can go to your build and check if you have your tag in there.
Use tags in release pipelines
Once we have our build tagged, we can use that information on the release pipeline level, and for example trigger, automatic trigger based on branch and tag. Go to your release pipeline and edit the Pre-deployment conditions for your stage. In this example, I want to do an automatic release of Prod stage once the build from branch main and with tag prod is created.
Below you can find a list of Python dunder methods as well as when they are invoked. Those two pieces of information put together should give you a better overview when to use which. The post is inspired on those materials available online: Python 3 documentation, Python Dunder Methods by Fernando Souza, python-course.
Called by str(object) and the built-in functions format() and print() to compute the “informal” or nicely printable string representation of an object.
Called by the format() built-in function, and by extension, evaluation of formatted string literals and the str.format() method, to produce a “formatted” string representation of an object.
If a class does not define an __eq__() method it should not define a __hash__() operation either; If it defines __eq__() but not __hash__(), its instances will not be usable as items in hashable collections. If a class defines mutable objects and implements an __eq__() method, it should not implement __hash__(), since the implementation of hashable collections requires that a key’s hash value is immutable (if the object’s hash value changes, it will be in the wrong hash bucket).
Called to implement the built-in function len(). Should return the length of the object, an integer >= 0. Also, an object that doesn’t define a __bool__() method and whose __len__() method returns zero is considered to be false in a Boolean context.
Called (if present) by the reversed() built-in to implement reverse iteration. It should return a new iterator object that iterates over all the objects in the container in reverse order.
Called to implement membership test operators. Should return true if item is in self, false otherwise. For mapping objects, this should consider the keys of the mapping rather than the values or the key-item pairs.
Enter the runtime context related to this object. The with statement will bind this method’s return value to the target(s) specified in the as clause of the statement, if any.
Exit the runtime context related to this object. The parameters describe the exception that caused the context to be exited. If the context was exited without an exception, all three arguments will be None.
Called when the instance is “called” as a function; if this method is defined, x(arg1, arg2, ...) roughly translates to type(x).__call__(x, arg1, ...). 3.3.7
Called to get the attribute of the owner class (class attribute access) or of an instance of that class (instance attribute access). The optional owner argument is the owner class, while instance is the instance that the attribute was accessed through, or None when the attribute is accessed through the owner.
Often I have to make sure how I am visible to the world – what is my IP address that some service will see. I’ve found a great tool for that – ifconfig.me. You can see a lot of useful details via a browser but you can use it in console as well!
OK, so I had a problem with trying to figure out which variables are available for me and what are their values – Microsoft documentation is not always that helpful on that. As inspired by Mohit Goyal post I would like to share the same idea – on how to debug all the available variables but this time on those machines where you don’t have bash but powershell instead.
Just add to your pipeline PowerShell task, switch to inline script and fill the script
Get-ChildItem -Path Env:\ | Format-List
so it looks like
and after creation of a new release pipeline and execution of this pipeline you should have something like this: