Page MenuHomePhabricator

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

Authored by dduvall on Sep 5 2017, 11:29 PM.

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
Automatic diff as part of commit; lint not applicable.
Unit
Automatic diff as part of commit; unit tests not applicable.

Event Timeline

dduvall created this revision.Sep 5 2017, 11:29 PM
Restricted Application added a reviewer: mmodell. · View Herald TranscriptSep 5 2017, 11:29 PM
Restricted Application added a reviewer: Release-Engineering-Team. · View Herald Transcript
Restricted Application added a project: Release-Engineering-Team. · View Herald Transcript
thcipriani accepted this revision.Sep 7 2017, 12:14 AM

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.