Remove unused Docker step from CI script

This commit is contained in:
Asher 2020-01-14 15:06:49 -06:00
parent 42bddce21f
commit 174cb2f8a9
No known key found for this signature in database
GPG key ID: D63C1EF81242354A
7 changed files with 40 additions and 87 deletions

View file

@ -9,4 +9,4 @@ doc
LICENSE LICENSE
README.md README.md
node_modules node_modules
release release

View file

@ -61,8 +61,7 @@ steps:
- v2 - v2
- ${DRONE_TAG} - ${DRONE_TAG}
build_args: build_args:
- codeServerVersion=${DRONE_TAG} - tag=${DRONE_TAG}
- vscodeVersion=1.41.1
when: when:
event: tag event: tag
@ -181,8 +180,7 @@ steps:
- arm64 - arm64
- ${DRONE_TAG}-arm64 - ${DRONE_TAG}-arm64
build_args: build_args:
- codeServerVersion=$DRONE_TAG - tag=$DRONE_TAG
- vscodeVersion=1.41.1
when: when:
event: tag event: tag
@ -301,8 +299,7 @@ steps:
- arm - arm
- ${DRONE_TAG}-arm - ${DRONE_TAG}-arm
build_args: build_args:
- codeServerVersion=$DRONE_TAG - tag=$DRONE_TAG
- vscodeVersion=1.41.1
when: when:
event: tag event: tag

View file

@ -35,4 +35,4 @@ cache:
timeout: 1000 timeout: 1000
yarn: true yarn: true
directories: directories:
- source/vscode-1.41.1-source - source

View file

