Dagger
Search

image-updater

No long description provided.

Installation

dagger install github.com/matipan/daggerverse/image-updater@c3e082566aa7dc6f14de00d1241fceee8798bf3a

Entrypoint

Return Type
ImageUpdater
Example
func (m *myModule) example() *ImageUpdater  {
	return dag.
			ImageUpdater()
}
@function
def example() -> dag.ImageUpdater:
	return (
		dag.image_updater()
	)
@func()
example(): ImageUpdater {
	return dag
		.imageUpdater()
}

Types

ImageUpdater 🔗

image-updater is a dagger module that updates, commits and pushes a kubernetes deployment file with a new image-url. There are many alternatives to doing GitOps with kubernetes now a days, to name a few: - Automatically update the deployment with the new image using Kubectl or hitting the kubernetes API directly (no specific trace of the image deployed in the git repository) - Use tools such as Flux or ArgoCD to automatically watch a registry and deploy new images when they appear - Use Flux or ArgoCD as well but instead have them look for changes on specific manifests in a repository This module is useful for the last alternative. When you have CD tools that are watching kubernetes manifests on your repository you would need to change them explicitly. If you use Github or Gitlab there are actions that you can use to make this changes (for example, there is a yq action and a git-auto-commit action), but the problem is that those workflows cannot be tested locally and they become complicated. In the case of github actions, if you run your action as part of a workflow that takes a long time to run, it might happen that a new commit showed up and your push will fail. Solving this is possible, but it requires adding even more untestable bash. This is why this module exists. With image-updater you can implement this logic in a single step that is reproducible locally.

update() 🔗

Update updates the kubernetes deployment file in the specified repository with the new image URL. NOTE: this pushes a commit to your repository so make sure that you either don’t have a cyclic workflow trigger or that you use a token that prevents this from happening. +optional forceWithLease

Return Type
Void !
Arguments
NameTypeDefault ValueDescription
repoString !-No description provided
branchString !-No description provided
deployFilepathString !-No description provided
imageUrlString !-No description provided
gitUserString !-No description provided
gitEmailString !-No description provided
gitPasswordSecret !-No description provided
forceWithLeaseBoolean !-No description provided
Example
dagger -m github.com/matipan/daggerverse/image-updater@c3e082566aa7dc6f14de00d1241fceee8798bf3a call \
 update --repo string --branch string --deploy-filepath string --image-url string --git-user string --git-email string --git-password env:MYSECRET --force-with-lease boolean
func (m *myModule) example(ctx context.Context, repo string, branch string, deployFilepath string, imageUrl string, gitUser string, gitEmail string, gitPassword *Secret, forceWithLease bool)   {
	return dag.
			ImageUpdater().
			Update(ctx, repo, branch, deployFilepath, imageUrl, gitUser, gitEmail, gitPassword, forceWithLease)
}
@function
async def example(repo: str, branch: str, deploy_filepath: str, image_url: str, git_user: str, git_email: str, git_password: dagger.Secret, force_with_lease: bool) -> None:
	return await (
		dag.image_updater()
		.update(repo, branch, deploy_filepath, image_url, git_user, git_email, git_password, force_with_lease)
	)
@func()
async example(repo: string, branch: string, deployFilepath: string, imageUrl: string, gitUser: string, gitEmail: string, gitPassword: Secret, forceWithLease: boolean): Promise<void> {
	return dag
		.imageUpdater()
		.update(repo, branch, deployFilepath, imageUrl, gitUser, gitEmail, gitPassword, forceWithLease)
}