How to list remotes for multiple git repositories
Background
When you have been working with git over some time, you end up with a lot of repositories. Many of them will be connected with your favourite remote site, Azure DevOps, GitHub, Gitlab, BitBucket or something else, and some will be local only.
You will normally have them organized under some common folder. The state of the repositories will be different. Some of the folders under this common root may not even be a repository. And you might have organized them into subfolders, per application or per company or whatever.
How to create a Python package
This recipe describes how to create a package containing executable code.
Set up
Prepare your source code
Create a main.py file
It should only contain an import of your code, and then a call to the main method you have there.
Example:
import listgits
listgits.main()
Create a setup.py file
Copy from Packaging Python Projects
Replace where appropriate with your own settings
import setuptools
with open("README.md", "r") as fh:
long_description = fh.read()
setuptools.setup(
name="example-pkg-YOUR-USERNAME-HERE", # Replace with your own username
version="0.0.1",
author="Example Author",
author_email="author@example.com",
description="A small example package",
long_description=long_description,
long_description_content_type="text/markdown",
url="https://github.com/pypa/sampleproject",
packages=setuptools.find_packages(),
classifiers=[
"Programming Language :: Python :: 3",
"License :: OSI Approved :: MIT License",
"Operating System :: OS Independent",
],
python_requires='>=3.6',
)
Note that the name only need to be like this for the test package. When you’re ready to release to production, replace with only the package name itself.
How to conditionally fail a build in Pull Requests with TFS/VSTS
When you have a build that is used for CI also covering pull requests (PR), you often want to enable more checks before you let this go into the master (or any target) branch. It can be extra tests you want to run, or, you might want to block the PR if you have warnings, e.g. from tests.
Setting a single test task to fail could be done, but that only works well if you have a single step, with multiple you can have build stops for one and every step, so it also reduces the error reporting granularity. And, it is nice to be able to see what is an absolutely blocker, red, and what is quality issues, yellow.
How to Recipes
The “How to recipes” are short solutions to a problem, not delving into the why and how like I would do with an ordinary blog post. The recipe will contain links for further reading.
http://hermit.no/net-core-setup/
http://hermit.no/findclear-nuget-caches/
http://hermit.no/get-nunit3testadapter-pre-release-packages/
http://hermit.no/enabledisable-user-dumps/
http://hermit.no/trick-fixing-strange-missing-project-json-error-old-csproj-format/