Skip to content
This repository has been archived by the owner on Feb 9, 2024. It is now read-only.

Commit

Permalink
[6.1.x] tele build (#2126)
Browse files Browse the repository at this point in the history
* Fallback to planet package from the package dependency list when
querying the default planet package for dependency configuration.
When syncing packages from the enterprise hub, the returned manifest
will be processed by an older version and will __not__ include the more
recent changes like the systemOptions - hence the new planet package
configuration is effectively lost.
This has the drawback that the planet package will still be pulled in
the custom planet package case (i.e. when there is a global
systemOptions.baseImage configuration) but it is better than the error
this would generate otherwise.

* Add integration test for the builder package that catches the issue that's being fixed in this changeset

* Add more bulder tests to test custom planet image handling during 'tele build'

* Address review comments. Use proper fences for docker-specific tests

* Use cluster-type application manifests for tests
  • Loading branch information
a-palchikov authored Sep 15, 2020
1 parent 5f105a2 commit f00c352
Show file tree
Hide file tree
Showing 390 changed files with 12,171 additions and 110,282 deletions.
56 changes: 34 additions & 22 deletions Gopkg.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 4 additions & 0 deletions Gopkg.toml
Original file line number Diff line number Diff line change
Expand Up @@ -302,3 +302,7 @@ ignored = [
[[override]]
name = "github.com/gravitational/coordinate"
revision = "2bc9a83f6fe22919202fb09bfa01f2ff8b7784cb"

[[override]]
name = "github.com/fsouza/go-dockerclient"
version = "=v1.6.5"
5 changes: 4 additions & 1 deletion lib/app/service/docker.go
Original file line number Diff line number Diff line change
Expand Up @@ -137,12 +137,15 @@ func (r *layerExporter) tagCmd(image, repository, tag string) error {
}

func (r *layerExporter) pushCmd(name, tag string) error {
// token value irrelevant, it just needs to render the auth non-empty
// See: https://github.com/moby/moby/issues/10983
const registryToken = "token"
opts := dockerapi.PushImageOptions{
Name: fmt.Sprintf("%v/%v", r.registry.Addr(), name),
Tag: tag,
}
r.Infof("Pushing %v.", opts)
return r.dockerClient.PushImage(opts, dockerapi.AuthConfiguration{})
return r.dockerClient.PushImage(opts, dockerapi.AuthConfiguration{RegistryToken: registryToken})
}

func (r *layerExporter) removeTagCmd(name, tag string) error {
Expand Down
8 changes: 4 additions & 4 deletions lib/app/service/test/builder.go
Original file line number Diff line number Diff line change
Expand Up @@ -202,7 +202,7 @@ func CreateApplicationFromBinaryData(apps app.Applications, locator loc.Locator,
app, err = apps.GetApp(locator)
c.Assert(err, IsNil)
c.Assert(app, NotNil)
c.Logf("created %v", app)
c.Logf("Created application %v.", app.Package)
return app
}

Expand All @@ -226,20 +226,20 @@ systemOptions:
CreateApplicationFromData(apps, locator, items, c)
}

func CreatePackage(packages pack.PackageService, locator loc.Locator, files []*archive.Item, c *C) *pack.PackageEnvelope {
func CreatePackage(packages pack.PackageService, locator loc.Locator, files []*archive.Item, c *C, opts ...pack.PackageOption) *pack.PackageEnvelope {
input := CreatePackageData(files, c)

c.Assert(packages.UpsertRepository(locator.Repository, time.Time{}), IsNil)

app, err := packages.CreatePackage(locator, &input)
app, err := packages.CreatePackage(locator, &input, opts...)
c.Assert(err, IsNil)
c.Assert(app, NotNil)

envelope, err := packages.ReadPackageEnvelope(locator)
c.Assert(err, IsNil)
c.Assert(envelope, NotNil)
c.Assert(envelope.SizeBytes, Not(Equals), int64(0))
c.Logf("created package %v", envelope)
c.Logf("Created package %v.", envelope)
return envelope
}

Expand Down
1 change: 1 addition & 0 deletions lib/builder/build.go
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ func Build(ctx context.Context, builder *Builder) error {
err = builder.SyncPackageCache(ctx, runtimeVersion)
if err != nil {
if trace.IsNotFound(err) {
logrus.WithField("runtime-version", runtimeVersion).WithError(err).Warn("Failed to sync package cache.")
return trace.NotFound("base image version %v not found", runtimeVersion)
}
return trace.Wrap(err)
Expand Down
Loading

0 comments on commit f00c352

Please sign in to comment.