@ -1,6 +1,5 @@
FROM node:12.14.0 FROM node:12.14.0
ARG codeServerVersion=docker ARG tag
ARG vscodeVersion
ARG githubToken ARG githubToken
# Install VS Code's deps. These are the only two it seems we need. # Install VS Code's deps. These are the only two it seems we need.
@ -12,13 +11,12 @@ WORKDIR /src
COPY . . COPY . .
RUN yarn \ RUN yarn \
&& MINIFY=true GITHUB_TOKEN="${githubToken}" yarn build "${vscodeVersion}" "${codeServerVersion}" \ && DRONE_TAG="$tag" MINIFY=true BINARY=true GITHUB_TOKEN="$githubToken" ./scripts/ci.bash \
&& yarn binary "${vscodeVersion}" "${codeServerVersion}" \ && mv /src/binaries/* /src/binaries/code-server \
&& mv "/src/binaries/code-server${codeServerVersion}-vsc${vscodeVersion}-linux-x86_64" /src/binaries/code-server \
&& rm -r /src/build \ && rm -r /src/build \
&& rm -r /src/source && rm -r /src/source
# We deploy with ubuntu so that devs have a familiar environment. # We deploy with Ubuntu so that devs have a familiar environment.
FROM ubuntu:18.04 FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
@ -31,7 +29,7 @@ RUN apt-get update && apt-get install -y \
vim \ vim \
curl \ curl \
wget \ wget \
&& rm -rf /var/lib/apt/lists/* && rm -rf /var/lib/apt/lists/*
RUN locale-gen en_US.UTF-8 RUN locale-gen en_US.UTF-8
# We cannot use update-locale because docker will not use the env variables # We cannot use update-locale because docker will not use the env variables
@ -43,10 +41,9 @@ RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
USER coder USER coder
# We create first instead of just using WORKDIR as when WORKDIR creates, the # Create first so these directories will be owned by coder instead of root
# user is root. # (workdir and mounting appear to both default to root).
RUN mkdir -p /home/coder/project RUN mkdir -p /home/coder/project
# To avoid EACCES issues on f.ex Crostini (ChromeOS)
RUN mkdir -p /home/coder/.local/share/code-server RUN mkdir -p /home/coder/.local/share/code-server
WORKDIR /home/coder/project WORKDIR /home/coder/project

2
scripts/cacher.sh Normal file → Executable file
View file

@ -23,7 +23,7 @@ restore() {
# the cache-upload directory will be uploaded as-is to the code-server bucket. # the cache-upload directory will be uploaded as-is to the code-server bucket.
package() { package() {
mkdir -p "cache-upload/cache/$1" mkdir -p "cache-upload/cache/$1"
tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules source/vscode-1.41.1-source tar czfv "cache-upload/cache/$1/$tar.tar.gz" node_modules source
} }
main() { main() {

View file

@ -1,81 +1,39 @@
#!/bin/bash #!/bin/bash
# ci.bash -- Build code-server in the CI.
set -euo pipefail set -euo pipefail
function docker-build() {
local target="${TARGET:-}"
local image="codercom/nbin-${target}"
local token="${GITHUB_TOKEN:-}"
local minify="${MINIFY:-}"
if [[ "${target}" == "linux" ]] ; then
image="codercom/nbin-centos"
fi
local containerId
# Use a mount so we can cache the results.
containerId=$(docker create --network=host --rm -it -v "$(pwd)":/src "${image}")
docker start "${containerId}"
# TODO: Might be better to move these dependencies to the images or create new
# ones on top of these.
if [[ "${image}" == "codercom/nbin-alpine" ]] ; then
docker exec "${containerId}" apk add libxkbfile-dev libsecret-dev
else
docker exec "${containerId}" yum install -y libxkbfile-devel libsecret-devel git
fi
function docker-exec() {
local command="${1}" ; shift
local args="'${vscodeVersion}' '${codeServerVersion}'"
docker exec "${containerId}" \
bash -c "cd /src && CI=true GITHUB_TOKEN=${token} MINIFY=${minify} yarn ${command} ${args}"
}
docker-exec build
if [[ -n "${package}" ]] ; then
docker-exec binary
docker-exec package
fi
docker kill "${containerId}"
}
function local-build() {
function local-exec() {
local command="${1}" ; shift
CI=true yarn "${command}" "${vscodeVersion}" "${codeServerVersion}"
}
local-exec build
if [[ -n "${package}" ]] ; then
local-exec binary
local-exec package
fi
}
# Build code-server in the CI.
function main() { function main() {
cd "$(dirname "${0}")/.." cd "$(dirname "${0}")/.."
local codeServerVersion="${VERSION:-}" # Get the version information. If a specific version wasn't set, generate it
local vscodeVersion="${VSCODE_VERSION:-1.41.1}" # from the tag and VS Code version.
local ostype="${OSTYPE:-}" local vscode_version=${VSCODE_VERSION:-1.41.1}
local package="${PACKAGE:-}" local code_server_version=${VERSION:-2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}-vsc$vscode_version}
if [[ -z "${codeServerVersion}" ]] ; then # Remove everything that isn't the current VS Code source for caching
codeServerVersion="2.${TRAVIS_TAG:-${DRONE_TAG:-daily}}" # (otherwise the cache will contain old versions).
if [[ -d "source/vscode-$vscode_version-source" ]] ; then
mv "source/vscode-$vscode_version-source" "vscode-$vscode_version-source"
fi
rm -rf source/vscode-*-source
if [[ -d "vscode-$vscode_version-source" ]] ; then
mv "vscode-$vscode_version-source" "source/vscode-$vscode_version-source"
fi fi
local branch="${TRAVIS_BRANCH:-DRONE_BRANCH}" # Only minify and package on tags since that's when releases are pushed.
if [[ $branch == "master" ]] ; then if [[ -n ${DRONE_TAG:-} || -n ${TRAVIS_TAG:-} ]] ; then
export MINIFY="true" export MINIFY="true"
export PACKAGE="true" export PACKAGE="true"
fi fi
if [[ "${ostype}" == "darwin"* ]]; then function run-yarn() {
local-build yarn "$1" "$vscode_version" "$code_server_version"
else }
docker-build
fi run-yarn build
[[ -n ${PACKAGE:-} || -n ${BINARY:-} ]] && run-yarn binary
[[ -n ${PACKAGE:-} ]] && run-yarn package
} }
main "$@" main "$@"

View file

@ -1,4 +1,4 @@
# We deploy with ubuntu so that devs have a familiar environment. # We deploy with Ubuntu so that devs have a familiar environment.
FROM ubuntu:18.04 FROM ubuntu:18.04
RUN apt-get update && apt-get install -y \ RUN apt-get update && apt-get install -y \
@ -22,9 +22,10 @@ RUN adduser --gecos '' --disabled-password coder && \
echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd echo "coder ALL=(ALL) NOPASSWD:ALL" >> /etc/sudoers.d/nopasswd
USER coder USER coder
# We create first instead of just using WORKDIR as when WORKDIR creates, the # Create first so these directories will be owned by coder instead of root
# user is root. # (workdir and mounting appear to both default to root).
RUN mkdir -p /home/coder/project RUN mkdir -p /home/coder/project
RUN mkdir -p /home/coder/.local/share/code-server
WORKDIR /home/coder/project WORKDIR /home/coder/project