Use buildID on other pipelines

Hello evryone

I have two pipelines,

The first one (git clone > build docker > push > helm deploy) is triggered when I push changes on my node-js git repo
The second one (git clone ==> helm store ==> helm deploy) is triggered I when push changes to my helm project git repo

For the first pipeline I am using buildID as tag for the docker image
I want to use this buildID on the second pipeline, to avoid re build of the docker image because I made changes only on the helm git repo

Is there any way to store the last buildID of another pipeline or another suggestion to do this

Best

Hello and welcome to the Codefresh community!

I don’t really understand why the second pipeline will rebuild a docker image since it only deals with Helm charts. Maybe I am missing something here?

Are those pipelines completely separate right now or the first one calls the second (in a parent and child relationship)?

That being said, you can pass any variable from one pipeline to the next with the codefresh run command (see examples here Codefresh API · Codefresh | Docs)

Hello

Thank you for your answer.

The two pipelines are completly separated, the second one is used only if the helm chart changes.

I want to use the last image built in the first pipeline (myimage:buildID) for this I have to pass the buildID as a custom_values in the second pipeline

arguments:
    action: install
    chart_name: gitops-kubernetes-configuration
    release_name: first
    helm_version: 3.0.3
    kube_context: my-test-cluster
    custom_values:
      - buildID= *XXXXXX*
    custom_value_files:
    - ./gitops-kubernetes-configuration/my-node-app/staging-values.yaml

In a simple question, Can we use a custom variable from one pipeline to another (separated pipelines) ?

At the moment there is no way to communicate between two completely unrelated pipelines.
And I think that this is by design.

Let’s say for a moment that 3 commits were pushed to the nodejs repo at the same time. This will launch 3 pipelines. So if you also start the helm repo pipeline which buildID you think it should use ? The first one that was launched? The last one? This has several implications regarding race conditions.

If you want to keep your pipelines separate I suggest you use a plugin like Codefresh | steps for locating the “newest” docker image and using that in the chart.

However the recommended way is to simply connect the two pipelines. So just modify the nodejs pipeline and replace the last step. Instead of performing a Helm deployment it should call the second pipeline with the helm chart. This way you easily reference the build ID.

I also suggest you use the application version in the Helm chart instead of the build ID. You can use this plugin for this Codefresh | steps