@prodigy/npm-token v0.0.2
This package is published as public and should never contain sensitive information or expose resources.
This is a module that is used to set your ~/.npm_token file and NPM_TOKEN to the correct current version of the NPM_TOKEN which is stored in the parameter store.
Usage withing any api will be AWS_PROFILE=[dev | staging] . update-token
see 2) for more details
1) In you ~/.bash_profile make source you have a line as follows
. "$HOME/.npm_token"
The . is very important
2) From any api run AWS_PROFILE=[dev | staging] . update-token
Now the current terminal and all new terminals will have the new NPM_TOKEN set correctly. For any other terminals that you have open, want to keep open and have the new NPM_TOKEN you will need to AWS_PROFILE=dev . update-token
Getting api's and repos to use prodigy-npm-token
Copy update-token.tmpl and rename it to update-token
Read vs Write Tokens
Almost everyone should have the read token
If you need the write token it means you intend to publish from your local machine as opposed to having a pipeline do it automatically for you. This is almost never desired but if you do need the write token make sure
export NPM_REQUEST_WRITE_TOKEN=true
is set in your ./bash_profile
For Devops
prodigy-docker
prodigy-docker will need the build: to be something like this
#build:
#context: ../notifiation-api
#dockerfile: Dockerfile
#args:
#- NPM_TOKEN=${NPM_TOKEN}
Stage
stage will need something similar
TODO:
Dockerfile
Each Dockerfile will need
ARG NPM_TOKEN=
ENV NPM_TOKEN=${NPM_TOKEN}
Codebuild:
All codebuilds should have their environment include /_global/npm_read_token
or /_global/npm_write_token
from the parameter store as NPM_TOKEN
evironment variable. Which to choose depends on whether the codebuild needs to publish
Buildspec for codebuild will need to have an NPM_TOKEN build arg
--build-arg NPM_TOKEN=$NPM_TOKEN
Jenkins
On Jenkins the AWS Parameter Store Pluginhttps://wiki.jenkins.io/display/JENKINS/AWS+Parameter+Store+Plugin should be used to inject in /_global/npm_read_token
or /_global/npm_write_token
as NPM_TOKEN
evironment variable depending on usage case.