-
Notifications
You must be signed in to change notification settings - Fork 589
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Install private npm modules while using cloud-builders/npm #354
Comments
Hey Joel, I've never played with npm private modules unfortunately. On the other side, I also wrote this article about publishing npm modules from Cloud Build, but I don't think that's the right technique for your use case. |
@Philmod Thanks for the reply! Unfortunately, as you say, doesn't seem to fit with my current issue :( |
@Philmod When doing some more thinking I do believe your approach for publishing npm modules is the correct also for my use case (seeing as installing private modules is also an authed npm action). So I've followed your guide and updated my cloudbuild.yaml to: steps:
- name: 'gcr.io/cloud-builders/gcloud'
id: 'decrypt npmrc'
args:
- kms
- decrypt
- --ciphertext-file=npmrc.enc
- --plaintext-file=/root/.npmrc
- --location=global
- --keyring=my-keyring
- --key=npm-key
volumes:
- name: 'home'
path: /root/
- name: 'gcr.io/cloud-builders/npm'
id: 'install'
args: ['install']
env:
- HOME=/root/
volumes:
- name: 'home'
path: /root/
- name: 'gcr.io/cloud-builders/npm'
id: 'test'
args: ['run', 'test']
- name: 'gcr.io/cloud-builders/docker'
id: 'build'
args: [
'build',
'--build-arg',
'npmtoken=${_NPM_TOKEN}',
'-t',
'eu.gcr.io/$PROJECT_ID/$REPO_NAME:$SHORT_SHA',
'.']
#- name: 'gcr.io/cloud-builders/gcloud'
#args: ['app', 'deploy']
substitutions:
_NPM_TOKEN: ___actual_npm_token_here___
images: ['eu.gcr.io/$PROJECT_ID/$REPO_NAME:$SHORT_SHA'] However I'm getting issues from Cloud Build (please note: I've added the Cloud KMS CryptoKey Decrypter role to the Cloud Build service account) starting build "c92c68a3-bc27-4a63-9b75-c8223b53658c"
FETCHSOURCE
Initialized empty Git repository in /workspace/.git/
From https://source.developers.google.com/p/{censored}-207616/r/github-{censored}
* branch 1ae02f97d395e7acd5fa5077982c7f58b6ef2a6f -> FETCH_HEAD
HEAD is now at 1ae02f9 Reverted to using npm
BUILD
Starting Step #0 - "decrypt npmrc"
Step #0 - "decrypt npmrc": Already have image (with digest): gcr.io/cloud-builders/gcloud
Step #0 - "decrypt npmrc": ERROR: (gcloud.kms.decrypt) Failed to read ciphertext file [npmrc.enc]: Unable to read file [npmrc.enc]: [Errno 2] No such file or directory: 'npmrc.enc'
Finished Step #0 - "decrypt npmrc"
ERROR
ERROR: build step 0 "gcr.io/cloud-builders/gcloud" failed: exit status 1 |
Oh! Nevermind 🙈 I didn't get that a |
…tom-image Builds an image that can create Cloud Dataproc custom images.
Hello 👋
I'm having issues installing private npm modules while using Cloud Build. After lots of googling I haven't found any resonable solutions.
I wonder if anyone has any insights into what might be causing this and how to solve it
cloudbuild.yaml
(project specific)
.npmrc
//registry.npmjs.org/:_authToken=${NPM_TOKEN}
Logs from Cloud Build
This is not an issue while building the Docker container and I'm to unfamiliar with the Cloud Build structure to see any solution.
Dockerfile
I've tried experimenting with using
node:alpine
instead ofgcr.io/cloud-builders/npm
but no change.To me It seems the project specific
.npmrc
doesn't work in the cloud build infrastructure (...or something).Thankful for any guidance!
The text was updated successfully, but these errors were encountered: