Detect target automatically
This removes the potential for a bad build because the native Node modules currently can only be built on the target system, so specifying a target for something other than the system your are building on will not work.
This commit is contained in:
parent
c2be0ec71b
commit
80050d0d9d
@ -26,7 +26,7 @@ function docker-build() {
|
|||||||
|
|
||||||
function docker-exec() {
|
function docker-exec() {
|
||||||
local command="${1}" ; shift
|
local command="${1}" ; shift
|
||||||
local args="'${vscodeVersion}' '${codeServerVersion}' '${target}'"
|
local args="'${vscodeVersion}' '${codeServerVersion}'"
|
||||||
docker exec "${containerId}" \
|
docker exec "${containerId}" \
|
||||||
bash -c "cd /src && CI=true GITHUB_TOKEN=${token} MINIFY=${minify} yarn ${command} ${args}"
|
bash -c "cd /src && CI=true GITHUB_TOKEN=${token} MINIFY=${minify} yarn ${command} ${args}"
|
||||||
}
|
}
|
||||||
|
@ -212,7 +212,7 @@ function in-vscode () {
|
|||||||
if [[ ! -f "${maybeVsCode}/package.json" ]] ; then
|
if [[ ! -f "${maybeVsCode}/package.json" ]] ; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
if ! grep '"name": "code-oss-dev"' "${maybeVsCode}/package.json" --quiet ; then
|
if ! grep '"name": "code-oss-dev"' "${maybeVsCode}/package.json" -q ; then
|
||||||
return 1
|
return 1
|
||||||
fi
|
fi
|
||||||
return 0
|
return 0
|
||||||
@ -264,17 +264,24 @@ function main() {
|
|||||||
local codeServerVersion="${1}" ; shift
|
local codeServerVersion="${1}" ; shift
|
||||||
local ci="${CI:-}"
|
local ci="${CI:-}"
|
||||||
local minify="${MINIFY:-}"
|
local minify="${MINIFY:-}"
|
||||||
|
|
||||||
local arch
|
local arch
|
||||||
arch=$(uname -m)
|
arch=$(uname -m)
|
||||||
local target="${1:-}"
|
|
||||||
if [[ -z "${target}" ]] ; then
|
local target="linux"
|
||||||
local ostype="${OSTYPE:-}"
|
local ostype="${OSTYPE:-}"
|
||||||
if [[ "${ostype}" == "darwin"* ]] ; then
|
if [[ "${ostype}" == "darwin"* ]] ; then
|
||||||
target="darwin"
|
target="darwin"
|
||||||
else
|
else
|
||||||
target="linux"
|
# On Alpine there seems no way to get the version except to use an invalid
|
||||||
|
# command which will output the version to stderr and exit with 1.
|
||||||
|
local output
|
||||||
|
output=$(ldd --version 2>&1 || :)
|
||||||
|
if [[ "${output}" == "musl"* ]] ; then
|
||||||
|
target="alpine"
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
local binaryName="code-server${codeServerVersion}-vsc${vscodeVersion}-${target}-${arch}"
|
local binaryName="code-server${codeServerVersion}-vsc${vscodeVersion}-${target}-${arch}"
|
||||||
local buildPath="${stagingPath}/${binaryName}-built"
|
local buildPath="${stagingPath}/${binaryName}-built"
|
||||||
|
|
||||||
|
@ -124,11 +124,11 @@ export class UpdateService extends AbstractUpdateService {
|
|||||||
private async buildReleaseName(release: string): Promise<string> {
|
private async buildReleaseName(release: string): Promise<string> {
|
||||||
let target: string = os.platform();
|
let target: string = os.platform();
|
||||||
if (target === "linux") {
|
if (target === "linux") {
|
||||||
const result = await util.promisify(cp.exec)("ldd --version");
|
const result = await util.promisify(cp.exec)("ldd --version").catch((error) => ({
|
||||||
if (result.stderr) {
|
stderr: error.message,
|
||||||
throw new Error(result.stderr);
|
stdout: "",
|
||||||
}
|
}));
|
||||||
if (result.stdout.indexOf("musl") !== -1) {
|
if (result.stderr.indexOf("musl") !== -1 || result.stdout.indexOf("musl") !== -1) {
|
||||||
target = "alpine";
|
target = "alpine";
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user