diff --git a/cmd/helm/dependency_build.go b/cmd/helm/dependency_build.go index c8d22e7cf..67fe7cf26 100644 --- a/cmd/helm/dependency_build.go +++ b/cmd/helm/dependency_build.go @@ -26,7 +26,7 @@ import ( ) const dependencyBuildDesc = ` -Build out the charts/ directory from the requirements.lock file. +Build out the charts/ directory from the Chart.lock file. Build is used to reconstruct a chart's dependencies to the state specified in the lock file. This will not re-negotiate dependencies, as 'helm dependency update' @@ -50,7 +50,7 @@ func newDependencyBuildCmd(out io.Writer) *cobra.Command { cmd := &cobra.Command{ Use: "build CHART", - Short: "rebuild the charts/ directory based on the requirements.lock file", + Short: "rebuild the charts/ directory based on the Chart.lock file", Long: dependencyBuildDesc, Args: require.MaximumNArgs(1), RunE: func(cmd *cobra.Command, args []string) error { diff --git a/cmd/helm/dependency_build_test.go b/cmd/helm/dependency_build_test.go index ff740a1f2..5c2f004fb 100644 --- a/cmd/helm/dependency_build_test.go +++ b/cmd/helm/dependency_build_test.go @@ -64,7 +64,7 @@ func TestDependencyBuildCmd(t *testing.T) { // In the second pass, we want to remove the chart's request dependency, // then see if it restores from the lock. - lockfile := hh.Path(chartname, "requirements.lock") + lockfile := hh.Path(chartname, "Chart.lock") if _, err := os.Stat(lockfile); err != nil { t.Fatal(err) } diff --git a/cmd/helm/testdata/testcharts/reqtest/requirements.lock b/cmd/helm/testdata/testcharts/reqtest/Chart.lock similarity index 100% rename from cmd/helm/testdata/testcharts/reqtest/requirements.lock rename to cmd/helm/testdata/testcharts/reqtest/Chart.lock diff --git a/pkg/chart/chart.go b/pkg/chart/chart.go index c78ad60fb..d314104da 100644 --- a/pkg/chart/chart.go +++ b/pkg/chart/chart.go @@ -20,8 +20,8 @@ package chart type Chart struct { // Metadata is the contents of the Chartfile. Metadata *Metadata - // RequirementsLock is the contents of requirements.lock. - RequirementsLock *RequirementsLock + // LocK is the contents of Chart.lock. + Lock *Lock // Templates for this chart. Templates []*File // TODO Delete RawValues after unit tests for `create` are refactored. diff --git a/pkg/chart/loader/load.go b/pkg/chart/loader/load.go index 4075ed6fa..855d92e57 100644 --- a/pkg/chart/loader/load.go +++ b/pkg/chart/loader/load.go @@ -77,10 +77,10 @@ func LoadFiles(files []*BufferedFile) (*chart.Chart, error) { if err := yaml.Unmarshal(f.Data, c.Metadata); err != nil { return c, errors.Wrap(err, "cannot load Chart.yaml") } - case f.Name == "requirements.lock": - c.RequirementsLock = new(chart.RequirementsLock) - if err := yaml.Unmarshal(f.Data, &c.RequirementsLock); err != nil { - return c, errors.Wrap(err, "cannot load requirements.lock") + case f.Name == "Chart.lock": + c.Lock = new(chart.Lock) + if err := yaml.Unmarshal(f.Data, &c.Lock); err != nil { + return c, errors.Wrap(err, "cannot load Chart.lock") } case f.Name == "values.yaml": c.Values = make(map[string]interface{}) diff --git a/pkg/chart/loader/load_test.go b/pkg/chart/loader/load_test.go index 630da5cd4..6fda07ceb 100644 --- a/pkg/chart/loader/load_test.go +++ b/pkg/chart/loader/load_test.go @@ -248,8 +248,8 @@ func verifyChartFileAndTemplate(t *testing.T, c *chart.Chart, name string) { if len(c.Metadata.Requirements) != 2 { t.Fatalf("Expected 2 Requirements.Dependency, got %d", len(c.Metadata.Requirements)) } - if len(c.RequirementsLock.Dependencies) != 2 { - t.Fatalf("Expected 2 RequirementsLock.Dependency, got %d", len(c.RequirementsLock.Dependencies)) + if len(c.Lock.Dependencies) != 2 { + t.Fatalf("Expected 2 Lock.Dependency, got %d", len(c.Lock.Dependencies)) } for _, dep := range c.Dependencies() { diff --git a/pkg/chart/loader/testdata/frobnitz-1.2.3.tgz b/pkg/chart/loader/testdata/frobnitz-1.2.3.tgz index a8ba8ec6f..983820e06 100644 Binary files a/pkg/chart/loader/testdata/frobnitz-1.2.3.tgz and b/pkg/chart/loader/testdata/frobnitz-1.2.3.tgz differ diff --git a/pkg/chart/loader/testdata/frobnitz/requirements.lock b/pkg/chart/loader/testdata/frobnitz/Chart.lock similarity index 100% rename from pkg/chart/loader/testdata/frobnitz/requirements.lock rename to pkg/chart/loader/testdata/frobnitz/Chart.lock diff --git a/pkg/chart/loader/testdata/frobnitz/charts/mariner-4.3.2.tgz b/pkg/chart/loader/testdata/frobnitz/charts/mariner-4.3.2.tgz index ac499ec9f..88c24d822 100644 Binary files a/pkg/chart/loader/testdata/frobnitz/charts/mariner-4.3.2.tgz and b/pkg/chart/loader/testdata/frobnitz/charts/mariner-4.3.2.tgz differ diff --git a/pkg/chart/loader/testdata/frobnitz_backslash-1.2.3.tgz b/pkg/chart/loader/testdata/frobnitz_backslash-1.2.3.tgz index bc6be27aa..513bfca1a 100644 Binary files a/pkg/chart/loader/testdata/frobnitz_backslash-1.2.3.tgz and b/pkg/chart/loader/testdata/frobnitz_backslash-1.2.3.tgz differ diff --git a/pkg/chart/loader/testdata/frobnitz_backslash/requirements.lock b/pkg/chart/loader/testdata/frobnitz_backslash/Chart.lock similarity index 100% rename from pkg/chart/loader/testdata/frobnitz_backslash/requirements.lock rename to pkg/chart/loader/testdata/frobnitz_backslash/Chart.lock diff --git a/pkg/chart/loader/testdata/mariner/charts/albatross-0.1.0.tgz b/pkg/chart/loader/testdata/mariner/charts/albatross-0.1.0.tgz index f34758e12..fa8ef5aca 100644 Binary files a/pkg/chart/loader/testdata/mariner/charts/albatross-0.1.0.tgz and b/pkg/chart/loader/testdata/mariner/charts/albatross-0.1.0.tgz differ diff --git a/pkg/chart/requirements.go b/pkg/chart/requirements.go index bb2d1d11c..2c17a97c6 100644 --- a/pkg/chart/requirements.go +++ b/pkg/chart/requirements.go @@ -49,10 +49,10 @@ type Dependency struct { Alias string `json:"alias,omitempty"` } -// RequirementsLock is a lock file for requirements. +// Lock is a lock file for requirements. // // It represents the state that the dependencies should be in. -type RequirementsLock struct { +type Lock struct { // Genderated is the date the lock file was last generated. Generated time.Time `json:"generated"` // Digest is a hash of the requirements file used to generate it. diff --git a/pkg/chartutil/requirements_test.go b/pkg/chartutil/requirements_test.go index 4d35c07cf..1683c01e2 100644 --- a/pkg/chartutil/requirements_test.go +++ b/pkg/chartutil/requirements_test.go @@ -35,12 +35,12 @@ func TestLoadRequirements(t *testing.T) { verifyRequirements(t, c) } -func TestLoadRequirementsLock(t *testing.T) { +func TestLoadChartLock(t *testing.T) { c, err := loader.Load("testdata/frobnitz") if err != nil { t.Fatalf("Failed to load testdata: %s", err) } - verifyRequirementsLock(t, c) + verifyChartLock(t, c) } func TestRequirementsEnabled(t *testing.T) { @@ -426,7 +426,7 @@ func verifyRequirements(t *testing.T, c *chart.Chart) { } } -func verifyRequirementsLock(t *testing.T, c *chart.Chart) { +func verifyChartLock(t *testing.T, c *chart.Chart) { if len(c.Metadata.Requirements) != 2 { t.Errorf("Expected 2 requirements, got %d", len(c.Metadata.Requirements)) } diff --git a/pkg/chartutil/testdata/dependent-chart-alias/requirements.lock b/pkg/chartutil/testdata/dependent-chart-alias/Chart.lock similarity index 100% rename from pkg/chartutil/testdata/dependent-chart-alias/requirements.lock rename to pkg/chartutil/testdata/dependent-chart-alias/Chart.lock diff --git a/pkg/chartutil/testdata/frobnitz/requirements.lock b/pkg/chartutil/testdata/frobnitz/Chart.lock similarity index 100% rename from pkg/chartutil/testdata/frobnitz/requirements.lock rename to pkg/chartutil/testdata/frobnitz/Chart.lock diff --git a/pkg/chartutil/testdata/frobnitz_backslash/requirements.lock b/pkg/chartutil/testdata/frobnitz_backslash/Chart.lock similarity index 100% rename from pkg/chartutil/testdata/frobnitz_backslash/requirements.lock rename to pkg/chartutil/testdata/frobnitz_backslash/Chart.lock diff --git a/pkg/downloader/manager.go b/pkg/downloader/manager.go index d4461d4bf..b80fd8d5c 100644 --- a/pkg/downloader/manager.go +++ b/pkg/downloader/manager.go @@ -73,14 +73,14 @@ func (m *Manager) Build() error { // If a lock file is found, run a build from that. Otherwise, just do // an update. - lock := c.RequirementsLock + lock := c.Lock if lock == nil { return m.Update() } req := c.Metadata.Requirements if sum, err := resolver.HashReq(req); err != nil || sum != lock.Digest { - return errors.New("requirements.lock is out of sync with Chart.yaml") + return errors.New("Chart.lock is out of sync with Chart.yaml") } // Check that all of the repos we're dependent on actually exist. @@ -155,7 +155,7 @@ func (m *Manager) Update() error { } // If the lock file hasn't changed, don't write a new one. - oldLock := c.RequirementsLock + oldLock := c.Lock if oldLock != nil && oldLock.Digest == lock.Digest { return nil } @@ -176,7 +176,7 @@ func (m *Manager) loadChartDir() (*chart.Chart, error) { // resolve takes a list of requirements and translates them into an exact version to download. // // This returns a lock file, which has all of the requirements normalized to a specific version. -func (m *Manager) resolve(req []*chart.Dependency, repoNames map[string]string, hash string) (*chart.RequirementsLock, error) { +func (m *Manager) resolve(req []*chart.Dependency, repoNames map[string]string, hash string) (*chart.Lock, error) { res := resolver.New(m.ChartPath, m.HelmHome) return res.Resolve(req, repoNames, hash) } @@ -585,12 +585,12 @@ func (m *Manager) loadChartRepositories() (map[string]*repo.ChartRepository, err } // writeLock writes a lockfile to disk -func writeLock(chartpath string, lock *chart.RequirementsLock) error { +func writeLock(chartpath string, lock *chart.Lock) error { data, err := yaml.Marshal(lock) if err != nil { return err } - dest := filepath.Join(chartpath, "requirements.lock") + dest := filepath.Join(chartpath, "Chart.lock") return ioutil.WriteFile(dest, data, 0644) } diff --git a/pkg/resolver/resolver.go b/pkg/resolver/resolver.go index 7072547f1..367529f0c 100644 --- a/pkg/resolver/resolver.go +++ b/pkg/resolver/resolver.go @@ -47,7 +47,7 @@ func New(chartpath string, helmhome helmpath.Home) *Resolver { } // Resolve resolves dependencies and returns a lock file with the resolution. -func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string, d string) (*chart.RequirementsLock, error) { +func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string, d string) (*chart.Lock, error) { // Now we clone the dependencies, locking as we go. locked := make([]*chart.Dependency, len(reqs)) @@ -107,7 +107,7 @@ func (r *Resolver) Resolve(reqs []*chart.Dependency, repoNames map[string]string if len(missing) > 0 { return nil, errors.Errorf("can't get a valid version for repositories %s. Try changing the version constraint in Chart.yaml", strings.Join(missing, ", ")) } - return &chart.RequirementsLock{ + return &chart.Lock{ Generated: time.Now(), Digest: d, Dependencies: locked, diff --git a/pkg/resolver/resolver_test.go b/pkg/resolver/resolver_test.go index 84cf54ccf..7ec0cd387 100644 --- a/pkg/resolver/resolver_test.go +++ b/pkg/resolver/resolver_test.go @@ -25,7 +25,7 @@ func TestResolve(t *testing.T) { tests := []struct { name string req []*chart.Dependency - expect *chart.RequirementsLock + expect *chart.Lock err bool }{ { @@ -61,7 +61,7 @@ func TestResolve(t *testing.T) { req: []*chart.Dependency{ {Name: "alpine", Repository: "http://example.com", Version: ">=0.1.0"}, }, - expect: &chart.RequirementsLock{ + expect: &chart.Lock{ Dependencies: []*chart.Dependency{ {Name: "alpine", Repository: "http://example.com", Version: "0.2.0"}, }, @@ -72,7 +72,7 @@ func TestResolve(t *testing.T) { req: []*chart.Dependency{ {Name: "signtest", Repository: "file://../../../../cmd/helm/testdata/testcharts/signtest", Version: "0.1.0"}, }, - expect: &chart.RequirementsLock{ + expect: &chart.Lock{ Dependencies: []*chart.Dependency{ {Name: "signtest", Repository: "file://../../../../cmd/helm/testdata/testcharts/signtest", Version: "0.1.0"}, },