Skip to content

Commit

Permalink
fix: specify the right path of metadata in bundle.Dockerfile
Browse files Browse the repository at this point in the history
Signed-off-by: varshaprasad96 <varshaprasad96@gmail.com>
  • Loading branch information
varshaprasad96 committed Jun 30, 2021
1 parent e222e98 commit acc29f4
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 3 deletions.
17 changes: 17 additions & 0 deletions changelog/fragments/generate-bundle-fix.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# entries is a list of entries to include in
# release notes and/or the migration guide
entries:
- description: >
Fixed the `operator-sdk generate bundle` command to specify the right path of bundle
metadata in bundle.Dcokerfile.
# kind is one of:
# - addition
# - change
# - deprecation
# - removal
# - bugfix
kind: bugfix
# Is this a breaking change?
breaking: false
8 changes: 5 additions & 3 deletions internal/util/bundleutil/bundleutil.go
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ func (meta *BundleMetaData) GenerateMetadata() error {
// Create annotation values for both bundle.Dockerfile and annotations.yaml, which should
// hold the same set of values always.
values := annotationsValues{
BundleDir: filepath.Base(meta.BundleDir),
BundleDir: meta.BundleDir,
PackageName: meta.PackageName,
Channels: meta.Channels,
DefaultChannel: meta.DefaultChannel,
Expand All @@ -107,11 +107,13 @@ func (meta *BundleMetaData) GenerateMetadata() error {
}

dockerfilePath := defaultBundleDockerfilePath
// If migrating from packagemanifests to bundle, bundle.Docker file is present
// inside bundleDir, else its in the project directory.
// If migrating from packagemanifests to bundle, bundle.Dockerfile is present
// inside bundleDir, else its in the project directory. Hence dockerfile
// should have the path specified with respect to output directory of resulting bundles.
// Remmove this, when pkgman-to-bundle migrate command is removed.
if len(meta.PkgmanifestPath) != 0 {
dockerfilePath = filepath.Join(filepath.Dir(meta.BundleDir), "bundle.Dockerfile")
values.BundleDir = filepath.Base(meta.BundleDir)
}

templateMap := map[string]*template.Template{
Expand Down

0 comments on commit acc29f4

Please sign in to comment.