Skip to content

Commit

Permalink
small refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
Mateusz Kuziemko committed Jan 13, 2022
1 parent 529468c commit f125de7
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 15 deletions.
25 changes: 11 additions & 14 deletions cmd/populator/cmd/register/ocf_manifests.go
Original file line number Diff line number Diff line change
Expand Up @@ -185,23 +185,20 @@ func getSourcesInfo(ctx context.Context, cfg dbpopulator.Config, log *zap.Logger
return nil, fmt.Errorf("empty list of files for source %s", source)
}

if !cfg.UpdateOnGitCommit {
sourcesInfo = append(sourcesInfo, dbpopulator.SourceInfo{
Files: files,
RootDir: rootDir,
})
continue
newSourceInfo := dbpopulator.SourceInfo{
Files: files,
RootDir: rootDir,
}

gitHash, err := getGitHash(rootDir)
if err != nil {
return nil, errors.Wrap(err, "while getting `git rev-parse HEAD`")
if cfg.UpdateOnGitCommit {
gitHash, err := getGitHash(rootDir)
if err != nil {
return nil, errors.Wrap(err, "while getting `git rev-parse HEAD`")
}
newSourceInfo.GitHash = gitHash
}
sourcesInfo = append(sourcesInfo, dbpopulator.SourceInfo{
Files: files,
GitHash: gitHash,
RootDir: rootDir,
})

sourcesInfo = append(sourcesInfo, newSourceInfo)
}
return sourcesInfo, nil
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/populator/docs/populator_register-ocf-manifests.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ It creates a binary for your platform in the `bin` directory. For example, for L
> **CAUTION:** In order to run DB populator manually, make sure the populator inside development cluster is disabled.
> To disable it, run `ENABLE_POPULATOR=false make dev-cluster-update`
It requires one argument, which is a path to directory with Hub manifests. Internally it uses [go-getter](https://github.com/hashicorp/go-getter) so it can download manifests from different locations and in different formats.
It requires one argument, which is a path to directory with Hub manifests. Internally it uses [go-getter](https://github.com/hashicorp/go-getter) so it can download manifests from different locations and in different formats. Supported protocols in DB populator are Git and local files.

To be able to use it locally when Capact is running in a Kubernetes cluster, two ports need to
be forwarded:
Expand Down

0 comments on commit f125de7

Please sign in to comment.