You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@cordova.apache.org by fi...@apache.org on 2017/01/19 21:16:08 UTC
cordova-coho git commit: wrap up plugins release work into similar
generator function style as rest of coho.
Repository: cordova-coho
Updated Branches:
refs/heads/plugins-releaser 4cf47953f -> fd8bb2940
wrap up plugins release work into similar generator function style as rest of coho.
Project: http://git-wip-us.apache.org/repos/asf/cordova-coho/repo
Commit: http://git-wip-us.apache.org/repos/asf/cordova-coho/commit/fd8bb294
Tree: http://git-wip-us.apache.org/repos/asf/cordova-coho/tree/fd8bb294
Diff: http://git-wip-us.apache.org/repos/asf/cordova-coho/diff/fd8bb294
Branch: refs/heads/plugins-releaser
Commit: fd8bb29402bbbcae3a4f822db11a7a9878ce8563
Parents: 4cf4795
Author: filmaj <ma...@gmail.com>
Authored: Thu Jan 19 13:16:02 2017 -0800
Committer: filmaj <ma...@gmail.com>
Committed: Thu Jan 19 13:16:02 2017 -0800
----------------------------------------------------------------------
src/main.js | 4 +
src/plugin-release.js | 371 ++++++++++++++++++++++++---------------------
2 files changed, 199 insertions(+), 176 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/fd8bb294/src/main.js
----------------------------------------------------------------------
diff --git a/src/main.js b/src/main.js
index b01996e..32a0164 100644
--- a/src/main.js
+++ b/src/main.js
@@ -111,6 +111,10 @@ module.exports = function() {
desc: 'Prepares tools for release',
entryPoint: lazyRequire('./tools-release', 'prepareToolsRelease')
}, {
+ name: 'prepare-plugins-release',
+ desc: 'Prepares plugins for release',
+ entryPoint: lazyRequire('./plugin-release', 'interactive')
+ }, {
name: 'npm-publish-tag',
desc: 'Publishes current version of repo to specified tag',
entryPoint: lazyRequire('./npm-publish', 'publishTag')
http://git-wip-us.apache.org/repos/asf/cordova-coho/blob/fd8bb294/src/plugin-release.js
----------------------------------------------------------------------
diff --git a/src/plugin-release.js b/src/plugin-release.js
index 9ac1a07..02f1100 100644
--- a/src/plugin-release.js
+++ b/src/plugin-release.js
@@ -28,6 +28,7 @@ var flagutil = require('./flagutil');
var gitutil = require('./gitutil');
var repoutil = require('./repoutil');
var repoupdate = require('./repo-update');
+var repoclone = require('./repo-clone');
var versionutil = require('./versionutil');
var jira_client = require('jira-client');
var inquirer = require('inquirer');
@@ -44,193 +45,211 @@ var cordova_project; // store ref to jira project for Cordova
var plugins_release_issue; // store ref to jira issue tracking release.
var jira_issue_types; // store ref to all issue types supported by our JIRA instance
var jira_task_issue; // store ref to the "task" issue type
-
-console.log('Hi! So you want to do a plugins release, do you?');
-console.log('Let\'s start with your JIRA credentials - this system will be interacting with Apache\'s JIRA instance (issues.apache.org) often.');
-inquirer.prompt([{
- type: 'input',
- name: 'username',
- message: 'Please enter your JIRA username'
-},{
- type: 'password',
- name: 'password',
- message: 'Please enter your JIRA password'
-}]).then(function(answers) {
- var username = answers.username;
- you = username;
- var password = answers.password;
- jira = new jira_client({
- protocol: 'https',
- host: 'issues.apache.org',
- base: 'jira',
- apiVersion: '2',
- strictSSL: true,
- username: username,
- password: password
- });
- return jira.getCurrentUser();
-}).then(function(user) {
- jira_user = user;
- you = user.displayName || you; // either use JIRA display name, or username
- console.log('Hey', you, '!');
- console.log('Welcome. Let me pull some data from JIRA first...');
- return jira.listProjects();
-}).then(function(projects) {
- // Find the Apache Cordova (CB) project in Apache's JIRA
- for (var i = 0; i < projects.length; i++) {
- var project = projects[i];
- if (project.key == 'CB') {
- cordova_project = project;
- break;
- }
- }
- return jira.listIssueTypes();
-}).then(function(issue_types) {
- jira_issue_types = issue_types;
- for (var i = 0; i < issue_types.length; i++) {
- var it = issue_types[i];
- if (it.name == 'Task') {
- jira_task_issue = it;
+var plugin_base; // parent directory holding all cordova plugins
+
+module.exports.interactive = function *interactive_plugins_release() {
+ console.log('Hi! So you want to do a plugins release, do you?');
+ console.log('Let\'s start with your JIRA credentials - this system will be interacting with Apache\'s JIRA instance (issues.apache.org) often.');
+ inquirer.prompt([{
+ type: 'input',
+ name: 'username',
+ message: 'Please enter your JIRA username'
+ },{
+ type: 'password',
+ name: 'password',
+ message: 'Please enter your JIRA password'
+ }]).then(function(answers) {
+ var username = answers.username;
+ you = username;
+ var password = answers.password;
+ jira = new jira_client({
+ protocol: 'https',
+ host: 'issues.apache.org',
+ base: 'jira',
+ apiVersion: '2',
+ strictSSL: true,
+ username: username,
+ password: password
+ });
+ return jira.getCurrentUser();
+ }).then(function(user) {
+ jira_user = user;
+ you = user.displayName || you; // either use JIRA display name, or username
+ console.log('Hey', you, '!');
+ console.log('Welcome. Let me pull some data from JIRA first...');
+ return jira.listProjects();
+ }).then(function(projects) {
+ // Find the Apache Cordova (CB) project in Apache's JIRA
+ for (var i = 0; i < projects.length; i++) {
+ var project = projects[i];
+ if (project.key == 'CB') {
+ cordova_project = project;
+ break;
+ }
}
- }
- /*
- * 2. Are your gpg keys in place? maybe basic validation
- */
- inquirer.prompt({
- type: 'confirm',
- name: 'gpg',
- message: 'Are your GPG keys in place?'
- }).then(function(answer) {
- if (answer.gpg) {
- console.log('Great! Let\'s keep going.');
- return inquirer.prompt({
- type: 'confirm',
- name: 'discuss',
- message: 'Did you start a "[DISCUSS] Plugins release" thread on the Cordova mailing list?'
- });
- } else {
- console.error('You should get your GPG keys sorted out first!');
- console.warn('Follow the instructions here, then come back and try again :)');
- console.warn('https://github.com/apache/cordova-coho/blob/master/docs/setting-up-gpg.md');
- process.exit(2);
+ return jira.listIssueTypes();
+ }).then(function(issue_types) {
+ jira_issue_types = issue_types;
+ for (var i = 0; i < issue_types.length; i++) {
+ var it = issue_types[i];
+ if (it.name == 'Task') {
+ jira_task_issue = it;
+ }
}
- }).then(function(answer) {
- /* 3. Y/N did you start a "[DISCUSS] Plugins release" thread on the mailing list?
- * - Bonus: Can we parse the mailing list for this?
+ /*
+ * 2. Are your gpg keys in place? maybe basic validation
*/
- if (answer.discuss) {
- console.log('Nice! Way to keep everyone in the loop!');
- return inquirer.prompt({
- type: 'confirm',
- name: 'jira',
- message: 'Is there a JIRA issue filed for the plugins release? (i.e. "Plugins Release, <recent date>") - if not, I will create one for you.'
- });
- } else {
- console.error('You definitely need to have a discussion about the plugins release on the mailing list first. Go do that!');
- process.exit(3);
+ inquirer.prompt({
+ type: 'confirm',
+ name: 'gpg',
+ message: 'Are your GPG keys in place?'
+ }).then(function(answer) {
+ if (answer.gpg) {
+ console.log('Great! Let\'s keep going.');
+ return inquirer.prompt({
+ type: 'confirm',
+ name: 'discuss',
+ message: 'Did you start a "[DISCUSS] Plugins release" thread on the Cordova mailing list?'
+ });
+ } else {
+ console.error('You should get your GPG keys sorted out first!');
+ console.warn('Follow the instructions here, then come back and try again :)');
+ console.warn('https://github.com/apache/cordova-coho/blob/master/docs/setting-up-gpg.md');
+ process.exit(2);
+ }
+ }).then(function(answer) {
+ /* 3. Y/N did you start a "[DISCUSS] Plugins release" thread on the mailing list?
+ * - Bonus: Can we parse the mailing list for this?
+ */
+ if (answer.discuss) {
+ console.log('Nice! Way to keep everyone in the loop!');
+ return inquirer.prompt({
+ type: 'confirm',
+ name: 'jira',
+ message: 'Is there a JIRA issue filed for the plugins release? (i.e. "Plugins Release, <recent date>") - if not, I will create one for you.'
+ });
+ } else {
+ console.error('You definitely need to have a discussion about the plugins release on the mailing list first. Go do that!');
+ process.exit(3);
- }
- }).then(function(answer) {
- /* 4. Ask for JIRA issue, or, Create JIRA issue; check docs/plugins-release-process.md for details
- * - lets refer to this JIRA issue as $JIRA from here on out.
- * - BONUS: COMMENT to this JIRA issue for each "top-level" step below that is completed.
- */
- if (answer.jira) {
- return inquirer.prompt({
- type: 'input',
- name: 'jira',
- message: 'What is the JIRA issue number for your plugins release? Please provide a number. (i.e. CB-XXXXX)',
- validate: function(input) {
- var done = this.async();
- if (typeof input !== 'number') {
- done('You need to provide a number!');
- return;
- }
- var cb_issue = 'CB-' + input;
- jira.findIssue(cb_issue).then(function(issue) {
- done(null, issue);
+ }
+ }).then(function(answer) {
+ /* 4. Ask for JIRA issue, or, Create JIRA issue; check docs/plugins-release-process.md for details
+ * - lets refer to this JIRA issue as $JIRA from here on out.
+ * - BONUS: COMMENT to this JIRA issue for each "top-level" step below that is completed.
+ */
+ if (answer.jira) {
+ return inquirer.prompt({
+ type: 'input',
+ name: 'jira',
+ message: 'What is the JIRA issue number for your plugins release? Please provide only the numerical part of the issue key (i.e. CB-XXXXX)'
+ }).then(function(answers) {
+ var cb_issue = 'CB-' + answers.jira;
+ console.log('Looking for ' + cb_issue + '...');
+ return jira.findIssue(cb_issue).then(function(issue) {
+ return issue;
}, function(err) {
- done('Error finding issue ' + cb_issue);
+ console.error('Error finding issue ' + cb_issue + '!');
+ process.exit(3);
});
+ });
+ } else {
+ console.warn('OK, no problem. I will create one for you now! Hang tight...');
+ var date = (new Date()).toDateString();
+ var new_issue = {
+ "fields": {
+ "project": {
+ "id": cordova_project.id
+ },
+ "summary": "Plugins Release, " + date,
+ "description": "Following steps at https://github.com/apache/cordova-coho/blob/master/docs/plugins-release-process.md",
+ "assignee": {
+ "name": jira_user.name
+ },
+ "issuetype": {
+ "id": jira_task_issue.id
+ },
+ }
}
- }).catch(function(err) {
- console.error(err);
- process.exit(3);
- });
- } else {
- console.warn('OK, no problem. I will create one for you now! Hang tight...');
- var date = (new Date()).toDateString();
- var new_issue = {
- "fields": {
- "project": {
- "id": cordova_project.id
- },
- "summary": "Plugins Release, " + date,
- "description": "Following steps at https://github.com/apache/cordova-coho/blob/master/docs/plugins-release-process.md",
- "assignee": {
- "name": jira_user.name
- },
- "issuetype": {
- "id": jira_task_issue.id
- },
- }
+ return jira.addNewIssue(new_issue).then(function(issue) {
+ return issue;
+ }, function(err) {
+ console.error('There was a problem creating the JIRA issue!', err);
+ process.exit(4);
+ });
}
- return jira.addNewIssue(new_issue).then(function(issue) {
- return issue;
- }, function(err) {
- console.error('There was a problem creating the JIRA issue!', err);
+ }).then(function(jira_issue) {
+ console.log('Sweet, our Plugins Release JIRA issue is ' + jira_issue.key + ' (https://issues.apache.org/jira/browse/' + jira_issue.key + ')!');
+ plugins_release_issue = jira_issue;
+ /* Time for step 5: update the repos. */
+ return inquirer.prompt([{
+ type: 'input',
+ name: 'cwd',
+ default: apputil.getBaseDir(),
+ message: 'We need to update the plugin repositories. Enter the directory containing all your plugin repository source code (absolute or relative paths work here)'
+ }, {
+ type: 'confirm',
+ name: 'ok',
+ message: function(answers) {
+ return 'WARNING! Are you sure the following directory is where you store your plugins? We will be cloning/updating repos here: ' + path.resolve(path.normalize(answers.cwd));
+ }
+ }]);
+ }).then(function(answers) {
+ if (answers.ok) {
+ plugin_base = path.resolve(path.normalize(answers.cwd));
+ // TODO: is `plugins_base` pass-able to cloneRepos here?
+ var plugin_repos = flagutil.computeReposFromFlag('plugins', {includeSvn:true});
+ yield require('./repo-clone').cloneRepos(plugin_repos, false, null);
+ } else {
+ console.error('Well you should type in the correct location the first time. Or this section of coho code should be coded more robustly! Contributions welcome :P');
+ console.error('Please try again.');
process.exit(4);
- });
- }
- }).then(function(jira_issue) {
- console.log('Sweet, our Plugins Release JIRA issue is ' + jira_issue.key + ' (https://issues.apache.org/jira/browse/' + jira_issue.key + ')!');
- plugins_release_issue = jira_issue;
- /* Time for step 5: update the repos. */
+ }
+ });
+ }, function(auth_err) {
+ var keys = Object.keys(auth_err);
+ console.error('ERROR! There was a problem connecting to JIRA, received a', auth_err.statusCode, 'status code.');
+ process.exit(1);
});
-},function(auth_err) {
- var keys = Object.keys(auth_err);
- console.error('ERROR! There was a problem connecting to JIRA, received a', auth_err.statusCode, 'status code.');
- process.exit(1);
-});
-/* 6. ask user if they have a specific list of plugins to release, OR, auto-identify which plugins have changes. if auto-identifying, ask user to confirm at end. if wrong, ask user to manually input.
- * 7. ensure license headers are present everywhere.
- * 8. ensure all dependencies and subdependencies have apache-compatible licenses.
- * 9. update plugin versions + release notes.
- * - for each plugin, remove the `-dev` suffix in plugin.xml, package.json, and plugin.xml of `tests/` subdirectory (if exists)
- * - each plugin needs a version bump.
- * - the plugin may already have an acceptably-bumped verison. perhaps grab latest-published version of plugin from npm and compare to version in source as a hint to RM
- * - how to determine if patch, minor or major? show changes to each plugin and then prompt Release Manager for a decision?
- * - reuse coho 'update release notes' command
- * - what's the average case? just a patch bump? perhaps, for each plugin, show release notes and let RM override version beyond patch bump if RM believes it is necessary?
- * - while reviewing changes for version bump, this is probably the right time to aggregate release notes. once aggregated, write them out to RELEASENOTES.md
- * - commit changes to versions and release notes together with description '$JIRA Updated version and release notes for release $v'
- * - tag each plugin repo with $v
- * 10. Create release branch. wtf is going on here?
- * 11. Increment plugin versions back on the master branch to include -dev.. i think?
- * 12. Push tags, release branch, and master branch changes.
- * 13. Publish to apache svn:
- * - repo-clone the dist and dist/dev svn repos
- * - create-archive -r $ACTIVE --dest cordova-dist-dev/$JIRA
- * - "manually double check version numbers are correct on the file names"
- * - verify-archive cordova-dist-dev/$JIRA/*.tgz
- * - upload by running `svn` commands.
- * 14. Dump instructions only? Prepare blog post - perhaps can dump out release notes-based blog content.
- * - this apparently ends up as a .md file in cordova-docs. perhaps can dump this as a shell of a file into the cordova-docs repo? maybe even auto-branch the docs repo in prep for a PR?
- * 15. Dump instructions only? Start a vote thread.
- * 16. Bonus: separate script to 'approve' a plugins release, which would:
- * - publish the artifacts to dist/ in apache
- * - "tell apache about the release" which has a TODO to write a helper to POST the request appropriately.
- * - publish to npm
- * - push 'permanent release tags' (for apache) to git
- * - issue cordova-docs blog post PR (only if we auto-branch in cordova-docs repo, as per step 14)
- * - dump instructions only? post an ANNOUNCE thread to ML.
- * - close $JIRA issue
- */
-
-/*
- * TODO: Need ability to serialize process of plugins release - save state of the process at any point.
- */
+ /* 6. ask user if they have a specific list of plugins to release, OR, auto-identify which plugins have changes. if auto-identifying, ask user to confirm at end. if wrong, ask user to manually input.
+ * 7. ensure license headers are present everywhere.
+ * 8. ensure all dependencies and subdependencies have apache-compatible licenses.
+ * 9. update plugin versions + release notes.
+ * - for each plugin, remove the `-dev` suffix in plugin.xml, package.json, and plugin.xml of `tests/` subdirectory (if exists)
+ * - each plugin needs a version bump.
+ * - the plugin may already have an acceptably-bumped verison. perhaps grab latest-published version of plugin from npm and compare to version in source as a hint to RM
+ * - how to determine if patch, minor or major? show changes to each plugin and then prompt Release Manager for a decision?
+ * - reuse coho 'update release notes' command
+ * - what's the average case? just a patch bump? perhaps, for each plugin, show release notes and let RM override version beyond patch bump if RM believes it is necessary?
+ * - while reviewing changes for version bump, this is probably the right time to aggregate release notes. once aggregated, write them out to RELEASENOTES.md
+ * - commit changes to versions and release notes together with description '$JIRA Updated version and release notes for release $v'
+ * - tag each plugin repo with $v
+ * 10. Create release branch. wtf is going on here?
+ * 11. Increment plugin versions back on the master branch to include -dev.. i think?
+ * 12. Push tags, release branch, and master branch changes.
+ * 13. Publish to apache svn:
+ * - repo-clone the dist and dist/dev svn repos
+ * - create-archive -r $ACTIVE --dest cordova-dist-dev/$JIRA
+ * - "manually double check version numbers are correct on the file names"
+ * - verify-archive cordova-dist-dev/$JIRA/*.tgz
+ * - upload by running `svn` commands.
+ * 14. Dump instructions only? Prepare blog post - perhaps can dump out release notes-based blog content.
+ * - this apparently ends up as a .md file in cordova-docs. perhaps can dump this as a shell of a file into the cordova-docs repo? maybe even auto-branch the docs repo in prep for a PR?
+ * 15. Dump instructions only? Start a vote thread.
+ * 16. Bonus: separate script to 'approve' a plugins release, which would:
+ * - publish the artifacts to dist/ in apache
+ * - "tell apache about the release" which has a TODO to write a helper to POST the request appropriately.
+ * - publish to npm
+ * - push 'permanent release tags' (for apache) to git
+ * - issue cordova-docs blog post PR (only if we auto-branch in cordova-docs repo, as per step 14)
+ * - dump instructions only? post an ANNOUNCE thread to ML.
+ * - close $JIRA issue
+ */
+ /*
+ * TODO: Need ability to serialize process of plugins release - save state of the process at any point.
+ */
+}
// TODO: what is shared between plugin-release and platform-release helpers? factor out into util/lib/whatever helper modules
/*
---------------------------------------------------------------------
To unsubscribe, e-mail: commits-unsubscribe@cordova.apache.org
For additional commands, e-mail: commits-help@cordova.apache.org