When using upgrade-provider (local and actions), ...
# package-authoring
b
When using upgrade-provider (local and actions), I get this error. Does anyone know why?
Copy code
--- Tfgen & Build SDKs --- 
  - go: /opt/homebrew/bin/go mod tidy
 -> go: /opt/homebrew/bin/go mod tidy
--- failed ---
error: exit status 1:
go: go.mod file not found in current directory or any parent directory; see 'go help modules'
Here is my command
Copy code
upgrade-provider foo/pulumi-foo --upstream-provider-name terraform-provider-foo --upstream-provider-org foo --kind provider
a
Are you calling upgrade-provider from the root of the provider? Did you use a template when creating the provider?
b
Yes, I'm calling from the root of the provider. I used the cookiecutter repo to create the provider,
a
do you have a gowork file? try moving it out and see if that helps
You can also try with
GOWORK=off
b
I do have a gowork file. Let me try that
That didn't work
a
Hm, can you share a repo so I can have a look? How are you running upgrade-provider?
b
Unfortunately, it's internal to my org and I cannot change the visibility. on the repo I'm using the upgrade-provider action
a
Can you then share the folder structure, list of files and the exact command you are using to invoke upgrade-provider?
b
tree -L 2 -a .
Copy code
.
├── .devcontainer
│   ├── Dockerfile
│   └── devcontainer.json
├── .git
│   ├── COMMIT_EDITMSG
│   ├── FETCH_HEAD
│   ├── HEAD
│   ├── ORIG_HEAD
│   ├── config
│   ├── description
│   ├── hooks
│   ├── index
│   ├── info
│   ├── logs
│   ├── objects
│   ├── packed-refs
│   └── refs
├── .github
│   └── workflows
├── .gitignore
├── .golangci.yml
├── .goreleaser.yml
├── .upgrade-config.yaml
├── CHANGELOG.md
├── CODE-OF-CONDUCT.md
├── CONTRIBUTING.md
├── COPYRIGHT
├── LICENSE
├── Makefile
├── README-DEVELOPMENT.md
├── README.md
├── bin
│   └── pulumi-tfgen-crowdstrike
├── docs
│   ├── _index.md
│   ├── crowdstrike.png
│   └── installation-configuration.md
├── examples
│   └── .gitkeep
├── go.work
├── go.work.sum
├── provider
│   ├── cmd
│   ├── go.mod
│   ├── go.sum
│   ├── pkg
│   ├── resources.go
│   └── shim
└── sdk
    ├── dotnet
    ├── go
    ├── go.mod
    ├── go.sum
    ├── nodejs
    └── python
upgrade-provider gtheodorio/pulumi-crowdstrike --upstream-provider-name terraform-provider-crowdstrike --upstream-provider-org crowdstrike --kind provider
a
What is in .upgrade-config.yaml?
b
Copy code
upstream-provider-name: terraform-provider-crowdstrike
upstream-provider-org: crowdstrike
allow-missing-docs: true
a
Can you try running
go run <http://github.com/pulumi/upgrade-provider@main|github.com/pulumi/upgrade-provider@main> gtheodorio/pulumi-crowdstrike --kind=provider
from the root folder?
b
Copy code
--- Set Up Environment --- 
  - GOWORK=off
  - PULUMI_MISSING_DOCS_ERROR=false
  - PULUMI_EXTRA_MAPPING_ERROR=true
--- done ---
--- Discover Provider --- 
--- Discover Provider --- 
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
      - Stat
    - Validate Repository
      - git: /usr/bin/git status --short
  - Pull Default Branch
    - git: /usr/bin/git ls-remote --heads origin
    - Find default Branch: main
    - git: /usr/bin/git fetch
    - git: /usr/bin/git checkout main
    - git: /usr/bin/git pull origin
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
      - Stat
    - Validate Repository
      - git: /usr/bin/git status --short
  - Pull Default Branch
    - git: /usr/bin/git ls-remote --heads origin
    - Find default Branch: main
    - git: /usr/bin/git fetch
    - git: /usr/bin/git checkout main
    - git: /usr/bin/git pull origin
