Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[v1.9.x] fix: specify the right path of metadata in bundle.Dockerfile #5035

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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