Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

tag docker images according to the nx hash/with the nx hasher functionality #951

Open
aramfe opened this issue Jan 22, 2024 · 2 comments
Open

Comments

@aramfe
Copy link

aramfe commented Jan 22, 2024

I am currently using nx and nx-tools to build Docker images for my applications. I want to tag these Docker images according to the nx generated hashes. This would allow me to control whether a Docker image should be pushed or not.

However, I am unable to find any built-in functionality within this plugin to automatically tag the Docker images based on the nx hasher functionality.

I would like to know if there is a way to achieve the desired functionality of tagging Docker images according to the nx hasher functionality using nx-tools. If such a feature exists, could you please provide an example of how to implement it?

Thank you in advance for your assistance.

@gperdomor
Copy link
Owner

@aramfe the plugin provides automatic tagging functionality based on git context... Please check this docs and give a try to see if adapts to what you want 😄 https://github.com/gperdomor/nx-tools/blob/main/packages/nx-container/docs/advanced/tags-labels.md

@aramfe
Copy link
Author

aramfe commented Jan 29, 2024

Yeah, but I don't want the Git commit hash; I want the Nx-generated hasher hash as the tag for my images, which depends on the file inputs.

Reason:

For re-deployments on AWS, it will always re-trigger a new deployment for ECS services if the image tag in CloudFormation differs, even though the image itself is the same content-wise. Using Git commit hashes just adds unnecessary deployment complexity, which could be significantly reduced if I could tag via Nx-generated hashes. AWS wouldn't redeploy complex services if the image tag is the same as the old deployment's image tag.

This approach also helps reduce complexity in Git flow workflows, as new branch deployments could reuse already-pushed images instead of always pushing a new one.

If there are no plans to add this feature, I sadly have to resort to using run-commands instead of nx-tools executors, which would be quite unfortunate, as nx-container is a really good and easy-to-use plugin. CI/CD enthusiasts would have no choice but to abandon the plugin otherwise.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants