Skip to content

Commit 174cb2f

Browse files
committed
Remove unused Docker step from CI script
1 parent 42bddce commit 174cb2f

File tree

7 files changed

+40
-87
lines changed

7 files changed

+40
-87
lines changed

.dockerignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ doc
99
LICENSE
1010
README.md
1111
node_modules
12-
release
12+
release

.drone.yml

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -61,8 +61,7 @@ steps:
6161
- v2
6262
- ${DRONE_TAG}
6363
build_args:
64-
- codeServerVersion=${DRONE_TAG}
65-
- vscodeVersion=1.41.1
64+
- tag=${DRONE_TAG}
6665
when:
6766
event: tag
6867

@@ -181,8 +180,7 @@ steps:
181180
- arm64
182181
- ${DRONE_TAG}-arm64
183182
build_args:
184-
- codeServerVersion=$DRONE_TAG
185-
- vscodeVersion=1.41.1
183+
- tag=$DRONE_TAG
186184
when:
187185
event: tag
188186

@@ -301,8 +299,7 @@ steps:
301299
- arm
302300
- ${DRONE_TAG}-arm
303301
build_args:
304-
- codeServerVersion=$DRONE_TAG
305-
- vscodeVersion=1.41.1
302+
- tag=$DRONE_TAG
306303
when:
307304
event: tag
308305

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,4 @@ cache:
3535
timeout: 1000
3636
yarn: true
3737
directories:
38-
- source/vscode-1.41.1-source
38+
- source

Dockerfile

Lines changed: 7 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
FROM node:12.14.0
2-
ARG codeServerVersion=docker
3-
ARG vscodeVersion
2+
ARG tag
43
ARG githubToken
54

65
# Install VS Code's deps. These are the only two it seems we need.
@@ -12,13 +11,12 @@ WORKDIR /src
1211
COPY . .
1312

