@heroku/skynet 1.6.11 → 1.6.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +38 -11
- package/commands/deprovision.js +4 -2
- package/lib/skynet.js +3 -2
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -37,7 +37,7 @@ heroku skynet:<cmd>
|
|
|
37
37
|
```
|
|
38
38
|
|
|
39
39
|
### Unit test
|
|
40
|
-
```
|
|
40
|
+
```bash
|
|
41
41
|
# $SKYNET_CLI_HOME points to the home dir of heroku-skynet-cli
|
|
42
42
|
cd $SKYNET_CLI_HOME
|
|
43
43
|
unset SKYNET_HOST
|
|
@@ -45,7 +45,7 @@ npm test
|
|
|
45
45
|
```
|
|
46
46
|
|
|
47
47
|
### Integration test
|
|
48
|
-
```
|
|
48
|
+
```bash
|
|
49
49
|
#
|
|
50
50
|
# Start local skynet
|
|
51
51
|
#
|
|
@@ -55,6 +55,7 @@ $ pg_ctl -D /usr/local/var/postgres start
|
|
|
55
55
|
$ redis-server
|
|
56
56
|
|
|
57
57
|
# Update URL and KEY in .env. $REAL_KEY_IN_PRODUCTION refers to the real key in production.
|
|
58
|
+
$ cd $SKYNET_HOME
|
|
58
59
|
$ sed -i -e 's/HEROKU_API_URL=.*/HEROKU_API_URL=https:\/\/api.heroku.com/g' .env
|
|
59
60
|
$ sed -i -e 's/HEROKU_API_KEY=.*/HEROKU_API_KEY=$REAL_KEY_IN_PRODUCTION/g' .env
|
|
60
61
|
|
|
@@ -70,6 +71,10 @@ $ heroku local web,worker
|
|
|
70
71
|
$ cd $HEROKU_SKYNET_CLI_HOME
|
|
71
72
|
$ cloud production
|
|
72
73
|
|
|
74
|
+
# Link to the local plugin implementation
|
|
75
|
+
$ cd $HEROKU_SKYNET_CLI_HOME
|
|
76
|
+
$ heroku plugins:link
|
|
77
|
+
|
|
73
78
|
# Pointing to the local Skynet instance
|
|
74
79
|
$ export SKYNET_HOST=http://localhost:5000
|
|
75
80
|
|
|
@@ -78,18 +83,40 @@ $ export SKYNET_HOST=http://localhost:5000
|
|
|
78
83
|
#
|
|
79
84
|
|
|
80
85
|
# This unsuspend request will be sent to the local Skynet instance
|
|
81
|
-
$ heroku skynet::unsuspend::user -u
|
|
86
|
+
$ heroku sudo skynet::unsuspend::user -u xyz@heroku.com
|
|
82
87
|
|
|
88
|
+
# Verify that you can see the unsuspend record in suspension_activities table
|
|
83
89
|
```
|
|
84
90
|
|
|
85
91
|
### Publishing to `npm`
|
|
86
|
-
|
|
92
|
+
* Request access to the NPM Heroku Organization using [this form](https://securityorg.force.com/IntakeApp/s/?entityCode=HerokuAccess&si=a1i3A0000007euiQAA).
|
|
93
|
+
* Request write access to @keroku/skynet package by sending email to dzhuo@salesforce.com.
|
|
94
|
+
* Publish the package:
|
|
87
95
|
|
|
88
|
-
|
|
96
|
+
```
|
|
97
|
+
# Check out the latest master
|
|
98
|
+
$ cd $HEROKU_SKYNET_CLI_HOME
|
|
99
|
+
$ git checkout -b master origin/master
|
|
89
100
|
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
94
|
-
|
|
95
|
-
|
|
101
|
+
# Run npm release. In case `npm run release` asks you whether
|
|
102
|
+
# or not you want to publish the repo publicly, answer "No".
|
|
103
|
+
$ npm login
|
|
104
|
+
$ npm test
|
|
105
|
+
$ npm run release
|
|
106
|
+
```
|
|
107
|
+
|
|
108
|
+
* Verify that new package version is created on [npm website](https://www.npmjs.com/package/@heroku/skynet).
|
|
109
|
+
* Note: You will get an error at the end of `npm run release`. Np attempts to commit to master branch the updated package version in the package.json. But the commit will fail because our master branch is protected. You can ignore the error message.
|
|
110
|
+
* Submit a new PR to update the version in `package.json` and `package-lock.json`. Here is one [PR example](https://github.com/heroku/heroku-skynet-cli/pull/74).
|
|
111
|
+
* Test the newly released @heroku/skynet package
|
|
112
|
+
|
|
113
|
+
```bash
|
|
114
|
+
# install the latest @heroku/skynet package
|
|
115
|
+
$ cd $HEROKU_SKYNET_CLI_HOME
|
|
116
|
+
$ heroku plugins:unlink
|
|
117
|
+
$ heroku plugins:install @heroku/skynet
|
|
118
|
+
$ heroku plugins # verify that the latest version is installed
|
|
119
|
+
|
|
120
|
+
# run tests
|
|
121
|
+
$ heroku sudo skynet::unsuspend::user -u xyz@heroku.com
|
|
122
|
+
```
|
package/commands/deprovision.js
CHANGED
|
@@ -10,12 +10,13 @@ async function run (context) {
|
|
|
10
10
|
let notes = context.flags.notes
|
|
11
11
|
let category = context.flags.category
|
|
12
12
|
let force = context.flags.bypass
|
|
13
|
+
let notify = !context.flags['no-notify']
|
|
13
14
|
|
|
14
15
|
if (!user) {
|
|
15
16
|
throw new Error('Required flag: --user USER')
|
|
16
17
|
}
|
|
17
18
|
|
|
18
|
-
let response = await cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, force))
|
|
19
|
+
let response = await cli.action(`deprovisioning ${cli.color.cyan(user)}`, skynet.deprovision(user, notes, category, notify, force))
|
|
19
20
|
response = JSON.parse(response)
|
|
20
21
|
cli.log(`${response.status}. ${response.message}`)
|
|
21
22
|
}
|
|
@@ -30,7 +31,8 @@ module.exports = {
|
|
|
30
31
|
{ name: 'user', char: 'u', description: 'user to deprovision', hasValue: true },
|
|
31
32
|
{ name: 'category', char: 'c', description: 'suspension category', hasValue: true, required: true },
|
|
32
33
|
{ name: 'notes', char: 'n', description: 'suspend notes', hasValue: true, required: true },
|
|
33
|
-
{ name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false }
|
|
34
|
+
{ name: 'bypass', description: 'bypass the whitelist', hasValue: false, required: false },
|
|
35
|
+
{ name: 'no-notify', description: 'skip user suspension email notification', hasValue: false, required: false }
|
|
34
36
|
],
|
|
35
37
|
run: command(run)
|
|
36
38
|
}
|
package/lib/skynet.js
CHANGED
|
@@ -175,13 +175,14 @@ module.exports = class SkynetAPI {
|
|
|
175
175
|
})
|
|
176
176
|
}
|
|
177
177
|
|
|
178
|
-
deprovision (user, notes, category, force = false) {
|
|
178
|
+
deprovision (user, notes, category, notify = true, force = false) {
|
|
179
179
|
var body = {
|
|
180
180
|
value: user,
|
|
181
181
|
reason: notes,
|
|
182
182
|
method: 'skynet-cli',
|
|
183
183
|
category: category,
|
|
184
|
-
force: force
|
|
184
|
+
force: force,
|
|
185
|
+
notify: notify
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
return this.request(`/deprovision`, {
|