Skip to content
体验新版
项目
组织
正在加载...
登录
切换导航
打开侧边栏
彭彦祖
code-server
提交
308a84e6
C
code-server
项目概览
彭彦祖
/
code-server
与 Fork 源项目一致
从无法访问的项目Fork
通知
1
Star
1
Fork
0
代码
文件
提交
分支
Tags
贡献者
分支图
Diff
Issue
0
列表
看板
标记
里程碑
合并请求
0
Wiki
0
Wiki
分析
仓库
DevOps
项目成员
Pages
C
code-server
项目概览
项目概览
详情
发布
仓库
仓库
文件
提交
分支
标签
贡献者
分支图
比较
Issue
0
Issue
0
列表
看板
标记
里程碑
合并请求
0
合并请求
0
Pages
分析
分析
仓库分析
DevOps
Wiki
0
Wiki
成员
成员
收起侧边栏
关闭侧边栏
动态
分支图
创建新Issue
提交
Issue看板
体验新版 GitCode,发现更多精彩内容 >>
未验证
提交
308a84e6
编写于
3月 04, 2020
作者:
A
Asher
浏览文件
操作
浏览文件
下载
电子邮件补丁
差异文件
Fix centos image for arm64
上级
cc139acf
变更
3
隐藏空白更改
内联
并排
Showing
3 changed file
with
47 addition
and
49 deletion
+47
-49
ci/image/Dockerfile
ci/image/Dockerfile
+13
-19
src/node/app/update.ts
src/node/app/update.ts
+4
-3
test/update.test.ts
test/update.test.ts
+30
-27
未找到文件。
ci/image/Dockerfile
浏览文件 @
308a84e6
FROM
centos:7
RUN
yum update
-y
\
&&
yum
install
-y
epel-release centos-release-scl
\
&&
yum-config-manager
--enable
rhel-server-rhscl-7-rpms
\
&&
yum update
-y
\
&&
yum
install
-y
\
devtoolset-6
\
gcc-c++
\
xz
\
ccache
\
git
\
wget
\
openssl
\
libxkbfile-devel
\
libsecret-devel
\
libx11-devel
RUN
yum update
-y
&&
yum
install
-y
\
devtoolset-6
\
gcc-c++
\
xz
\
ccache
\
git
\
wget
\
openssl
\
libxkbfile-devel
\
libsecret-devel
\
libx11-devel
RUN
mkdir
/usr/share/node
&&
cd
/usr/share/node
\
&&
curl
https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-x64.tar.xz
|
tar
xJ
--strip-components
=
1
--
&&
curl
"https://nodejs.org/dist/v12.14.0/node-v12.14.0-linux-
$(
uname
-m
|
sed
's/86_//; s/aarch/arm/'
)
.tar.xz"
|
tar
xJ
--strip-components
=
1
--
ENV
PATH "$PATH:/usr/share/node/bin"
RUN
npm
install
-g
yarn
RUN
curl
-L
https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_amd64
>
/usr/local/bin/shfmt
\
RUN
curl
-L
"https://github.com/mvdan/sh/releases/download/v3.0.1/shfmt_v3.0.1_linux_
$(
uname
-m
|
sed
's/x86_/amd/; s/aarch64/arm/'
)
"
>
/usr/local/bin/shfmt
\
&&
chmod
+x /usr/local/bin/shfmt
RUN
echo
'source /opt/rh/devtoolset-6/enable'
>>
/root/.bashrc
ENTRYPOINT
["/bin/bash", "-c"]
src/node/app/update.ts
浏览文件 @
308a84e6
...
...
@@ -194,8 +194,8 @@ export class UpdateHttpProvider extends HttpProvider {
}
}
public
async
downloadAndApplyUpdate
(
update
:
Update
,
targetPath
?:
string
,
target
?:
string
):
Promise
<
void
>
{
const
releaseName
=
await
this
.
getReleaseName
(
update
,
target
)
public
async
downloadAndApplyUpdate
(
update
:
Update
,
targetPath
?:
string
):
Promise
<
void
>
{
const
releaseName
=
await
this
.
getReleaseName
(
update
)
const
url
=
this
.
downloadUrl
.
replace
(
"
{{VERSION}}
"
,
update
.
version
).
replace
(
"
{{RELEASE_NAME}}
"
,
releaseName
)
let
downloadPath
=
path
.
join
(
tmpdir
,
"
updates
"
,
releaseName
)
...
...
@@ -298,7 +298,8 @@ export class UpdateHttpProvider extends HttpProvider {
/**
* Given an update return the name for the packaged archived.
*/
private
async
getReleaseName
(
update
:
Update
,
target
:
string
=
os
.
platform
()):
Promise
<
string
>
{
public
async
getReleaseName
(
update
:
Update
):
Promise
<
string
>
{
let
target
:
string
=
os
.
platform
()
if
(
target
===
"
linux
"
)
{
const
result
=
await
util
.
promisify
(
cp
.
exec
)(
"
ldd --version
"
)
...
...
test/update.test.ts
浏览文件 @
308a84e6
...
...
@@ -2,6 +2,7 @@ import zip from "adm-zip"
import
*
as
assert
from
"
assert
"
import
*
as
fs
from
"
fs-extra
"
import
*
as
http
from
"
http
"
import
*
as
os
from
"
os
"
import
*
as
path
from
"
path
"
import
*
as
tar
from
"
tar-fs
"
import
*
as
zlib
from
"
zlib
"
...
...
@@ -65,7 +66,20 @@ describe("update", () => {
}
before
(
async
()
=>
{
const
archiveName
=
"
code-server-9999999.99999.9999-linux-x86_64
"
await
new
Promise
((
resolve
,
reject
)
=>
{
server
.
on
(
"
error
"
,
reject
)
server
.
on
(
"
listening
"
,
resolve
)
server
.
listen
({
port
:
0
,
host
:
"
localhost
"
,
})
})
const
p
=
provider
()
const
archiveName
=
(
await
p
.
getReleaseName
({
version
:
"
9999999.99999.9999
"
,
checked
:
0
})).
replace
(
/.tar.gz$|.zip$/
,
""
,
)
await
fs
.
remove
(
path
.
join
(
tmpdir
,
"
tests/updates
"
))
await
fs
.
mkdirp
(
path
.
join
(
archivePath
,
archiveName
))
...
...
@@ -74,8 +88,16 @@ describe("update", () => {
fs
.
writeFile
(
path
.
join
(
archivePath
,
archiveName
,
"
node
"
),
`NODE BINARY`
),
])
await
Promise
.
all
([
new
Promise
((
resolve
,
reject
)
=>
{
if
(
os
.
platform
()
===
"
darwin
"
)
{
await
new
Promise
((
resolve
,
reject
)
=>
{
const
zipFile
=
new
zip
()
zipFile
.
addLocalFolder
(
archivePath
)
zipFile
.
writeZip
(
archivePath
+
"
.zip
"
,
(
error
)
=>
{
return
error
?
reject
(
error
)
:
resolve
(
error
)
})
})
}
else
{
await
new
Promise
((
resolve
,
reject
)
=>
{
const
write
=
fs
.
createWriteStream
(
archivePath
+
"
.tar.gz
"
)
const
compress
=
zlib
.
createGzip
()
compress
.
pipe
(
write
)
...
...
@@ -86,24 +108,8 @@ describe("update", () => {
write
.
on
(
"
finish
"
,
()
=>
{
resolve
()
})
}),
new
Promise
((
resolve
,
reject
)
=>
{
const
zipFile
=
new
zip
()
zipFile
.
addLocalFolder
(
archivePath
)
zipFile
.
writeZip
(
archivePath
+
"
.zip
"
,
(
error
)
=>
{
return
error
?
reject
(
error
)
:
resolve
(
error
)
})
}),
])
await
new
Promise
((
resolve
,
reject
)
=>
{
server
.
on
(
"
error
"
,
reject
)
server
.
on
(
"
listening
"
,
resolve
)
server
.
listen
({
port
:
0
,
host
:
"
localhost
"
,
})
}
)
}
})
after
(()
=>
{
...
...
@@ -205,18 +211,15 @@ describe("update", () => {
assert
.
equal
(
`console.log("OLD")`
,
await
fs
.
readFile
(
entry
,
"
utf8
"
))
// Updating should replace the existing version.
await
p
.
downloadAndApplyUpdate
(
update
,
destination
,
"
linux
"
)
await
p
.
downloadAndApplyUpdate
(
update
,
destination
)
assert
.
equal
(
`console.log("UPDATED")`
,
await
fs
.
readFile
(
entry
,
"
utf8
"
))
// Should still work if there is no existing version somehow.
await
fs
.
remove
(
destination
)
await
p
.
downloadAndApplyUpdate
(
update
,
destination
,
"
linux
"
)
await
p
.
downloadAndApplyUpdate
(
update
,
destination
)
assert
.
equal
(
`console.log("UPDATED")`
,
await
fs
.
readFile
(
entry
,
"
utf8
"
))
assert
.
deepEqual
(
spy
,
[
"
/latest
"
,
`/download/
${
version
}
/code-server-
${
version
}
-linux-x86_64.tar.gz`
,
`/download/
${
version
}
/code-server-
${
version
}
-linux-x86_64.tar.gz`
,
])
const
archiveName
=
await
p
.
getReleaseName
(
update
)
assert
.
deepEqual
(
spy
,
[
"
/latest
"
,
`/download/
${
version
}
/
${
archiveName
}
`
,
`/download/
${
version
}
/
${
archiveName
}
`
])
})
})
编辑
预览
Markdown
is supported
0%
请重试
或
添加新附件
.
添加附件
取消
You are about to add
0
people
to the discussion. Proceed with caution.
先完成此消息的编辑!
取消
想要评论请
注册
或
登录