-
Notifications
You must be signed in to change notification settings - Fork 545
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
Orbit for Windows ARM64 #27882
Orbit for Windows ARM64 #27882
Changes from 6 commits
eb989ad
a506b46
a5037e4
324661e
fefd2ba
2c89156
df0d549
0677ed6
3ec1d7a
db2a3de
791ec9f
511f6ad
5f6e8a4
bfcc7bb
c7e38ec
451312b
b56025c
439284d
2049591
253dd09
1be1717
ee0ff70
23de376
f5ef575
ae29dd2
2796692
ae5d97a
21ff74e
eab0b6d
2c29281
46b127c
07df70e
84d6003
b35ce00
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 |
---|---|---|
@@ -0,0 +1,44 @@ | ||
version: 2 | ||
|
||
project_name: orbit | ||
|
||
################################################################################################# | ||
# If this is updated make sure to update the "How to build from source" section in the README.md. | ||
################################################################################################# | ||
|
||
builds: | ||
- id: orbit | ||
dir: ./orbit/cmd/orbit/ | ||
binary: orbit | ||
env: | ||
- CGO_ENABLED=0 | ||
goos: | ||
- windows | ||
goarch: | ||
- arm64 | ||
flags: | ||
- -trimpath | ||
ldflags: | ||
- -X github.com/fleetdm/fleet/v4/orbit/pkg/build.Version={{.Version}} | ||
- -X github.com/fleetdm/fleet/v4/orbit/pkg/build.Commit={{.Commit}} | ||
- -X github.com/fleetdm/fleet/v4/orbit/pkg/build.Date={{.Date}} | ||
hooks: | ||
pre: "go run ./orbit/tools/build/build-windows.go -version {{.Version}} -input ./orbit/cmd/orbit -resource=true -arch arm64" | ||
|
||
archives: | ||
- id: orbit | ||
builds: | ||
- orbit | ||
name_template: orbit_{{.Version}}_{{.Os}} | ||
format_overrides: | ||
- goos: windows | ||
format: zip | ||
|
||
checksum: | ||
name_template: 'checksums.txt' | ||
|
||
snapshot: | ||
version_template: "{{ .Tag }}-untagged" | ||
|
||
changelog: | ||
disable: true |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -27,7 +27,7 @@ import ( | |
"golang.org/x/mod/semver" | ||
) | ||
|
||
const wixDownload = "https://github.com/wixtoolset/wix3/releases/download/wix3112rtm/wix311-binaries.zip" | ||
const wixDownload = "https://github.com/wixtoolset/wix3/releases/download/wix3141rtm/wix314-binaries.zip" | ||
|
||
// BuildMSI builds a Windows .msi. | ||
// Note: this function is not safe for concurrent use | ||
|
@@ -52,7 +52,11 @@ func BuildMSI(opt Options) (string, error) { | |
updateOpt := update.DefaultOptions | ||
|
||
updateOpt.RootDirectory = orbitRoot | ||
updateOpt.Targets = update.WindowsTargets | ||
if opt.Architecture == ArchAmd64 { | ||
updateOpt.Targets = update.WindowsTargets | ||
} else { | ||
updateOpt.Targets = update.WindowsArm64Targets | ||
} | ||
updateOpt.ServerCertificatePath = opt.UpdateTLSServerCertificate | ||
|
||
if opt.UpdateTLSClientCertificate != "" { | ||
|
@@ -64,7 +68,11 @@ func BuildMSI(opt Options) (string, error) { | |
} | ||
|
||
if opt.Desktop { | ||
updateOpt.Targets[constant.DesktopTUFTargetName] = update.DesktopWindowsTarget | ||
if opt.Architecture == ArchArm64 { | ||
updateOpt.Targets[constant.DesktopTUFTargetName] = update.DesktopWindowsArm64Target | ||
} else { | ||
updateOpt.Targets[constant.DesktopTUFTargetName] = update.DesktopWindowsTarget | ||
} | ||
// Override default channel with the provided value. | ||
updateOpt.Targets.SetTargetChannel(constant.DesktopTUFTargetName, opt.DesktopChannel) | ||
} | ||
|
@@ -206,15 +214,15 @@ func BuildMSI(opt Options) (string, error) { | |
return "", fmt.Errorf("transform heat: %w", err) | ||
} | ||
|
||
if err := wix.Candle(tmpDir, opt.NativeTooling, absWixDir); err != nil { | ||
if err := wix.Candle(tmpDir, opt.NativeTooling, absWixDir, opt.Architecture); err != nil { | ||
return "", fmt.Errorf("build package: %w", err) | ||
} | ||
|
||
if err := wix.Light(tmpDir, opt.NativeTooling, absWixDir); err != nil { | ||
return "", fmt.Errorf("build package: %w", err) | ||
} | ||
|
||
filename := "fleet-osquery.msi" | ||
filename := fmt.Sprintf("fleet-osquery_%s_%s.msi", opt.Version, opt.Architecture) | ||
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. We should keep the amd64 one the same name (without prefix). (And not add version for now until/if we decide to do it for pkg too.) 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. 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. That seems reasonable, I can save the new name format for the arm release only |
||
if opt.NativeTooling { | ||
filename = filepath.Join("build", filename) | ||
} | ||
|
@@ -299,13 +307,15 @@ func writePowershellInstallerUtilsFile(opt Options, rootPath string) error { | |
|
||
// writeManifestXML creates the manifest.xml file used when generating the 'resource_windows.syso' metadata | ||
// (see writeResourceSyso). Returns the path of the newly created file. | ||
func writeManifestXML(vParts []string, orbitPath string) (string, error) { | ||
func writeManifestXML(vParts []string, orbitPath string, arch string) (string, error) { | ||
filePath := filepath.Join(orbitPath, "manifest.xml") | ||
|
||
tmplOpts := struct { | ||
Version string | ||
Arch string | ||
}{ | ||
Version: strings.Join(vParts, "."), | ||
Arch: arch, | ||
} | ||
|
||
var contents bytes.Buffer | ||
|
@@ -429,7 +439,7 @@ func writeResourceSyso(opt Options, orbitPath string) error { | |
return fmt.Errorf("invalid version %s: %w", opt.Version, err) | ||
} | ||
|
||
manifestPath, err := writeManifestXML(vParts, orbitPath) | ||
manifestPath, err := writeManifestXML(vParts, orbitPath, opt.Architecture) | ||
if err != nil { | ||
return fmt.Errorf("creating manifest.xml: %w", err) | ||
} | ||
|
@@ -444,7 +454,7 @@ func writeResourceSyso(opt Options, orbitPath string) error { | |
vi.Walk() | ||
|
||
outPath := filepath.Join(orbitPath, "resource_windows.syso") | ||
if err := vi.WriteSyso(outPath, "amd64"); err != nil { | ||
if err := vi.WriteSyso(outPath, opt.Architecture); err != nil { | ||
return fmt.Errorf("creating syso file: %w", err) | ||
} | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -54,6 +54,20 @@ var ( | |
}, | ||
} | ||
|
||
WindowsArm64Targets = Targets{ | ||
constant.OrbitTUFTargetName: TargetInfo{ | ||
Platform: "windows-arm64", | ||
Channel: "stable", | ||
TargetFile: "orbit.exe", | ||
}, | ||
// NOTE: Currently osquery doesn't fully support ARM64, continue to use the x86 version for now | ||
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. Am curious does the Windows arm64 provided in the Github releases not work? 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. Hey Lucas! So I'm still a little uncertain about osquery's windows ARM support. They don't have build instructions on their website and I've tried my best to build it locally but failed. This isn't a total dealbreaker but it means that we cannot submit bug fixes upstream if we find an issue with it for the time being. I've also noticed that it doesn't return the 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. I would suggest discussing it with the product team. Maybe we can release fleetd for Windows ARM64 as beta/alpha (to get gears moving). 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. (Because the user/customer requesting this wanted to avoid emulation.) 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. Since this release is going to be a "newly supported" platform, I could also just use it and we mark it as experimental 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. @noahtalerman Do you have any input on this? 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. @lucasmrod One problem I've noticed with the ARM version of osquery is that it doesn't report the processor information at all. I'm also not able to debug the issue because I can't compile it locally though. |
||
constant.OsqueryTUFTargetName: TargetInfo{ | ||
Platform: "windows", | ||
Channel: "stable", | ||
TargetFile: "osqueryd.exe", | ||
}, | ||
} | ||
|
||
WindowsTargets = Targets{ | ||
constant.OrbitTUFTargetName: TargetInfo{ | ||
Platform: "windows", | ||
|
@@ -80,6 +94,12 @@ var ( | |
TargetFile: constant.DesktopAppExecName + ".exe", | ||
} | ||
|
||
DesktopWindowsArm64Target = TargetInfo{ | ||
Platform: "windows-arm64", | ||
Channel: "stable", | ||
TargetFile: constant.DesktopAppExecName + ".exe", | ||
} | ||
|
||
DesktopLinuxTarget = TargetInfo{ | ||
Platform: "linux", | ||
Channel: "stable", | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
package update | ||
|
||
import ( | ||
"os" | ||
"path/filepath" | ||
|
||
"github.com/theupdateframework/go-tuf/client" | ||
) | ||
|
||
var defaultOptions = Options{ | ||
RootDirectory: `C:\Program Files\Orbit`, | ||
ServerURL: DefaultURL, | ||
RootKeys: defaultRootMetadata, | ||
LocalStore: client.MemoryLocalStore(), | ||
InsecureTransport: false, | ||
Targets: WindowsArm64Targets, | ||
} | ||
|
||
func init() { | ||
// Set root directory to value of ProgramFiles environment variable if not set | ||
if dir := os.Getenv("ProgramFiles"); dir != "" { | ||
DefaultOptions.RootDirectory = filepath.Join(dir, "Orbit") | ||
} | ||
} |
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.
@noahtalerman @dantecatalfamo Should we add a note somewhere in the output that
fleetctl package --type=msi --arch=arm64 [...]
is experimental?