when I run it I get this error: ``` error: Run...
# general
m
when I run it I get this error:
Copy code
error: Running program '/home/xk/dp/github-testing' failed with an unhandled exception:
    /home/xk/dp/github-testing/node_modules/@ibrasho/pulumi-github/index.ts:5
    export * from "./branchProtection";
    ^^^^^^
    
    SyntaxError: Unexpected token export
l
Shouldn’t that be
import
?
m
this is generated by an older version of pulumi terraform bridge
l
Didn’t know that form of
export
, but it should work according to this doc: https://www.typescriptlang.org/docs/handbook/modules.html#allvalidatorsts
@mammoth-elephant-55302 is your Pulumi program set to
typescript
, not
javascript
. See
Pulumi.yaml
file.
Hmm… that is
runtime: nodejs
for both. Do you have a
tsconfig.json
in your project setup?
m
yes
and yes
Copy code
{
  "compilerOptions": {
    "strict": true,
    "outDir": "bin",
    "target": "es2016",
    "module": "commonjs",
    "moduleResolution": "node",
    "sourceMap": true,
    "experimentalDecorators": true,
    "pretty": true,
    "noFallthroughCasesInSwitch": true,
    "noImplicitReturns": true,
    "forceConsistentCasingInFileNames": true
  },
  "files": [
    "index.ts"
  ]
}
Copy code
name: github-testing
runtime: nodejs
description: testing for github-pulumi
Should it be es2017?
w
This seems to be an issue with
@ibrasho/pulumi-github
. That library appears to be published as a
.ts
library, but neither Pulumi nor Node.js generally try to compile
.ts
files for things in
node_modules
- in general libraries published to NPM should be vanilla
.js
files capable of being used by any NodeJS environment.
👀 1
m
Do you have any ideas for what I can do to get past this roadblock? Should I download directly from git and import * as github from directory/to/sdk ?
I tried
import * as github from './modules/pulumi-github/sdk/nodejs/index';
but I get
Copy code
Diagnostics:
  pulumi:providers:github (provider-config):
    error: no resource plugin 'github' found in the workspace or on your $PATH
w
I believe that
import * as gh from "@ibrasho/pulumi-github/bin"
will work. It looks like the author of that library published the wrong folder. The
bin
sub-folder is the root of what should have been published to NPM.
😎 1
m
hmm I get this
Copy code
Diagnostics:
  pulumi:providers:github (default_0_1_0):
    error: no resource plugin 'github-v0.1.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource github v0.1.0`
I think we're making some progress though
is there a file that you'd like me to paste here? It looks like the bin/ folder has the
.js
files correctly as far as I can tell (when I ctrl-click on the import location)
w
So - stepping back - this is a 3rd party library that appears to have been published - but isn't really set up or documented to be used easily. I believe I can show you how to get it working - but there may be other issues I won't be able to answer. @broad-dog-22463 has been working with folks managing 3rd party providers to help them make sure these are published in an easier to use way - but it doesn't look like we've done that with this particular library yet. As to the specific question - you will need to get the provider plugin binary - but the author here does not appear to have published that anywhere - so you will need to clone the repo and build it yourself (with Go). Then put the resulting
pulumi-provider-github
binary on your
PATH
and things will work.
😁 1
m
thank you so much!! now I understand. I will try to get it to work
Copy code
go: extracting <http://google.golang.org/api|google.golang.org/api> v0.5.0
go install -ldflags "-X <http://github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty|github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty>" <http://github.com/ibrasho/pulumi-github/cmd/pulumi-resource-github|github.com/ibrasho/pulumi-github/cmd/pulumi-resource-github>
for LANGUAGE in "nodejs" "python" "go" ; do \
        pulumi-tfgen-github $LANGUAGE --overlays overlays/$LANGUAGE/ --out sdk/$LANGUAGE/ || exit 3 ; \
done
/bin/bash: line 1: pulumi-tfgen-github: command not found
make: *** [Makefile:45: build] Error 3
I get a
error: can not parse version string "0.1.0+dirty"
when I run make. do I need to do something with git or the version number to get it to build?
ah it's probably because ~/go/bin isn't in my path.
ok I got a 39mb
Copy code
./pulumi-resource-github: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=uLUS7kOrqy1erBXjphqJ/A-fdpVPSQax-P8c9gAtO/y2TQd7XArlQe6qhuZfM3/XLuMcKoW2Is2f1LqPCbo, not stripped
ok so after I renamed it
Copy code
~/d/d/github-testing (master|✚1…) $ /home/xk/.pulumi/bin/pulumi up
Previewing update (github-testing):

     Type                        Name                           Plan       Info
 +   pulumi:pulumi:Stack         github-testing-github-testing  create     
     └─ pulumi:providers:github  default_0_1_0                             1 error
 
Diagnostics:
  pulumi:providers:github (default_0_1_0):
    error: no resource plugin 'github-v0.1.0' found in the workspace or on your $PATH, install the plugin using `pulumi plugin install resource github v0.1.0`
 

AFTER RENAMING ----------------------------------------

~/d/d/github-testing (master|✚1…) $ /home/xk/.pulumi/bin/pulumi up
Previewing update (github-testing):

     Type                        Name                           Plan       Info
 +   pulumi:pulumi:Stack         github-testing-github-testing  create     
     └─ pulumi:providers:github  provider-config                           1 error
 
Diagnostics:
  pulumi:providers:github (provider-config):
    error: no resource plugin 'github' found in the workspace or on your $PATH
Copy code
provider-config
???
w
provider-config
appears to be the name of the resource are you are trying to create. The error message is the same one as before - you do not have a
pulumi-resource-github
binary on your path.
1
m
oh I think I made a mistake? For some reason make outputted a binary to /opt/pulumi I thought this binary was
pulumi-provider-github
but it was
pulumi-resource-github
?? I renamed it to
pulumi-provider-github
and put it into ~/go/bin/
now I'm getting a really strange error. even though I never moved or renamed the tfgen folder, main.go, or binary.
Copy code
BUILD:
go install -ldflags "-X <http://github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty|github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty>" <http://github.com/ibrasho/pulumi-github/cmd/pulumi-tfgen-github|github.com/ibrasho/pulumi-github/cmd/pulumi-tfgen-github>
go install -ldflags "-X <http://github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty|github.com/ibrasho/pulumi-github/pkg/version.Version=0.1.0+dirty>" <http://github.com/ibrasho/pulumi-github/cmd/pulumi-resource-github|github.com/ibrasho/pulumi-github/cmd/pulumi-resource-github>
for LANGUAGE in "nodejs" ; do \
        pulumi-tfgen-github $LANGUAGE --overlays overlays/$LANGUAGE/ --out sdk/$LANGUAGE/ || exit 3 ; \
done
/bin/bash: line 1: pulumi-tfgen-github: command not found
before it was working 😕
I'm going to start over I guess
ok looks like it's working. it was a little bit confusing getting bash and fish to both have the go path configured correctly
🤩 1
will the same executable work on windows?
Copy code
./pulumi-resource-github: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, Go BuildID=uLUS7kOrqy1erBXjphqJ/A-fdpVPSQax-P8c9gAtO/y2TQd7XArlQe6qhuZfM3/XLuMcKoW2Is2f1LqPCbo, not stripped
if not, how do I compile a windows version ?
w
export GOOS=windows
👍 1