Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

feat: arm(v7/64) builds for releases and agent scripts#1337

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
bpmct merged 8 commits intomainfrombpmct/armv7
May 11, 2022
Merged
Show file tree
Hide file tree
Changes fromall 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
14 changes: 11 additions & 3 deletions.goreleaser.yaml
View file
Open in desktop
Original file line numberDiff line numberDiff line change
Expand Up@@ -32,11 +32,18 @@ builds:
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
env: [CGO_ENABLED=0]
goos: [darwin, linux, windows]
goarch: [amd64]
goarch: [amd64, arm, arm64]
goarm: ["7"]
# Only build arm 7 for Linux
ignore:
- goos: windows
goarm: '7'
- goos: darwin
goarm: '7'
hooks:
# The "trimprefix" appends ".exe" on Windows.
post: |
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{ trimprefix .Name "coder" }}
cp {{.Path}} site/out/bin/coder-{{ .Os }}-{{ .Arch }}{{if .Arm }}v{{ .Arm }}{{ end }}{{trimprefix .Name "coder" }}
Copy link
MemberAuthor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others.Learn more.

kylecarbs reacted with thumbs up emoji

- id: coder-linux
dir: cmd/coder
Expand All@@ -45,7 +52,8 @@ builds:
["-s -w -X github.com/coder/coder/buildinfo.tag={{ .Version }}"]
env: [CGO_ENABLED=0]
goos: [linux]
goarch: [amd64, arm64]
goarch: [amd64, arm, arm64]
goarm: ["7"]

- id: coder-windows
dir: cmd/coder
Expand Down
59 changes: 37 additions & 22 deletionsprovisionersdk/agent.go
View file
Open in desktop
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,56 @@
package provisionersdk

import "fmt"
import (
"fmt"
"strings"
)

var (
// A mapping of operating-system ($GOOS) to architecture ($GOARCH)
// to agent install and run script. ${DOWNLOAD_URL} is replaced
// with strings.ReplaceAll() when being consumed.
agentScripts = map[string]map[string]string{
// On Windows, VS Code Remote requires a parent process of the
// executing shell to be named "sshd", otherwise it fails. See:
// https://github.com/microsoft/vscode-remote-release/issues/5699
"windows": {
"amd64": `$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri ${ACCESS_URL}bin/coder-windows-amd64.exe -OutFile $env:TEMP\sshd.exe
// On Windows, VS Code Remote requires a parent process of the
// executing shell to be named "sshd", otherwise it fails. See:
// https://github.com/microsoft/vscode-remote-release/issues/5699
windowsScript = `$ProgressPreference = "SilentlyContinue"
Invoke-WebRequest -Uri ${ACCESS_URL}bin/coder-windows-${ARCH}.exe -OutFile $env:TEMP\sshd.exe
Set-MpPreference -DisableRealtimeMonitoring $true -ExclusionPath $env:TEMP\sshd.exe
$env:CODER_AGENT_AUTH = "${AUTH_TYPE}"
$env:CODER_AGENT_URL = "${ACCESS_URL}"
Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "agent" -PassThru`,
},
"linux": {
"amd64": `#!/usr/bin/env sh
Start-Process -FilePath $env:TEMP\sshd.exe -ArgumentList "agent" -PassThru`

linuxScript = `#!/usr/bin/env sh
set -eu pipefail
export BINARY_LOCATION=$(mktemp -d -t tmp.coderXXXXX)/coder
curl -fsSL ${ACCESS_URL}bin/coder-linux-amd64 -o $BINARY_LOCATION
curl -fsSL ${ACCESS_URL}bin/coder-linux-${ARCH} -o $BINARY_LOCATION
chmod +x $BINARY_LOCATION
export CODER_AGENT_AUTH="${AUTH_TYPE}"
export CODER_AGENT_URL="${ACCESS_URL}"
exec $BINARY_LOCATION agent`,
},
"darwin": {
"amd64": `#!/usr/bin/env sh
exec $BINARY_LOCATION agent`

darwinScript = `#!/usr/bin/env sh
set -eu pipefail
export BINARY_LOCATION=$(mktemp -d -t tmp.coderXXXXX)/coder
curl -fsSL ${ACCESS_URL}bin/coder-darwin-amd64 -o $BINARY_LOCATION
curl -fsSL ${ACCESS_URL}bin/coder-darwin-${ARCH} -o $BINARY_LOCATION
chmod +x $BINARY_LOCATION
export CODER_AGENT_AUTH="${AUTH_TYPE}"
export CODER_AGENT_URL="${ACCESS_URL}"
exec $BINARY_LOCATION agent`,
exec $BINARY_LOCATION agent`

// A mapping of operating-system ($GOOS) to architecture ($GOARCH)
// to agent install and run script. ${DOWNLOAD_URL} is replaced
// with strings.ReplaceAll() when being consumed. ${ARCH} is replaced
// with the architecture when being provided.
agentScripts = map[string]map[string]string{
"windows": {
"amd64": windowsScript,
"arm64": windowsScript,
},
"linux": {
"amd64": linuxScript,
"arm64": linuxScript,
"armv7": linuxScript,
},
"darwin": {
"amd64": darwinScript,
"arm64": darwinScript,
},
}
)
Expand All@@ -48,6 +62,7 @@ func AgentScriptEnv() map[string]string {
env := map[string]string{}
for operatingSystem, scripts := range agentScripts {
for architecture, script := range scripts {
script := strings.ReplaceAll(script, "${ARCH}", architecture)
env[fmt.Sprintf("CODER_AGENT_SCRIPT_%s_%s", operatingSystem, architecture)] = script
}
}
Expand Down

[8]ページ先頭

©2009-2025 Movatter.jp