CircleCI-Public / orb-tools-orb

Various tools for authoring and publishing CircleCI orbs
https://circleci.com/orbs/registry/orb/circleci/orb-tools
MIT License
51 stars 74 forks source link

Re-introduce the `attach-workspace` parameter to the `pack` job #173

Closed steinwelberg closed 9 months ago

steinwelberg commented 1 year ago

Describe Request:

In the previous major versions of the orb, the pack job (optionally, based on the attach-workspace parameter, included the attach_workspace step. We were relying on this step as we are building the orb and a custom (Docker) image, used by the orb in the same project. This allowed us to put a placeholder in the orb yaml, and replace it just before running the pack job.

Examples:

- orb-tools/pack:
    attach-workspace: true
    requires:
      - orb-tools/lint

Supporting Documentation Links:

steinwelberg commented 1 year ago

Btw, I am willing to provide a PR if it will have a chance to get accepted.

KyleTryon commented 1 year ago

Hey @steinwelberg,

Could you give a full example of what you are intending to do? You likely shouldn't need to persist the packed orb YAML, it is also very small and easily re-packed on the fly.

steinwelberg commented 1 year ago

Performance is actually not the problem. Our orb project contains, next to the orb, also a Docker image. We have put these 2 things in the same repository deliberately as they belong together and also evolve together. Hence in order to use a tagged version (instead of a sliding tag like latest we are updating the orb yaml before we are packing it.

Executor:

parameters:
  tag:
    default: __TAG_PLACEHOLDER__
    description: The tag for the image to use.
    type: string
docker:
  - image: repo.example.com/image:<< parameters.tag >>

The __TAG_PLACEHOLDER__ is replaced with the git commit sha by a job before the pack job is executed. However, without the attach_workspace step, the pack job uses the repo sources, which contain the placeholder instead of the actual tag. Obviously this does not work for us.

steinwelberg commented 1 year ago

Any update on this? I see that a PR was created in #193, but it was closed and not merged.

KyleTryon commented 1 year ago

Adding this to #181 👍

KyleTryon commented 1 year ago

@steinwelberg Actually we could add this as a feature in the future if desired, but I no longer think this is needed. In #181, the checkout step is now optional, meaning you may use pre-steps in your workflows to accomplish this. Does that sound acceptable?

steinwelberg commented 1 year ago

Yeah, I think that should work. We should be able to add the attach-workspace command as a pre-step!