1413
RUN yarn \
15-
&& MINIFY=true GITHUB_TOKEN="${githubToken}" yarn build "${vscodeVersion}" "${codeServerVersion}" \
16-
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \
17-
&& mv "/src/binaries/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/binaries/code-server \
14+
&& DRONE_TAG="$tag" MINIFY=true BINARY=true GITHUB_TOKEN="$githubToken" ./scripts/ci.bash \
15+
&& mv /src/binaries/* /src/binaries/code-server \
1816
&& rm -r /src/build \
1917
&& rm -r /src/source
2018

21-
# We deploy with ubuntu so that devs have a familiar environment.
19+
# We deploy with Ubuntu so that devs have a familiar environment.
2220
FROM ubuntu:18.04
2321

2422
RUN apt-get update && apt-get install -y \
@@ -31,7 +29,7 @@ RUN apt-get update && apt-get install -y \
3129
vim \
3230
curl \
3331
wget \
34-
&& rm -rf /var/lib/apt/lists/*
32+
&& rm -rf /var/lib/apt/lists/*
3533

3634
RUN locale-gen en_US.UTF-8
3735
# We cannot use update-locale because docker will not use the env variables
@@ -43,10 +41,9 @@ RUN adduser --gecos '' --disabled-password coder && \
4341
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
4442

4543
USER coder
46-
# We create first instead of just using WORKDIR as when WORKDIR creates, the
47-
# user is root.
44+
# Create first so these directories will be owned by coder instead of root
45+
# (workdir and mounting appear to both default to root).
4846
RUN mkdir -p /home/coder/project
49-
# To avoid EACCES issues on f.ex Crostini (ChromeOS)
5047
RUN mkdir -p /home/coder/.local/share/code-server
5148

5249
WORKDIR /home/coder/project

scripts/cacher.sh

100644100755
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ restore() {
2323
# the cache-upload directory will be uploaded as-is to the code-server bucket.
2424
package() {
2525
mkdir -p "cache-upload/cache/$1"
26-
tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules source/vscode-1.41.1-source
26+
tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules source
2727
}
2828

2929
main() {

scripts/ci.bash

Lines changed: 23 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,81 +1,39 @@
11
#!/bin/bash
2-
set -euo pipefail
3-
4-
function docker-build() {
5-
local target="${TARGET:-}"
6-
local image="codercom/nbin-${target}"
7-
local token="${GITHUB_TOKEN:-}"
8-
local minify="${MINIFY:-}"
9-
if [[ "${target}" == "linux" ]] ; then
10-
image="codercom/nbin-centos"
11-
fi
12-
13-
local containerId
14-
# Use a mount so we can cache the results.
15-
containerId=$(docker create --network=host --rm -it -v "$(pwd)":/src "${image}")
16-
docker start "${containerId}"
17-
18-
# TODO: Might be better to move these dependencies to the images or create new
19-
# ones on top of these.
20-
if [[ "${image}" == "codercom/nbin-alpine" ]] ; then
21-
docker exec "${containerId}" apk add libxkbfile-dev libsecret-dev
22-
else
23-
docker exec "${containerId}" yum install -y libxkbfile-devel libsecret-devel git
24-
fi
2+
# ci.bash -- Build code-server in the CI.
253

26-
function docker-exec() {
27-
local command="${1}" ; shift
28-
local args="'${vscodeVersion}' '${codeServerVersion}'"
29-
docker exec "${containerId}" \
30-
bash -c "cd /src && CI=true GITHUB_TOKEN=${token} MINIFY=${minify} yarn ${command} ${args}"
31-
}
32-
33-
docker-exec build
34-
if [[ -n "${package}" ]] ; then
35-
docker-exec binary
36-
docker-exec package
37-
fi
38-
39-
docker kill "${containerId}"
40-
}
41-
42-
function local-build() {
43-
function local-exec() {
44-
local command="${1}" ; shift
45-
CI=true yarn "${command}" "${vscodeVersion}" "${codeServerVersion}"
46-
}
47-
48-
local-exec build
49-
if [[ -n "${package}" ]] ; then
50-
local-exec binary
51-
local-exec package
52-
fi
53-
}
4+
set -euo pipefail
545

55-
# Build code-server in the CI.
566
function main() {
577
cd "$(dirname "${0}")/.."
588

59-
local codeServerVersion="${VERSION:-}"
60-
local vscodeVersion="${VSCODE_VERSION:-1.41.1}"
61-
local ostype="${OSTYPE:-}"
62-
local package="${PACKAGE:-}"
9+
# Get the version information. If a specific version wasn't set, generate it
10+
# from the tag and VS Code version.
11+
local vscode_version=${VSCODE_VERSION:-1.41.1}
12+
local code_server_version=${VERSION:-2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}-vsc$vscode_version}
6313

64-
if [[ -z "${codeServerVersion}" ]] ; then
65-
codeServerVersion="2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}"
14+
# Remove everything that isn't the current VS Code source for caching
15+
# (otherwise the cache will contain old versions).
16+
if [[ -d "source/vscode-$vscode_version-source" ]] ; then
17+
mv "source/vscode-$vscode_version-source" "vscode-$vscode_version-source"
18+
fi
19+
rm -rf source/vscode-*-source
20+
if [[ -d "vscode-$vscode_version-source" ]] ; then
21+
mv "vscode-$vscode_version-source" "source/vscode-$vscode_version-source"
6622
fi
6723

68-
local branch="${TRAVIS_BRANCH:-DRONE_BRANCH}"
69-
if [[ $branch == "master" ]] ; then
24+
# Only minify and package on tags since that's when releases are pushed.
25+
if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
7026
export MINIFY="true"
7127
export PACKAGE="true"
7228
fi
7329

74-
if [[ "${ostype}" == "darwin"* ]]; then
75-
local-build
76-
else
77-
docker-build
78-
fi
30+
function run-yarn() {
31+
yarn "$1" "$vscode_version" "$code_server_version"
32+
}
33+
34+
run-yarn build
35+
[[ -n ${PACKAGE:-} || -n ${BINARY:-} ]] && run-yarn binary
36+
[[ -n ${PACKAGE:-} ]] && run-yarn package
7937
}
8038

8139
main "$@"

scripts/ci.dockerfile

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# We deploy with ubuntu so that devs have a familiar environment.
1+
# We deploy with Ubuntu so that devs have a familiar environment.
22
FROM ubuntu:18.04
33

44
RUN apt-get update && apt-get install -y \
@@ -22,9 +22,10 @@ RUN adduser --gecos '' --disabled-password coder && \
2222
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
2323

2424
USER coder
25-
# We create first instead of just using WORKDIR as when WORKDIR creates, the
26-
# user is root.
25+
# Create first so these directories will be owned by coder instead of root
26+
# (workdir and mounting appear to both default to root).
2727
RUN mkdir -p /home/coder/project
28+
RUN mkdir -p /home/coder/.local/share/code-server
2829

2930
WORKDIR /home/coder/project
3031

0 commit comments

Comments
 (0)