mirror of
https://github.com/coder/coder.git
synced 2025-07-18 14:17:22 +00:00
feat: Refactor API routes to use UUIDs instead of friendly names (#401)
* Add client for agent * Cleanup code * Fix linting error * Rename routes to be simpler * Rename workspace history to workspace build * Refactor HTTP middlewares to use UUIDs * Cleanup routes * Compiles! * Fix files and organizations * Fix querying * Fix agent lock * Cleanup database abstraction * Add parameters * Fix linting errors * Fix log race * Lock on close wait * Fix log cleanup * Fix e2e tests * Fix upstream version of opencensus-go * Update coderdtest.go * Fix coverpkg * Fix codecov ignore
This commit is contained in:
@ -18,6 +18,7 @@ var (
|
||||
$ProgressPreference = "SilentlyContinue"
|
||||
$ErrorActionPreference = "Stop"
|
||||
Invoke-WebRequest -Uri ${DOWNLOAD_URL} -OutFile $env:TEMP\coder.exe
|
||||
$env:CODER_URL = "${ACCESS_URL}"
|
||||
Start-Process -FilePath $env:TEMP\coder.exe workspaces agent
|
||||
`,
|
||||
},
|
||||
@ -28,6 +29,7 @@ set -eu pipefail
|
||||
BINARY_LOCATION=$(mktemp -d)/coder
|
||||
curl -fsSL ${DOWNLOAD_URL} -o $BINARY_LOCATION
|
||||
chmod +x $BINARY_LOCATION
|
||||
export CODER_URL="${ACCESS_URL}"
|
||||
exec $BINARY_LOCATION agent
|
||||
`,
|
||||
},
|
||||
@ -38,6 +40,7 @@ set -eu pipefail
|
||||
BINARY_LOCATION=$(mktemp -d)/coder
|
||||
curl -fsSL ${DOWNLOAD_URL} -o $BINARY_LOCATION
|
||||
chmod +x $BINARY_LOCATION
|
||||
export CODER_URL="${ACCESS_URL}"
|
||||
exec $BINARY_LOCATION agent
|
||||
`,
|
||||
},
|
||||
@ -63,9 +66,16 @@ func AgentScript(coderURL *url.URL, operatingSystem, architecture string) (strin
|
||||
}
|
||||
return "", xerrors.Errorf("architecture %q not supported for %q. must be in: %v", architecture, operatingSystem, list)
|
||||
}
|
||||
parsed, err := coderURL.Parse(fmt.Sprintf("/bin/coder-%s-%s", operatingSystem, architecture))
|
||||
downloadURL, err := coderURL.Parse(fmt.Sprintf("/bin/coder-%s-%s", operatingSystem, architecture))
|
||||
if err != nil {
|
||||
return "", xerrors.Errorf("parse url: %w", err)
|
||||
return "", xerrors.Errorf("parse download url: %w", err)
|
||||
}
|
||||
return strings.ReplaceAll(script, "${DOWNLOAD_URL}", parsed.String()), nil
|
||||
accessURL, err := coderURL.Parse("/")
|
||||
if err != nil {
|
||||
return "", xerrors.Errorf("parse access url: %w", err)
|
||||
}
|
||||
return strings.NewReplacer(
|
||||
"${DOWNLOAD_URL}", downloadURL.String(),
|
||||
"${ACCESS_URL}", accessURL.String(),
|
||||
).Replace(script), nil
|
||||
}
|
||||
|
Reference in New Issue
Block a user