-
Notifications
You must be signed in to change notification settings - Fork 11
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
Add JSON formatting check to the add-ign function #189
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,10 +12,11 @@ import ( | |
"os" | ||
"path/filepath" | ||
"runtime" | ||
"github.com/ulikunitz/xz" | ||
) | ||
|
||
const ( | ||
fedoraBaseDirEndpoint = "https://kojipkgs.fedoraproject.org/compose/cloud/latest-Fedora-Cloud-39/compose" | ||
fedoraBaseDirEndpoint = "https://kojipkgs.fedoraproject.org/compose/cloud/latest-Fedora-Cloud-40/compose" | ||
) | ||
|
||
// Fedora metadata for cloud downloads | ||
|
@@ -100,7 +101,7 @@ func (m fedoraCloudMetadata) downloadPathForVHD() (string, string, error) { | |
return "", "", errors.New("unable to parse metadata for cloud image") | ||
} | ||
for _, ci := range val { | ||
if ci.Format == "vhd" { // fedora does not make a vhdx | ||
if ci.Format == "vhd.xz" { // fedora does not make a vhdx | ||
return fmt.Sprintf("%s/%s", fedoraBaseDirEndpoint, ci.Path), ci.Checksums["sha256"], nil | ||
} | ||
} | ||
|
@@ -166,7 +167,39 @@ func getTestImage() (string, error) { | |
return "", err | ||
} | ||
} | ||
return dstPath, nil | ||
// Decompress the downloaded vhdfixed.xz file | ||
vhdPath := filepath.Join(defaultCacheDirPath, filepath.Base(downloadPath[:len(downloadPath)-len(".vhdfixed.xz")])) + ".vhd" | ||
err = decompressVhdXZ(dstPath, vhdPath) | ||
if err != nil { | ||
return "", err | ||
} | ||
return vhdPath, nil | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
|
||
} | ||
|
||
func decompressVhdXZ(src string, dst string) error { | ||
f, err := os.Open(src) | ||
if err != nil { | ||
return err | ||
} | ||
defer f.Close() | ||
|
||
r, err := xz.NewReader(f) | ||
if err != nil { | ||
return fmt.Errorf("xz decompression failed: %v", err) | ||
} | ||
|
||
// Directly copy the decompressed data to the destination file | ||
outFile, err := os.Create(dst) | ||
if err != nil { | ||
return err | ||
} | ||
defer outFile.Close() | ||
|
||
_, err = io.Copy(outFile, r) | ||
if err != nil { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. just return |
||
return err | ||
} | ||
return nil | ||
} | ||
|
||
func archFromGOOS() string { | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
mind changing to 41?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just noticed this as well in my image update Pr and tried to do a quick fix #197
Anyway it is complicated as there is no f41 on the server: i.e. 404 https://kojipkgs.fedoraproject.org/compose/cloud/latest-Fedora-Cloud-41/
I asked in the Fedora cloud matrix to see if this is a bug or not on their end. So Sticking to f40 seems to be the right call for now
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
https://pagure.io/releng/issue/12521
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
works for me