project-config/jenkins/jobs/javascript.yaml
Michael Krotscheck af693d57c6
Do not cat npm-shrinkwrap.json
Upload it to logs instead. This is done because we suspect that
executing cat on a large text file does not play well with
jenkins.

Change-Id: I8512c9b132f2707db265633d5e16378b1d87d4da
2016-04-07 13:30:42 -07:00

244 lines
6.9 KiB
YAML

# Executes a command registered inside of package.json. For more information on
# how this works, see https://docs.npmjs.com/cli/run-script. This build assumes
# that whatever is being run under the hood, it will pipe its output to the
# ./reports directory in the projects' root directory. This output is
# subsequently copied to static.openstack.org (the clickthrough target from
# gerrit).
- job-template:
name: 'gate-{name}-npm-run-{command}'
node: ubuntu-trusty
wrappers:
- build-timeout:
timeout: 40
- timestamps
builders:
- print-template-name:
template-name: "{template-name}"
- gerrit-git-prep
- install-distro-packages
- npm-install
- xvfb-install
- chrome-install
- firefox-install
- revoke-sudo
- xvfb-start
- npm-run:
command: '{command}'
- assert-no-extra-files
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'reports/**'
keep-hierarchy: true
copy-after-failure: true
- target: 'logs/$LOG_PATH'
source: 'npm-shrinkwrap.json'
keep-hierarchy: false
copy-after-failure: false
# Builds and uploads a tarball using NPM.
- job-template:
name: '{name}-npm-publish-tarball'
node: ubuntu-trusty
builders:
- print-template-name:
template-name: "{template-name}"
- gerrit-git-prep
- install-distro-packages
- npm-install
- revoke-sudo
# This will build ./{name}-{version}.tgz, where {version} is read from
# package.json.
- npm-run:
command: 'pack'
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/version-properties.sh
source version.properties
# Move the autogenerated versioned tarball to the one we like.
mkdir -p dist
cp {name}-*.tgz dist/{name}-$PROJECT_VER.tar.gz
cp {name}-*.tgz dist/{name}-latest.tar.gz
publishers:
- tarball:
project: '{name}'
site: '{tarball-site}'
- console-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'npm-shrinkwrap.json'
keep-hierarchy: false
copy-after-failure: false
# Builds and uploads a draft version of the project to docs-draft.
- job-template:
name: '{name}-npm-publish-draft'
node: ubuntu-trusty
builders:
- print-template-name:
template-name: "{template-name}"
- gerrit-git-prep
- install-distro-packages
- npm-install
- revoke-sudo
# This will build ./{name}-{version}.tgz, where {version} is read from
# package.json.
- npm-run:
command: 'pack'
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/version-properties.sh
source version.properties
# Create a dist directory
mkdir -p ./dist
# Extract the package tarball. This will place it in ./package
tar -xzf ./{name}-*.tgz
# Move the package contents into dist so the scp upload will
# catch it.
mv ./package/{package-dir}/* ./dist/
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
# We're uploading the compiled app as a pre-release sanity check,
# much like we do with docs builds.
- target: 'docs-draft/$LOG_PATH'
source: 'dist/**'
keep-hierarchy: true
copy-after-failure: false
- target: 'logs/$LOG_PATH'
source: 'npm-shrinkwrap.json'
keep-hierarchy: false
copy-after-failure: false
# Builds a draft application and uploads it to docs-draft. To use this build,
# your Gruntfile must declare a target named "build:draft"
- job-template:
name: 'gate-{name}-js-draft'
node: ubuntu-trusty
wrappers:
- build-timeout:
timeout: 40
- timestamps
builders:
- print-template-name:
template-name: "{template-name}"
- npm-install
- gerrit-git-prep
- install-distro-packages
- revoke-sudo
- js-build:
command: 'build:draft'
envlist: 'grunt'
project: '{name}'
- assert-no-extra-files
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'reports/**'
keep-hierarchy: true
copy-after-failure: true
# We're uploading the compiled app as a pre-release sanity check,
# much like we do with docs builds.
- target: 'docs-draft/$LOG_PATH'
source: 'dist/**'
keep-hierarchy: true
copy-after-failure: false
# Builds a release tarball
- job-template:
name: '{name}-js-release-{job-suffix}'
node: ubuntu-trusty
builders:
- print-template-name:
template-name: "{template-name}"
- npm-install
- gerrit-git-prep
- install-distro-packages
- revoke-sudo
- js-build:
command: 'build'
envlist: 'grunt'
- shell: |
#!/bin/bash -xe
/usr/local/jenkins/slave_scripts/version-properties.sh
source version.properties
# Clean/create a tarball directory
rm -rf tarballs
mkdir -p tarballs
# Create an archive tarball.
tar -czf {name}-$PROJECT_VER.tar.gz dist/
cp {name}-$PROJECT_VER.tar.gz tarballs/{name}-latest.tar.gz
mv {name}-$PROJECT_VER.tar.gz tarballs/
publishers:
- console-log
- coverage-log
- scp:
site: 'static.openstack.org'
files:
- target: 'logs/$LOG_PATH'
source: 'reports/**'
keep-hierarchy: true
copy-after-failure: true
- target: 'tarballs/{name}/'
source: 'tarballs/*.tar.gz'
keep-hierarchy: false
copy-after-failure: false
# Uploads a release tarball to npm.
- job-template:
name: '{name}-npm-upload'
node: release
builders:
- print-template-name:
template-name: "{template-name}"
- shell: |
/usr/local/jenkins/slave_scripts/npm-tarball-upload.sh {name} {tarball-site}
publishers:
- console-log
- job-group:
name: javascript-jobs
jobs:
- 'gate-{name}-npm-run-{command}':
command: 'lint'
- 'gate-{name}-npm-run-{command}':
command: 'test'
- job-group:
name: publish-to-npm
jobs:
- '{name}-npm-publish-tarball'
- '{name}-npm-upload'