Added npm-publish-tarball

This adds an npm job that runs npm-pack, and then renames the
tarballs to match our versioning scheme before uploading them to
the tarball host.

The `npm pack` command commits the current project to the local
npm cache directory, which triggers a full lifecycle run (prepublish,
etc). This generates a tarball with all assets listed in the package's
"files" field, inside the npm cache. This tarball is then copied back
to the working directory.

Since the default naming is not helpful, the job then immediately
renames it before the tarballs are published, using our usual
version names.

This job is then used by ironic-webclient. Note that this commit
removes 'bare-precise' as a node option, because Ubuntu precise does
not package a recent enough version of nodejs for any of this.

Change-Id: Ifb7898f136fafae70b5b0cd2727cc478034667c7
This commit is contained in:
Michael Krotscheck 2015-08-21 11:14:16 -07:00
parent 692f3ccb7d
commit 597a0b965b
3 changed files with 33 additions and 1 deletions

View File

@ -35,6 +35,33 @@
copy-after-failure: true
node: '{node}'
# Builds and uploads a tarball using NPM.
- job-template:
name: '{name}-npm-publish-tarball'
builders:
- npm-install
- revoke-sudo
- gerrit-git-prep
# 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:
- console-log
- tarball
node: '{node}'
# 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:

View File

@ -588,12 +588,13 @@
- project:
name: ironic-webclient
node: 'bare-precise || bare-trusty'
node: 'bare-trusty'
tarball-site: tarballs.openstack.org
doc-publisher-site: docs.openstack.org
jobs:
- javascript-jobs
- '{name}-npm-publish-tarball'
- project:
name: keystone

View File

@ -2297,6 +2297,10 @@ projects:
template:
- name: merge-check
- name: javascript-jobs
post:
- ironic-webclient-npm-publish-tarball
release:
- ironic-webclient-npm-publish-tarball
- name: openstack/keystone
template: