I have two workflows set up in the same repo - One that creates a docker image and pushes to a container registry when code is pushed to
develop branch (similar logic but for different branches - has more than one workflow of such nature). The second workflow (multiple copies with different intentions) gets triggered on successful completion of the first workflow and takes that image and deploys to either an Azure Container or Kubernetes namespace (as an example).
This all works fine workflow wise - but there are multiple builds that get triggered for different reasons and on different branches - the strategy kind of fails to achieve its purpose because the second workflow tends to use the container tag
latest for all cases. So there is kind of a race condition situation on which (first) workflow creates the last
latest image tag and which one gets picked up in the second workflow
Here is my code in the second workflow that gets trigged:
on: workflow_run: workflows: ["Original Workflow Name"] branches: - develop types: - completed
In the first workflow, I have made changes so it would generate a unique tag each time it runs and push that specific image tag to the registry.
I need a way to pass this unique tag value or make it available to the second workflow when it starts so it can read that tag value and fetch that specific image and deploy to where it was indented to.
I tried Environment variables - but either I am using it wrong or it does not work that way but I do not get same values in the second workflow run seems like they are using different build agent instances or something, is there a formal way to achieve this?
Does not have to be just tag values - but in general, if there is a way to make a generic key-value store available to the trigged second workflow that would be great, thanks in advance.