3
3
[ ![ Build Status] ( https://img.shields.io/endpoint.svg?url=https%3A%2F%2Factions-badge.atrox.dev%2Fseek-oss%2Fprivate-npm-buildkite-plugin%2Fbadge&style=flat )] ( https://actions-badge.atrox.dev/seek-oss/private-npm-buildkite-plugin/goto )
4
4
[ ![ GitHub Release] ( https://img.shields.io/github/release/seek-oss/private-npm-buildkite-plugin.svg )] ( https://github.com/seek-oss/private-npm-buildkite-plugin/releases )
5
5
6
-
7
6
A [ Buildkite plugin] ( https://buildkite.com/docs/agent/v3/plugins ) to allow pipeline steps to easily install
8
7
private packages from an [ npm] ( https://www.npmjs.com ) repository.
9
8
@@ -17,7 +16,7 @@ To read the value from an environment variable named `MY_TOKEN` when the plugin
17
16
steps :
18
17
- command : yarn install
19
18
plugins :
20
- - seek-oss/private-npm#v1.2 .0:
19
+ - seek-oss/private-npm#v1.3 .0:
21
20
env : " MY_TOKEN"
22
21
` ` `
23
22
@@ -27,77 +26,94 @@ To read the value from a file named `my_token_file`, use the `file` field.
27
26
steps:
28
27
- command: yarn install
29
28
plugins:
30
- - seek-oss/private-npm#v1.2 .0:
29
+ - seek-oss/private-npm#v1.3 .0:
31
30
file: "my_token_file"
32
31
` ` `
33
32
34
- Alternatively you can read the token directly from any value exposed to your `pipeline.yml` file. However, this
35
- approach is discouraged in favour of using with the `env` or `file` fields. This functionality remains in the interest
36
- of backwards compatibility.
33
+ Alternatively you can read the token directly from any value exposed to your `pipeline.yml` file. However, this
34
+ approach is discouraged in favour of using with the `env` or `file` fields. This functionality remains in the interest
35
+ of backwards compatibility.
37
36
38
37
` ` ` yml
39
38
steps:
40
39
- command: yarn install
41
40
plugins:
42
- - seek-oss/private-npm#v1.2 .0:
41
+ - seek-oss/private-npm#v1.3 .0:
43
42
token: ${MY_TOKEN}
44
43
` ` `
45
44
46
-
47
45
You can also specify a custom npm registry if you are using your own mirror.
48
46
49
47
` ` ` yml
50
48
steps:
51
49
- command: yarn install
52
50
plugins:
53
- - seek-oss/private-npm#v1.2 .0:
51
+ - seek-oss/private-npm#v1.3 .0:
54
52
env: "MY_TOKEN"
55
53
registry: //myprivatenpm.com/
56
54
` ` `
57
55
56
+ If you set a registry, you can configure a specific scope to fetch packages from your custom registry.
57
+ In this case, use only Protocol-Relative URL for `registry` as `https://` will be prepended in the
58
+ scope in the `.npmrc` for you.
59
+
60
+ ` ` ` yml
61
+ steps:
62
+ - command: yarn install
63
+ plugins:
64
+ - seek-oss/private-npm#v1.3.0:
65
+ env: "MY_TOKEN"
66
+ registry: //myprivatenpm.com/
67
+ scope: "@myprivatescope"
68
+ ` ` `
69
+
58
70
# # Configuration
59
71
60
- > **NOTE** Even thought `env`, `file` and `token` are described as optional, _at least one must be set_ or the plugin
72
+ > **NOTE** Even thought `env`, `file` and `token` are described as optional, _at least one must be set_ or the plugin
61
73
> will fail.
62
74
63
75
# ## `env` (optional)
64
76
65
- The value of the NPM token will be read from the agent environment when the plugin executes. This is useful in working
66
- around cases where eager binding of variables in `pipeline.yml` means some variables are not present in the
77
+ The value of the NPM token will be read from the agent environment when the plugin executes. This is useful in working
78
+ around cases where eager binding of variables in `pipeline.yml` means some variables are not present in the
67
79
environment when the configuration file is parsed.
68
80
69
81
> **NOTE** : Beware of using `NPM_TOKEN` as the name for the environment variable. When using that name the variable
70
82
> is unstable and has a tedency to return an empty string in the context of this plugin.
71
83
72
84
# ## `file` (optional)
73
85
74
- The value of the NPM token will be read from a file on the agent when the plugin executes. This is useful when working
86
+ The value of the NPM token will be read from a file on the agent when the plugin executes. This is useful when working
75
87
with secret that are created as files on the filesystem when a build is initiated.
76
88
77
89
# ## `token` (optional)
78
90
79
- The value of the NPM token will be read from a variable which is available to the Buildkite YAML parsing context.
80
- This value is interpolated when the YAML configuration is parsed by the Buildgent agent and provided to the plugin "as
91
+ The value of the NPM token will be read from a variable which is available to the Buildkite YAML parsing context.
92
+ This value is interpolated when the YAML configuration is parsed by the Buildgent agent and provided to the plugin "as
81
93
is".
82
94
83
95
Example : ` ${MY_TOKEN}`
84
- > **NOTE:** Don't put your tokens into source control. Don't use web interfaces you don't control to inject them into
85
- > your environment either. Rather use a Secrets Manager. If you are an AWS user, perhaps consider the
96
+
97
+ > **NOTE:** Don't put your tokens into source control. Don't use web interfaces you don't control to inject them into
98
+ > your environment either. Rather use a Secrets Manager. If you are an AWS user, perhaps consider the
86
99
> [aws-sm-buildkite-plugin](https://github.com/seek-oss/aws-sm-buildkite-plugin) which works well with this plugin.
87
100
88
- > **NOTE:** There is anecdotal evidence to suggest that using `NPM_TOKEN` as the variable name containing the
89
- > token can intermittently cause the token to become empty. It is advised to use a different name as has been done in
101
+ > **NOTE:** There is anecdotal evidence to suggest that using `NPM_TOKEN` as the variable name containing the
102
+ > token can intermittently cause the token to become empty. It is advised to use a different name as has been done in
90
103
> these docs.
91
104
92
105
# ## `registry` (optional)
93
- The path to a private npm repository. Please ensure you supply the trailing `/`!
106
+
107
+ The path to a private npm repository. Please ensure you supply the trailing `/`!
94
108
95
109
Example : ` //myprivatenpm.com/`
96
110
97
111
# ## `output-path` (optional)
98
- The path to the .npmrc that will be created. Please ensure you supply the trailing `/`!
112
+
113
+ The path to the .npmrc that will be created. Please ensure you supply the trailing `/`!
99
114
100
115
Example : ` ./project/path/`
101
116
102
117
# # License
118
+
103
119
MIT (see [LICENSE](./LICENSE))
0 commit comments