https://pulumi.com logo
Title
p

prehistoric-sandwich-7272

01/31/2023, 4:25 PM
Hey guys! Can I create a Pulumi Package as a private repository? Meaning publishing it to a private repo inside my organization?
e

echoing-dinner-19531

01/31/2023, 4:26 PM
Yup
Just set the package pluginDownloadUrl to point to your private repo for the package and make sure your users have the envvar "GITHUB_TOKEN" set with a token that will allow them access
p

prehistoric-sandwich-7272

01/31/2023, 4:29 PM
@echoing-dinner-19531 Thanks for the quick response I am asking this since I have an issue with doing so, I would appreciate it dearly if you can advise me on how to handle my error I used this template repo - https://github.com/pulumi/pulumi-component-provider-go-boilerplate Thing is, when my GitHub actions runs and trying to publish the NodeJS SDK, it fails on the error:
npm ERR! need auth This command requires you to be logged in to <https://npm.pkg.github.com/>
npm ERR! need auth You need to authorize this machine using `npm adduser`
My suspicion is - that it happens because the Makefile script builds a
package.json
inside
sdk/nodejs/bin
with the following:
{
  "name": "@pulumi/xyz",
  "version": "0.0.1",
  "repository": "pulumi-<MY_REPO_NAME>",
  "scripts": {
    "build": "tsc",
    "install": "node scripts/install-pulumi-plugin.js resource xyz "
  },
  "dependencies": {
    "@pulumi/aws": "^4.0.0"
  },
  "devDependencies": {
    "typescript": "^3.7.0"
  },
  "peerDependencies": {
    "@pulumi/pulumi": "latest"
  },
  "pulumi": {
    "resource": true,
    "pluginDownloadURL": "<github://api.github.com/@><MY_ORG>[/<MY_REPO_NAME>]"
  }
}
Notice the part -
"name": "@pulumi/xyz"
From my understanding it should be something like:
"name": "@<MY_ORG_NAME>/xyz"
Is there a keyword that I can pass to the schema.yaml file in order to change this?
e

echoing-dinner-19531

01/31/2023, 4:34 PM
Yes if you add:
"languages": {
  "nodejs": {
    "packageName": "customPackageName"
  }
}
to the schema it will change that.
p

prehistoric-sandwich-7272

01/31/2023, 4:48 PM
@echoing-dinner-19531 I can’t find the key
languages
in https://raw.githubusercontent.com/pulumi/pulumi/master/pkg/codegen/schema/pulumi.json Maybe
language
?
And I don’t think there is
packageName
value under language.nodejs
e

echoing-dinner-19531

01/31/2023, 4:51 PM
Ah yeh
language
no s. There is a
pacakgeName
in the
nodejsLanguageSpec
object.
p

prehistoric-sandwich-7272

01/31/2023, 4:54 PM
@echoing-dinner-19531 So something like
language:
  nodejs:
    properties:
      packageName: @<MY_ORG>/xyz
    dependencies:
      "@pulumi/aws": "^4.0.0"
    devDependencies:
      typescript: "^3.7.0"
I get an error when trying to run it tho...
e

echoing-dinner-19531

01/31/2023, 4:54 PM
language:
  nodejs:
    packageName: @<MY_ORG>/xyz
    dependencies:
      "@pulumi/aws": "^4.0.0"
    devDependencies:
      typescript: "^3.7.0"
No "properties" key
p

prehistoric-sandwich-7272

01/31/2023, 6:23 PM
@echoing-dinner-19531 Thanks !! it worked 🙂