--- Discover Provider --- 
  - Ensure Upstream Repo
    - Expected Location: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
      - GetCwd: /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike
    - Repo Exists
      - Stat
    - Validate Repository
      - git: /usr/bin/git status --short
  - Pull Default Branch
    - git: /usr/bin/git ls-remote --heads origin
    - Find default Branch: main
    - git: /usr/bin/git fetch
    - git: /usr/bin/git checkout main
    - git: /usr/bin/git pull origin
  - Get Repo Kind
    - /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike/provider/go.mod: 13410 bytes read
    - Stat
    - Stat
    - /Users/gtheodorio/Documents/01_projects/pulumi_crowdstrike/gtheodorio-org/pulumi-crowdstrike/provider/shim/go.mod: 2358 bytes read
  - Plan Provider Upgrade: 0.0.4 -> 0.0.6
    - Get Expected Target
      - From Upstream Releases
        - gh: /opt/homebrew/bin/gh release list --repo=crowdstrike/terraform-provider-crowdstrike --exclude-drafts --exclude-pre-releases
    - Set Current Upstream From Shimmed
      - Original Go Version of
        - git: /usr/bin/git show main:provider/shim/go.mod
--- done ---
--- Plan Upgrade --- 
--- done ---
--- Planning Java Gen Version Update --- 
  - Fetching latest Java Gen: 0.13.0
    - Latest Release Version: of pulumi/pulumi-java: 0.13.0
      - gh: /opt/homebrew/bin/gh repo view pulumi/pulumi-java --json=latestRelease
    - Stat
    - Upgrading Java Gen Version: 0.0.0 -> 0.13.0
--- done ---
--- Setup working branch --- 
  - Working Branch Name: upgrade-terraform-provider-crowdstrike-to-v0.0.6
    - GetEnv: CI=
  - Ensure Branch
    - git: /usr/bin/git branch
    - git: /usr/bin/git checkout -b upgrade-terraform-provider-crowdstrike-to-v0.0.6
  - Has Remote Branch: no
    - gh: /opt/homebrew/bin/gh pr list --json=title,headRefName
--- done ---
---- Update Repository ----
- Update TF Provider
--- shim --- 
  - git refs of
    - git: /usr/bin/git ls-remote --tags <https://github.com/crowdstrike/terraform-provider-crowdstrike>
--- done ---
  - ✓ Lookup Tag SHA: 3eeccbf7215382eb6a83810be87864098c60928b
  - ✓ /opt/homebrew/bin/go get <http://github.com/crowdstrike/terraform-provider-crowdstrike@3|github.com/crowdstrike/terraform-provider-crowdstrike@3>...: done
  - ✓ /opt/homebrew/bin/go mod tidy: done
--- Tfgen & Build SDKs --- 
  - go: /opt/homebrew/bin/go mod tidy
 -> go: /opt/homebrew/bin/go mod tidy
--- failed ---
error: exit status 1:
go: go.mod file not found in current directory or any parent directory; see 'go help modules'

exit status 1
Same error
a
ah, can you try making putting something in the examples folder - I think upgrade-provider assumes there's an example there
a example_test.go with an empty test should work
and add a go.mod there
b
in the example folder?
a
yeah, sorry
b
Okay. Let me try.
🙌 1
That seems to have worked.
🙌 2
How did you deduce that?
a
I looked up the last log message in the source file and saw where go mod tidy is invoked: https://github.com/pulumi/upgrade-provider/blob/be42ee88d77cb2e1154187cac2fefcb682d6ca12/upgrade/upgrade_provider.go#L336
Glad it worked!
1
LMK if you need any more help here.
♥️ 1
b
Ah. Thank you so much!
a
b
Running into another issue. Apparently the go version used by the upgrade-provider action is 1.21... whereas my provider requires 1.22. How do you suggest I go about this?
not upgrade-provider
I think you might have specified the wrong go version when instantiating the template
Feel free to replace it in the makefile and release.yaml file