Can you attach a workspace to a downstream Orb you are using?

I’m currently using circleci to run my build tool which will package my jar, build my docker image and push it up to ECR without needing to use anything else. I’m using the circleci/aws-eks@0.2.3 orb to do a deploy into EKS by updating the container image to trigger a rollout. My initial test of hardcoding the image tag and running the whole job worked but I need to be able to dynamically set the image tag for the Orb Job. I can easily grab the tag in the build job, but how do I get that information into the Orb’s job? Since it’s in the same workspace it seems I’m supposed to attach a workspace which would be fine I guess, but how can I do that for an orb? and is it possible to have an orb do more than it’s predefined jobs?

1 Like

Hi @adamgerst It sounds like pre-steps may be useful for you in this case: https://circleci.com/docs/2.0/reusing-config/#using-pre-and-post-steps You should be able to use pre-steps to attach a workspace to the orb’s job.

1 Like

That sounds good. Perhaps a post-step in the first job to create and populate the workspace, and then a pre-step in the second job that picks up the tag name from the workspace.

This seems very similar to what I’m trying to accomplish by using a combination of the aws-ecr orb + the aws-cli orb for doing a ECS cluster update via CloudFormation. In the Open Circle Sessions call yesterday, Kyle and Angel suggested writing an orb that is a composite of aws-ecr + aws-cli, so that the docker image tag can be “handed off” from the aws-ecr/build-and-push-image step to the subsequent aws-cli step.