Page MenuHomePhabricator

Support `copies` config entry for multi-stage builds
ClosedPublic

Authored by dduvall on Sep 5 2017, 11:29 PM.
Referenced Files
Unknown Object (File)
Apr 29 2023, 3:54 PM
Unknown Object (File)
Apr 22 2023, 9:45 AM
Unknown Object (File)
Feb 7 2023, 3:59 PM
Unknown Object (File)
Feb 2 2023, 11:12 AM
Unknown Object (File)
Jan 27 2023, 6:20 PM
Unknown Object (File)
Jan 22 2023, 10:48 AM
Unknown Object (File)
Jan 16 2023, 12:51 PM
Unknown Object (File)
Jan 7 2023, 6:55 PM
Subscribers
None

Details

Maniphest Tasks
T174622: Shorthand for standard multi-stage artifact config
Reviewers
thcipriani
mobrovac
hashar
mmodell
Group Reviewers
Release-Engineering-Team
Commits
rGBLBR410085e1f5be: Support `copies` config entry for multi-stage builds
Patch without arc
git checkout -b D768 && curl -L https://phabricator.wikimedia.org/D768?download=true | git apply
Summary

Support a copies variant config entry that will result in a
multi-stage build, copying both shared library files and application
directory from a previously defined variant. This is essentially a
shorthand for two artifacts entries that are likely to be idiomatic to
multi-stage build/prod configurations.

Defined a new abstract build.CopyFrom instruction and corresponding
docker.DockerCopyFrom instruction and refactored the writing of these
Dockerfile lines to be accomplished using an InstructionsForPhase
method on config.ArtifactsConfig.

Implemented new support for copies configuration in
config.VariantConfig and an InstructionsForPhase method that returns
build.CopyFrom instructions for both the shared library and
application directories.

Fixes T174622
Depends on D759

Test Plan

Run go test ./.... Run blubber blubber.example.yaml production and ensure
the right COPY --from lines are included for the final stage.

Diff Detail

Repository
rGBLBR Blubber
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript

I like moving the artifacts to using InstructionsForPhase. I have Weird Feelings™ about the defaultArtifacts method. Comments inline.

Anyway, seems to work without my bike-shedding, accepting.

config/variant.go
51

I think maybe this could use a comment to explain that this is building artifacts from idomatic configuration shorthand. Or maybe a buildCopyArtifacts method would be more self-explanatory(?). Anyway, I was surprised that defaultArtifacts was the method where the copies artifacts were added.

This revision is now accepted and ready to land.Sep 7 2017, 12:14 AM
This revision was automatically updated to reflect the committed changes.