-
Notifications
You must be signed in to change notification settings - Fork 144
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[FAB-16527] Use Verdaccio in FV/scenario tests
The current test process packages the npm modules into tarballs, copies them into the chaincode, and then adds dependencies to the tarballs. A local npm repository (Verdaccio) is much more effective at testing the code as if it was the "real world". The npm modules can be published to Verdaccio, and the chaincode build process can pull them from Verdaccio. Signed-off-by: Simon Stone <sstone1@uk.ibm.com> Change-Id: I7c789867bca311afb18e3b52c9ece11954c768ad
- Loading branch information
Simon Stone
committed
Sep 10, 2019
1 parent
2c39852
commit 6946d91
Showing
16 changed files
with
3,026 additions
and
267 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
# | ||
# This is the config file used for the docker images. | ||
# It allows all users to do anything, so don't use it on production systems. | ||
# | ||
# Do not configure host and port under `listen` in this file | ||
# as it will be ignored when using docker. | ||
# see https://verdaccio.org/docs/en/docker#docker-and-custom-port-configuration | ||
# | ||
# Look here for more config file examples: | ||
# https://github.com/verdaccio/verdaccio/tree/master/conf | ||
# | ||
|
||
# path to a directory with all packages | ||
storage: /verdaccio/storage/data | ||
# path to a directory with plugins to include | ||
plugins: /verdaccio/plugins | ||
|
||
web: | ||
# WebUI is enabled as default, if you want disable it, just uncomment this line | ||
#enable: false | ||
title: Verdaccio | ||
# comment out to disable gravatar support | ||
# gravatar: false | ||
# by default packages are ordercer ascendant (asc|desc) | ||
# sort_packages: asc | ||
|
||
auth: | ||
htpasswd: | ||
file: /verdaccio/storage/htpasswd | ||
# Maximum amount of users allowed to register, defaults to "+infinity". | ||
# You can set this to -1 to disable registration. | ||
# max_users: 1000 | ||
|
||
security: | ||
api: | ||
jwt: | ||
sign: | ||
expiresIn: 60d | ||
notBefore: 1 | ||
web: | ||
sign: | ||
expiresIn: 7d | ||
notBefore: 1 | ||
|
||
# a list of other known repositories we can talk to | ||
uplinks: | ||
npmjs: | ||
url: https://registry.npmjs.org/ | ||
|
||
packages: | ||
'@*/*': | ||
# scoped packages | ||
access: $all | ||
publish: $all | ||
unpublish: $all | ||
proxy: npmjs | ||
|
||
'fabric-*': | ||
access: $all | ||
publish: $all | ||
unpublish: $all | ||
|
||
'**': | ||
# allow all users (including non-authenticated users) to read and | ||
# publish all packages | ||
# | ||
# you can specify usernames/groupnames (depending on your auth plugin) | ||
# and three keywords: "$all", "$anonymous", "$authenticated" | ||
access: $all | ||
|
||
# allow all known users to publish/publish packages | ||
# (anyone can register by default, remember?) | ||
publish: $all | ||
unpublish: $all | ||
|
||
# if package is not available locally, proxy requests to 'npmjs' registry | ||
proxy: npmjs | ||
|
||
middlewares: | ||
audit: | ||
enabled: true | ||
|
||
# log settings | ||
logs: | ||
- { type: stdout, format: pretty, level: http } | ||
#- {type: file, path: verdaccio.log, level: info} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
# Copyright IBM Corp. All Rights Reserved. | ||
# | ||
# SPDX-License-Identifier: Apache-2.0 | ||
*/ | ||
|
||
'use strict'; | ||
|
||
const gulp = require('gulp'); | ||
const shell = require('gulp-shell'); | ||
const util = require('util'); | ||
|
||
gulp.task('verdaccio-start', () => { | ||
const commands = [ | ||
'docker rm -f verdaccio || true', | ||
util.format('docker run -d -p 4873:4873 -v %s/config.yaml:/verdaccio/conf/config.yaml --name verdaccio verdaccio/verdaccio', __dirname), | ||
'sleep 5', // verdaccio takes a while to start | ||
'npm config delete //localhost:4873/:_authToken', | ||
'npm-cli-login -u testuser -p testpass -e testuser@example.org -r http://localhost:4873', | ||
'sleep 5' // avoid "jwt not active" error | ||
]; | ||
const npm_packages = ['fabric-contract-api', 'fabric-shim', 'fabric-shim-crypto']; | ||
for (const npm_package of npm_packages) { | ||
const packageJSON = require(`../../${npm_package}/package.json`); | ||
const npm_tag = packageJSON.tag; | ||
commands.push(util.format('npm publish --registry http://localhost:4873 %s --tag %s', npm_package, npm_tag)); | ||
commands.push(util.format('npm view --registry http://localhost:4873 %s', npm_package)); | ||
} | ||
return gulp.src('*.js', {read: false}) | ||
.pipe(shell(commands)); | ||
}); | ||
|
||
gulp.task('verdaccio-stop', () => { | ||
const commands = [ | ||
util.format('docker rm -f verdaccio || true') | ||
]; | ||
return gulp.src('*.js', {read: false}) | ||
.pipe(shell(commands)); | ||
}); |
Oops, something went wrong.