This project provides a set of tools and functions to manage Git repositories, run Go language tests, and build and publish Docker container images. It is designed to work within a containerized environment, leveraging the Dagger framework for seamless integration and execution.
The project is divided into several modules, each with its own specific functionality:
- Gitter Module: Provides a
Gitter
struct to manipulate Git repositories, including setting repository details and performing actions like checkout and inspect. - Container Image Module: Manages and builds Docker container images based on Git references. It includes methods to set various properties of the container image and generate appropriate Docker image tags.
- Golang Module: Provides functions to run Go language tests, lint Go source code, and publish Docker images.
- WithRef: Sets the Git reference (branch, tag, or SHA) for the
Gitter
instance. - WithRepository: Sets the GitHub repository name for the
Gitter
instance. - Checkout: Clones the repository and checks out the specified reference.
- WithNamespace: Sets the Docker namespace under which the image will be pushed.
- WithRef: Sets the Git reference (branch, tag, or SHA) for the
ContainerImage
instance. - WithRepository: Sets the GitHub repository name for the
ContainerImage
instance. - WithDockerfile: Sets the Dockerfile path for the
ContainerImage
instance. - WithImage: Sets the image name for the
ContainerImage
instance. - PublishFromRepo: Publishes a container image to Docker Hub.
- Test: Runs Go language tests within a containerized environment.
- Lint: Runs golangci-lint on the Go source code.
- Publish: Builds and pushes a Docker image to a Docker registry.
To run the Dagger functions using the Dagger command line, follow these steps:
- Install Dagger CLI: Ensure you have the Dagger command line interface installed. You can download it from the official Dagger website.
- Initialize Dagger: Run
dagger init
in your project directory to initialize Dagger. - Run Functions: Use the
dagger call
command followed by the function name to execute the desired function. For example:
dagger call with-ref --ref=develop with-repository \
--repository=https://github.com/dictybase-playground/gdrive-image-uploadr.git \
checkout entries