https://pulumi.com logo
#general
Title
# general
l

loud-soccer-66701

06/03/2020, 6:18 PM
hi all trying to implement additional logic of building and pushing docker images, have some issues with implementation of the following: - trigger build/push only if such tag/hash does not exists locally - trigger build/push only if such tag/hash does not exist in remote hub any advices how to do it in Pulumi exactly? thank you
k

kind-mechanic-53546

06/04/2020, 6:20 AM
This may not answer your question directly but here goes I use a release branch strategy and do a git clone (dev/test/prod)-branch within my docker build In Pulumi, I get the hash of the branch and pass it as a build arg to docker build I then do
Copy code
RUN echo ${BUILD_GIT_HASH} > /tmp/git_cache_buster.txt && \
    git clone ${BUILD_GIT_URL} --branch ${BUILD_GIT_BRANCH} ./ ...<snip>...
this process means that if the branch hash is the same, the image will be the same and therefore use all cached layers Git hash is generated by
git rev-parse --short=8 [origin]/component-name-dev
This is managed in a dynamic provider HTH
l

loud-soccer-66701

06/04/2020, 7:43 AM
thank you for your receipt your idea is to build each time but speed up builds by using cache layers - sounds good in my case I also want to avoid unnecessary pushing looks like I need to implement language-specific tools to support the workflow, was thinking if pulumi had some universal helpers to do it
k

kind-mechanic-53546

06/05/2020, 11:22 PM
I should probably also mention that if it's fully cached, nothing is really being sent in the push, just metadata so the registry can check if it already has the layer