Browse Source

Use npm mirrors in tox jobs

Opendev runs a caching mirror for npm packages. Use it when running
yarn install during tox tests. Due to the way yarn.lock files work at
the moment we need to patch the lockfile on the fly to inject the
mirror urls [1]. This can be handlel inside the pip.sh where we patch
the lockfile, run yarn and reset it afterwards.

[1] https://github.com/yarnpkg/yarn/issues/2566

Change-Id: Id1f2daac8327f3110e6beeb2d6391baccfd3ce34
changes/23/743623/2
Tobias Henkel 1 week ago
parent
commit
9cb2e52c59
No known key found for this signature in database GPG Key ID: 3750DEC158E5FA2
3 changed files with 18 additions and 17 deletions
  1. +6
    -16
      .zuul.yaml
  2. +11
    -1
      tools/pip.sh
  3. +1
    -0
      tox.ini

+ 6
- 16
.zuul.yaml View File

@@ -238,22 +238,20 @@
- playbooks/zuul-migrate/.*
nodeset: ubuntu-xenial
timeout: 4800 # 80 minutes
vars:
vars: &zuul_tox_vars
test_setup_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
YARN_REGISTRY: "https://{{ zuul_site_mirror_fqdn }}:4443/registry.npmjs"
tox_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
YARN_REGISTRY: "https://{{ zuul_site_mirror_fqdn }}:4443/registry.npmjs"
- tox-py38:
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate/.*
timeout: 4800 # 80 minutes
nodeset: ubuntu-bionic
vars:
test_setup_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
tox_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
vars: *zuul_tox_vars
- zuul-build-dashboard-openstack-whitelabel
- zuul-build-dashboard-software-factory
- zuul-build-dashboard-opendev
@@ -290,22 +288,14 @@
- playbooks/zuul-migrate/.*
nodeset: ubuntu-xenial
timeout: 4800 # 80 minutes
vars:
test_setup_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
tox_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
vars: *zuul_tox_vars
- tox-py38:
irrelevant-files:
- zuul/cmd/migrate.py
- playbooks/zuul-migrate/.*
timeout: 4800 # 80 minutes
nodeset: ubuntu-bionic
vars:
test_setup_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
tox_environment:
ZUUL_TEST_ROOT: /tmp/zuul-test
vars: *zuul_tox_vars
- zuul-build-dashboard
- nodejs-run-lint:
vars:


+ 11
- 1
tools/pip.sh View File

@@ -42,8 +42,18 @@ then
mkdir -p zuul/web/static
ln -sfn ../zuul/web/static web/build
pushd web/
yarn install
if [[ -n "${YARN_REGISTRY}" ]]
then
echo "Using yarn registry: ${YARN_REGISTRY}"
sed -i "s#https://registry.yarnpkg.com#${YARN_REGISTRY}#" yarn.lock
fi
yarn install --verbose
yarn build
if [[ -n "${YARN_REGISTRY}" ]]
then
echo "Resetting yarn registry"
sed -i "s#${YARN_REGISTRY}#https://registry.yarnpkg.com#" yarn.lock
fi
popd
fi
pip install $*


+ 1
- 0
tox.ini View File

@@ -23,6 +23,7 @@ passenv =
OS_LOG_DEFAULTS
OS_STDERR_CAPTURE
OS_STDOUT_CAPTURE
YARN_REGISTRY
ZUUL_MYSQL_HOST
ZUUL_POSTGRES_HOST
ZUUL_TEST_ROOT


Loading…
Cancel
Save