From 597a0b965be30fb5869ccc537bec4f02023449f0 Mon Sep 17 00:00:00 2001 From: Michael Krotscheck Date: Fri, 21 Aug 2015 11:14:16 -0700 Subject: [PATCH] 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 --- jenkins/jobs/javascript.yaml | 27 +++++++++++++++++++++++++++ jenkins/jobs/projects.yaml | 3 ++- zuul/layout.yaml | 4 ++++ 3 files changed, 33 insertions(+), 1 deletion(-) diff --git a/jenkins/jobs/javascript.yaml b/jenkins/jobs/javascript.yaml index c5f859e28b..ce743c04b6 100644 --- a/jenkins/jobs/javascript.yaml +++ b/jenkins/jobs/javascript.yaml @@ -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: diff --git a/jenkins/jobs/projects.yaml b/jenkins/jobs/projects.yaml index ccc9d97d22..d64377209a 100755 --- a/jenkins/jobs/projects.yaml +++ b/jenkins/jobs/projects.yaml @@ -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 diff --git a/zuul/layout.yaml b/zuul/layout.yaml index 4d94f4122e..2135334569 100755 --- a/zuul/layout.yaml +++ b/zuul/layout.yaml @@ -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: