build freebsd binaries for CI (not included in releases yet)

pull/85/head
Jason Kulatunga 4 years ago
parent 4a12caf043
commit 1c7ca35ea7

@ -68,6 +68,18 @@ jobs:
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-web-windows-amd64.exe -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
go build -ldflags "-X main.goos=windows -X main.goarch=amd64" -o scrutiny-collector-metrics-windows-amd64.exe -tags "static" collector/cmd/collector-metrics/collector-metrics.go
- name: Build freebsd
env:
GOOS: freebsd
GOARCH: amd64
run: |
cd $PROJECT_PATH
go build -ldflags "-X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-web-freebsd-amd64 -tags "static" webapp/backend/cmd/scrutiny/scrutiny.go
go build -ldflags "-X main.goos=freebsd -X main.goarch=amd64" -o scrutiny-collector-metrics-freebsd-amd64 -tags "static" collector/cmd/collector-metrics/collector-metrics.go
chmod +x scrutiny-web-freebsd-amd64
chmod +x scrutiny-collector-metrics-freebsd-amd64
- name: Archive
uses: actions/upload-artifact@v2
with:
@ -81,6 +93,8 @@ jobs:
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-linux-arm
${{ env.PROJECT_PATH }}/scrutiny-web-windows-amd64.exe
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-windows-amd64.exe
${{ env.PROJECT_PATH }}/scrutiny-web-freebsd-amd64
${{ env.PROJECT_PATH }}/scrutiny-collector-metrics-freebsd-amd64
- uses: codecov/codecov-action@v1
with:
file: ${{ env.PROJECT_PATH }}/coverage.txt

@ -0,0 +1,49 @@
package detect
import (
"github.com/analogj/scrutiny/collector/pkg/models"
"github.com/jaypipes/ghw"
"strings"
)
func DevicePrefix() string {
return "/dev/"
}
func (d *Detect) Start() ([]models.Device, error) {
// call the base/common functionality to get a list of devices
detectedDevices, err := d.smartctlScan()
if err != nil {
return nil, err
}
//inflate device info for detected devices.
for ndx, _ := range detectedDevices {
d.smartCtlInfo(&detectedDevices[ndx]) //ignore errors.
}
return detectedDevices, nil
}
//WWN values NVMe and SCSI
func (d *Detect) wwnFallback(detectedDevice *models.Device) {
block, err := ghw.Block()
if err == nil {
for _, disk := range block.Disks {
if disk.Name == detectedDevice.DeviceName {
d.Logger.Debugf("Found matching block device. WWN: %s", disk.WWN)
detectedDevice.WWN = disk.WWN
break
}
}
}
//no WWN found, or could not open Block devices. Either way, fallback to serial number
if len(detectedDevice.WWN) == 0 {
d.Logger.Debugf("WWN is empty, falling back to serial number: %s", detectedDevice.SerialNumber)
detectedDevice.WWN = detectedDevice.SerialNumber
}
//wwn must always be lowercase.
detectedDevice.WWN = strings.ToLower(detectedDevice.WWN)
}
Loading…
Cancel
Save