summaryrefslogtreecommitdiff
path: root/config/common.go
diff options
context:
space:
mode:
authorDan Duvall <dduvall@wikimedia.org>2018-02-13 12:30:27 -0800
committerDan Duvall <dduvall@wikimedia.org>2018-03-06 10:21:15 -0800
commit6896e655eb5cc88b90e66979bc2d862eb92cbb9f (patch)
tree44b5f72b56a73e7c7aa661fc27413e5c3326b313 /config/common.go
parentb790283b431af7462324bdd26ab948c42c943915 (diff)
downloadblubber-6896e655eb5cc88b90e66979bc2d862eb92cbb9f.tar.gz
Support Python projects
Summary: A new root and variant `python` config field is provided with two new fields below, `version` and `requirements`. The former, `version`, should specify the Python executable to use when executing related package installation commands and ostensibly the same executable that will be used to run the application. The latter, `requirements`, should specify all pip requirements files such that a compiler that supports layered filesystems (e.g. Docker) can output separate instructions that will invalidate cache layers for changes to those files independently of changes to the rest of the codebase. Python related instructions will be generated only if either `version` or `requirements` are given. Fixes T186545 Test Plan: Run `go test ./...`. Reviewers: thcipriani, hashar, demon, #release-engineering-team Reviewed By: thcipriani, #release-engineering-team Tags: #release-engineering-team Maniphest Tasks: T186545 Differential Revision: https://phabricator.wikimedia.org/D976
Diffstat (limited to 'config/common.go')
-rw-r--r--config/common.go18
1 files changed, 10 insertions, 8 deletions
diff --git a/config/common.go b/config/common.go
index fa100b8..a597a82 100644
--- a/config/common.go
+++ b/config/common.go
@@ -8,13 +8,14 @@ import (
// and each configured variant.
//
type CommonConfig struct {
- Base string `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image
- Apt AptConfig `yaml:"apt"` // APT related configuration
- Node NodeConfig `yaml:"node"` // Node related configuration
- Lives LivesConfig `yaml:"lives"` // application owner/dir configuration
- Runs RunsConfig `yaml:"runs"` // runtime environment configuration
- SharedVolume Flag `yaml:"sharedvolume"` // define a volume for application
- EntryPoint []string `yaml:"entrypoint"` // entry-point executable
+ Base string `yaml:"base" validate:"omitempty,baseimage"` // name/path to base image
+ Apt AptConfig `yaml:"apt"` // APT related configuration
+ Node NodeConfig `yaml:"node"` // Node related configuration
+ Python PythonConfig `yaml:"python"` // Python related configuration
+ Lives LivesConfig `yaml:"lives"` // application owner/dir configuration
+ Runs RunsConfig `yaml:"runs"` // runtime environment configuration
+ SharedVolume Flag `yaml:"sharedvolume"` // define a volume for application
+ EntryPoint []string `yaml:"entrypoint"` // entry-point executable
}
// Merge takes another CommonConfig and merges its fields this one's.
@@ -26,6 +27,7 @@ func (cc *CommonConfig) Merge(cc2 CommonConfig) {
cc.Apt.Merge(cc2.Apt)
cc.Node.Merge(cc2.Node)
+ cc.Python.Merge(cc2.Python)
cc.Lives.Merge(cc2.Lives)
cc.Runs.Merge(cc2.Runs)
cc.SharedVolume.Merge(cc2.SharedVolume)
@@ -40,7 +42,7 @@ func (cc *CommonConfig) Merge(cc2 CommonConfig) {
// injected.
//
func (cc *CommonConfig) PhaseCompileableConfig() []build.PhaseCompileable {
- return []build.PhaseCompileable{cc.Apt, cc.Node, cc.Lives, cc.Runs}
+ return []build.PhaseCompileable{cc.Apt, cc.Node, cc.Python, cc.Lives, cc.Runs}
}
// InstructionsForPhase injects instructions into the given build phase for