Allow create-repo to source trees from remote repositories

This makes possible to create the repositorie from external ones,
It also required to address #26.

Fixes #26
This commit is contained in:
Ettore Di Giacinto
2021-04-15 12:25:34 +02:00
parent 9202bcbbbe
commit c27d4d258e
8 changed files with 218 additions and 34 deletions

View File

@@ -52,15 +52,17 @@ func (l *dockerRepositoryGenerator) Initialize(path string, db pkg.PackageDataba
Debug("Skipping", info.Name(), err.Error())
return nil
}
if info.IsDir() {
Debug("Skipping directories")
return nil
}
if strings.HasSuffix(info.Name(), ".metadata.yaml") {
a := artifact.NewPackageArtifact(info.Name())
imageRepo := fmt.Sprintf("%s:%s", l.imagePrefix, filepath.Base(info.Name()))
if !strings.HasSuffix(info.Name(), ".metadata.yaml") {
return nil
}
if err := l.pushFileFromArtifact(a, imageRepo); err != nil {
return errors.Wrap(err, "while pushing file from artifact")
}
return nil // Skip with no errors
if err := l.pushImageFromArtifact(artifact.NewPackageArtifact(currentpath), l.b); err != nil {
return errors.Wrap(err, "while pushing metadata file associated to the artifact")
}
dat, err := ioutil.ReadFile(currentpath)