Skip to main content

GitSources.Tools

Deprecated in 3.1

datastar --command-name build replaces this tool. It does the same job from one binary, reads each artefact as a blob rather than checking anything out, and inflates data documents to SQL on the way, which GitSources cannot do: it copies a .json through as it is, and a document that points at a shared definition then arrives without it and fails to deploy.

GitSources.Tools still works and is still on NuGet, for pipelines that have not moved. It is no longer being developed. Everything new goes into build.

Before you move, check the four switches below that build does not have yet.

GitSources.Tools builds a deployment package out of a Git checkout during an automated build. Point it at a DataStar deployment file and it gathers the referenced scripts (at the commit each one was pinned to) and wraps them into a single artefact, ready for release.

It's published to NuGet and installs as a global dotnet tool:

dotnet tool install --global GitSources.Tool --version 1.*

Moving to build​

Most of it is a rename. These carry over unchanged, long name and short:

--git-directory, --build-file, --output-directory, --log-level, --manifest.regexp, --package-file, --package-id, --package-version, --package-author, --package-summary, and --artifacts-directory, which build also accepts under its own name of --package-directory. ${Version} and ${Manifest} are replaced as they were.

One switch to write out in full: --artifacts-directory has no short form here. -ad has meant --audit-database in DataStar.Tools for far longer, and two options cannot share a short name, so a command line still carrying -ad will be refused with Multiple options with name 'ad' found.

These have no equivalent yet:

SwitchWhere it stands
-bc --build-commitNot in build. Download the deployment file as its own step and pass --build-file, which is what an agile tool's attachment needs anyway.
-bt --build-tagNot in build for finding the deployment file. --at does take a tag for reading the artefacts themselves.
-vi --version.ignoreNot in build. --at <revision> is close: it builds everything at one revision rather than at each item's pinned one.
-vl --version.lenientNot in build. A pinned revision that no longer exists fails the build rather than falling back.

build also needs --database, since a data document only inflates for the vendor it was captured from, and a work item, from --work-item or read from --work-branch.

A worked example, and what the output holds, is on the DataStar.Tools page.

How it works​

A DataStar deployment file lists every script the release needs, together with the Git commit SHA that version of each script came from. GitSources.Tools reads the file, pulls each script at the pinned commit, and packages the set. Lenient modes are available if you'd rather use the latest commit of each file, or fall back to the latest when a pinned commit is missing.

The deployment file itself can live anywhere. If it's checked into the Git repo, use --build-commit or --build-tag to pick the version. If an agile tool stores the file (for example, attached to a Jira story or Azure Boards work item), download it as a separate build step and point --build-file at the local copy.

Running the CLI​

dotnet-gitsources [options]
SwitchLong nameTypeDescription
-ad--artifacts-directoryStringOutput directory for the packaged artefacts.
-bc--build-commitStringTake the deployment file from the Git repo at the specified commit. Located via the manifest regex.
-bf--build-fileStringBuild from a deployment file already present on disk. Use when the file comes from an external source (Jira, Azure Boards).
-bt--build-tagStringTake the deployment file from the Git repo at the specified tag. Located via the manifest regex.
-gd--git-directoryStringPath to the root of the Git repository.
-ll--log-levelStringLog verbosity. For example, debug enables debug logging.
-mr--manifest.regexpStringRegex for matching deployment files. Defaults to any file with an .xml suffix.
-od--output-directoryStringOutput directory for any supporting outputs.
-pa--package-authorStringAuthor, for the generated NuGet package.
-pf--package-fileStringFilename, for the generated NuGet package.
-pk--package-idStringPackage id, for the generated NuGet package.
-ps--package-summaryStringDescription, for the generated NuGet package.
-pv--package-versionStringPackage version, for the generated NuGet package.
-vi--version.ignoreFlagIgnore the commit pinned in the manifest; use the latest version of each file in the repo.
-vl--version.lenientFlagPrefer the pinned commit, but fall back to the latest version when the pinned commit is missing.

Flag value types​

TypeMeaning
FlagNo value expected after the switch.
StringA string argument follows the switch.