ci: Separate prod tarball extraction and install process.

This allows to run scripts between extraction and install
process.

It will be used to restore npm caches for production install jobs.

We extract the tarball in the working directory so that yarn.lock and
package.json are available to restore cache.

(And also so the path is deterministic).
This commit is contained in:
Aman Agrawal 2020-04-25 20:27:04 +05:30 committed by Tim Abbott
parent 0aa18e88a5
commit cf14cc211f
4 changed files with 19 additions and 4 deletions

View File

@ -99,14 +99,20 @@ aliases:
mispipe ./tools/ci/setup-production ts mispipe ./tools/ci/setup-production ts
- &install_production - &production_extract_tarball
run: run:
name: install production name: production extract tarball
command: | command: |
sudo apt-get update sudo apt-get update
# Install moreutils so we can use `ts` and `mispipe` in the following. # Install moreutils so we can use `ts` and `mispipe` in the following.
sudo apt-get install -y moreutils sudo apt-get install -y moreutils
mispipe /tmp/production-extract-tarball ts
- &install_production
run:
name: install production
command: |
sudo service rabbitmq-server restart sudo service rabbitmq-server restart
mispipe /tmp/production ts mispipe /tmp/production ts
@ -245,6 +251,7 @@ jobs:
- success-http-headers.txt - success-http-headers.txt
- production-helper - production-helper
- production - production
- production-extract-tarball
"bionic-production-install-python3.6": "bionic-production-install-python3.6":
docker: docker:
@ -262,6 +269,7 @@ jobs:
- *create_cache_directories - *create_cache_directories
- *do_bionic_hack - *do_bionic_hack
- *production_extract_tarball
- *restore_cache_package_json - *restore_cache_package_json
- *install_production - *install_production
- *save_cache_package_json - *save_cache_package_json

View File

@ -0,0 +1,7 @@
#!/usr/bin/env bash
set -e
set -x
ZULIP_PATH=~/zulip
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1

View File

@ -5,8 +5,7 @@
set -e set -e
set -x set -x
ZULIP_PATH=$(mktemp -d) ZULIP_PATH=~/zulip
tar -xf /tmp/zulip-server-test.tar.gz -C "$ZULIP_PATH" --strip-components=1
# Do an apt upgrade to start with an up-to-date machine # Do an apt upgrade to start with an up-to-date machine
APT_OPTIONS=(-o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold') APT_OPTIONS=(-o 'Dpkg::Options::=--force-confdef' -o 'Dpkg::Options::=--force-confold')

View File

@ -32,3 +32,4 @@ mv /tmp/tmp.*/zulip-server-test.tar.gz /tmp/
cp -a tools/ci/success-http-headers.txt /tmp/success-http-headers.txt cp -a tools/ci/success-http-headers.txt /tmp/success-http-headers.txt
cp -a tools/ci/production /tmp/production cp -a tools/ci/production /tmp/production
cp -a tools/ci/production-helper /tmp/production-helper cp -a tools/ci/production-helper /tmp/production-helper
cp -a tools/ci/production-extract-tarball /tmp/production-extract-tarball