ContainerTagRemover 0.1.1
See the version list below for details.
dotnet tool install --global ContainerTagRemover --version 0.1.1
dotnet new tool-manifest # if you are setting up this repo dotnet tool install --local ContainerTagRemover --version 0.1.1
#tool dotnet:?package=ContainerTagRemover&version=0.1.1
nuke :add-package ContainerTagRemover --version 0.1.1
Container Tag Remover
Container Tag Remover is a .NET tool written in C# to remove old image tags from container registries. It supports Dockerhub and Azure Container Registry and can be easily extended to support new container registries in the future. The tool determines which tags to remove based on SemVer and a configuration file that specifies the number of tags to keep for Major and Minor versions.
Features
- Supports Dockerhub and Azure Container Registry
- Easily extensible to support new container registries
- Removes old image tags based on SemVer and configuration file
- Follows SOLID principles
- 100% code coverage in tests
- Uses xUnit as the test framework
- Uses Moq as the mocking library
- Uses Shouldly for assertions
- Tests are in a separate project from the main tool code
Configuration File
The configuration file is a JSON file that specifies the number of tags to keep for Major and Minor versions. Example structure:
{
"Major": 5,
"Minor": 10
}
If the configuration file is not specified, the tool will use the default values: Major: 2, Minor: 2.
Environment Variables
To authenticate with Dockerhub and Azure Container Registry, you need to set the following environment variables:
Dockerhub
DOCKERHUB_USERNAME
: Your Dockerhub username.DOCKERHUB_PASSWORD
: Your Dockerhub password.
Example:
export DOCKERHUB_USERNAME=your-username
export DOCKERHUB_PASSWORD=your-password
Azure Container Registry
AZURE_TENANT_ID
: Your Azure tenant ID.AZURE_CLIENT_ID
: Your Azure client ID.AZURE_CLIENT_SECRET
: Your Azure client secret (optional, if not set,DefaultAzureCredential
will be used).
Example:
export AZURE_TENANT_ID=your-tenant-id
export AZURE_CLIENT_ID=your-client-id
export AZURE_CLIENT_SECRET=your-client-secret
Building and Running the Tool
- Clone the repository:
git clone https://github.com/jaq316/ContainerTagRemover.git
cd src/ContainerTagRemover
- Build the solution:
dotnet build
- Run the tool:
dotnet run --project src/ContainerTagRemover/ContainerTagRemover.csproj -- <registry-url> <image> <config-file> [--output-file <output-file>]
Replace <registry-url>
, <image>
, and <config-file>
with the appropriate values. Optionally, specify <output-file>
to output the list of removed and kept tags to a JSON file.
If the configuration file is not specified, the tool will use the default values: Major: 2, Minor: 2.
If any of the required arguments are not provided, the tool will prompt you to enter them during execution.
Running the Tests
- Navigate to the test project directory:
cd tests/ContainerTagRemover.Tests
- Run the tests:
dotnet test
Installing the Tool as a .NET Global Tool
To install the Container Tag Remover as a .NET global tool, use the following command:
dotnet tool install --global --add-source ./nupkg containertagremover
Using the Tool as a .NET Global Tool
Once installed, you can use the tool from any directory by running:
containertagremover <registry-url> <image> <config-file> [--output-file <output-file>]
Replace <registry-url>
, <image>
, and <config-file>
with the appropriate values. Optionally, specify <output-file>
to output the list of removed and kept tags to a JSON file.
If the configuration file is not specified, the tool will use the default values: Major: 2, Minor: 2.
If any of the required arguments are not provided, the tool will prompt you to enter them during execution.
GitVersion and Release Generation
This project uses GitVersion to generate release versions. GitVersion is a tool that generates version numbers based on your Git history. It follows Semantic Versioning (SemVer) principles and can be configured to suit your versioning strategy.
GitHub Release Generation
This project now uses the actions/create-release@v1
action to create GitHub Releases. This action helps you manage your GitHub releases by automating the creation and updating of release notes.
Release Generation Process
- Whenever the main branch is updated, the GitHub workflow will trigger the release generation process.
- GitVersion will be used to determine the version number based on the commit history.
- The
actions/create-release@v1
action will be used to create a new release with the generated version number.
Configuration
The configuration for the actions/create-release@v1
action is included in the GitHub workflow file and can be customized to fit your release management strategy. For more information on configuring the actions/create-release@v1
action, refer to the GitHub Actions documentation.
GitHub Workflow
The GitHub workflow file (.github/workflows/build-and-test.yml
) has been updated to include steps for installing and using the actions/create-release@v1
action to generate release versions. The workflow will automatically create a new release whenever the main branch is updated. The Create GitHub release
step now uses actions/create-release@v1
to create the release.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
This package has no dependencies.
Version | Downloads | Last updated |
---|---|---|
0.1.14 | 37 | 12/13/2024 |
0.1.13 | 37 | 12/13/2024 |
0.1.12 | 41 | 12/13/2024 |
0.1.11 | 43 | 12/12/2024 |
0.1.10 | 38 | 12/12/2024 |
0.1.9 | 42 | 12/12/2024 |
0.1.8 | 36 | 12/12/2024 |
0.1.7 | 38 | 12/12/2024 |
0.1.6 | 37 | 12/12/2024 |
0.1.5 | 36 | 12/12/2024 |
0.1.4 | 43 | 12/11/2024 |
0.1.3 | 40 | 12/11/2024 |
0.1.2 | 41 | 12/11/2024 |
0.1.1 | 39 | 12/11/2024 |
0.1.0 | 41 | 12/11/2024 |