project-stacker / stacker

Build OCI images natively from a declarative format
https://stackerbuild.io
Apache License 2.0
201 stars 34 forks source link

Feat: support git clone for imports #630

Open mikemccracken opened 3 months ago

mikemccracken commented 3 months ago

Is your feature request related to a problem? Please describe.

for build containers, it is common to have the run script clone some git repo, sometimes from an external source. Usually this is followed by checking out a specific commit or tag, to avoid having things change out form under your builds.

It might be a good idea to also check the hash of the resulting HEAD commit against what is expected, to avoid cases where tags move due to mistakes or malice.

Describe the solution you'd like

This can be done in the script easily enough, but it might be nice to provide this in stacker itself with something like this:

imports:
  - repo: https://github.com/left-pad/left-pad
    tag: 1.0-rc12-not-owned
    commit: d3adb33f

of course you only really need the commit, but the tag is useful for documentation

this would result in a clone at /stacker/imports/left-pad at the beginning of the run script.

Describe alternatives you've considered

No response

Additional context

No response