Add support for linux arm64 for #48

This commit is contained in:
David Dworken 2022-12-11 20:39:45 -08:00
parent 857e423e10
commit 7c86b812bf
No known key found for this signature in database
6 changed files with 38 additions and 2 deletions

View File

@ -0,0 +1,15 @@
version: 1
env:
- CGO_ENABLED=0
flags:
- -trimpath
goos: linux
goarch: arm64
binary: hishtory-{{ .Os }}-{{ .Arch }}
ldflags:
- '{{ .Env.VERSION_LDFLAGS }}'

View File

@ -35,6 +35,18 @@ jobs:
go-version: 1.18
evaluated-envs: "VERSION_LDFLAGS:${{needs.args.outputs.ldflags}}"
compile-builder: true # See github.com/slsa-framework/slsa-github-generator/issues/942
build-linux-arm64:
permissions:
id-token: write
contents: write
actions: read
needs: args
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.2.1
with:
config-file: .github/slsa/.slsa-goreleaser-linux-arm64.yml
go-version: 1.18
evaluated-envs: "VERSION_LDFLAGS:${{needs.args.outputs.ldflags}}"
compile-builder: true # See github.com/slsa-framework/slsa-github-generator/issues/942
build-freebsd-amd64:
permissions:
id-token: write

View File

@ -627,7 +627,7 @@ func decrementVersionIfInvalid(initialVersion string) string {
}
func assertValidUpdate(updateInfo shared.UpdateInfo) error {
urls := []string{updateInfo.LinuxAmd64Url, updateInfo.LinuxAmd64AttestationUrl,
urls := []string{updateInfo.LinuxAmd64Url, updateInfo.LinuxAmd64AttestationUrl, updateInfo.LinuxArm64Url, updateInfo.LinuxArm64AttestationUrl,
updateInfo.DarwinAmd64Url, updateInfo.DarwinAmd64UnsignedUrl, updateInfo.DarwinAmd64AttestationUrl,
updateInfo.DarwinArm64Url, updateInfo.DarwinArm64UnsignedUrl, updateInfo.DarwinArm64AttestationUrl}
for _, url := range urls {
@ -683,6 +683,8 @@ func buildUpdateInfo(version string) shared.UpdateInfo {
return shared.UpdateInfo{
LinuxAmd64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-amd64", version),
LinuxAmd64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-amd64.intoto.jsonl", version),
LinuxArm64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-arm64", version),
LinuxArm64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-arm64.intoto.jsonl", version),
DarwinAmd64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64", version),
DarwinAmd64UnsignedUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64-unsigned", version),
DarwinAmd64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64.intoto.jsonl", version),

View File

@ -14,8 +14,10 @@ with urllib.request.urlopen('https://api.hishtory.dev/api/v1/download') as respo
resp_body = response.read()
download_options = json.loads(resp_body)
if platform.system() == 'Linux':
if platform.system() == 'Linux' and platform.machine() == "x86_64":
download_url = download_options['linux_amd_64_url']
if platform.system() == 'Linux' and platform.machine() == "arm64":
download_url = download_options['linux_arm_64_url']
elif platform.system() == 'Darwin' and platform.machine() == 'arm64':
download_url = download_options['darwin_arm_64_url']
elif platform.system() == 'Darwin' and platform.machine() == 'x86_64':

View File

@ -817,6 +817,9 @@ func downloadFiles(updateInfo shared.UpdateInfo) error {
if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
clientUrl = updateInfo.LinuxAmd64Url
clientProvenanceUrl = updateInfo.LinuxAmd64AttestationUrl
} else if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
clientUrl = updateInfo.LinuxArm64Url
clientProvenanceUrl = updateInfo.LinuxArm64AttestationUrl
} else if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
clientUrl = updateInfo.DarwinAmd64Url
clientProvenanceUrl = updateInfo.DarwinAmd64AttestationUrl

View File

@ -44,6 +44,8 @@ type DumpRequest struct {
type UpdateInfo struct {
LinuxAmd64Url string `json:"linux_amd_64_url"`
LinuxAmd64AttestationUrl string `json:"linux_amd_64_attestation_url"`
LinuxArm64Url string `json:"linux_arm_64_url"`
LinuxArm64AttestationUrl string `json:"linux_arm_64_attestation_url"`
DarwinAmd64Url string `json:"darwin_amd_64_url"`
DarwinAmd64UnsignedUrl string `json:"darwin_amd_64_unsigned_url"`
DarwinAmd64AttestationUrl string `json:"darwin_amd_64_attestation_url"`