Skip to content
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

prepare-release command does nothing #883

Closed
clyvari opened this issue Jan 6, 2023 · 5 comments · Fixed by #885
Closed

prepare-release command does nothing #883

clyvari opened this issue Jan 6, 2023 · 5 comments · Fixed by #885
Assignees

Comments

@clyvari
Copy link
Contributor

clyvari commented Jan 6, 2023

UPDATE: I found out, it was because of uncommited changes in the repo. See my reply below

Hello,

I must be doing something wrong, or maybe I missed something in the docs.
But still, I can't use NBGV because nbgv.exe prepare-release doesn't do anything.

I've followed the Using the nbgv .NET Core CLI tool guide. Appreciate all the help I can get.

I'm trying to use the tool in an existing repo. So, command by command, here it is:

$ git --version
git version 2.34.1.windows.1

$ dotnet --list-sdks
1.0.0-preview2-003121 [C:\Program Files\dotnet\sdk]
1.0.4 [C:\Program Files\dotnet\sdk]
2.0.3 [C:\Program Files\dotnet\sdk]
3.1.426 [C:\Program Files\dotnet\sdk]
5.0.214 [C:\Program Files\dotnet\sdk]
5.0.303 [C:\Program Files\dotnet\sdk]
5.0.408 [C:\Program Files\dotnet\sdk]
6.0.307 [C:\Program Files\dotnet\sdk]
7.0.100 [C:\Program Files\dotnet\sdk]
$ dotnet tool install --tool-path . nbgv
You can invoke the tool using the following command: nbgv
Tool 'nbgv' (version '3.5.119') was successfully installed.
$ nbgv install -s https://api.nuget.org/v3/index.json

$ git status
On branch master
Your branch is up to date with 'origin/master'.

Changes to be committed:
  (use "git restore --staged <file>..." to unstage)
        new file:   Directory.Build.props
        new file:   version.json

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .store/
        nbgv.exe
$ type version.json
{
  "$schema": "https://raw.githubusercontent.com/dotnet/Nerdbank.GitVersioning/master/src/NerdBank.GitVersioning/version.schema.json",
  "version": "1.0-beta",
  "publicReleaseRefSpec": [
    "^refs/heads/master$",
    "^refs/heads/v\\d+(?:\\.\\d+)?$"
  ],
  "cloudBuild": {
    "buildNumber": {
      "enabled": true
    }
  }
}
$ git commit -m "add nbgv"
...
$ nbgv get-version
Version:                      1.0.1.56901
AssemblyVersion:              1.0.0.0
AssemblyInformationalVersion: 1.0.1-beta+de45e694b5
NuGetPackageVersion:          1.0.1-beta
NpmPackageVersion:            1.0.1-beta

$ dotnet pack
...
Successfully created package 'C:\...\PROJECT.1.0.1-beta.nupkg'.

Now the interesting part:

$ nbgv prepare-release
Uncommitted changes (171) in directory 'C:\...\':
- .python/.../ changed with FileStatus Ignored
...
...
- .store/nbgv/3.5.119/nbgv/3.5.119/.nupkg.metadata changed with FileStatus NewInWorkdir
...
...
- PROJECT/bin/ changed with FileStatus Ignored
- PROJECT/obj/ changed with FileStatus Ignored
- nbgv.exe changed with FileStatus NewInWorkdir
$ git status
On branch master
Your branch is ahead of 'origin/master' by 1 commit.
  (use "git push" to publish your local commits)

Untracked files:
  (use "git add <file>..." to include in what will be committed)
        .store/
        nbgv.exe

nothing added to commit but untracked files present (use "git add" to track)
$ git branch
  xxx
  yyy
  develop
* master

$ git branch --remote
  origin/HEAD -> origin/develop
  origin/xxx
  origin/yyy
  origin/master

$ git log --oneline
de45e69 (HEAD -> master) add nbgv

As you can see:

  • No branch is created
  • version.json is not modified
  • no commit is created

Even if I add a release configuration:

$ git diff
diff --git a/version.json b/version.json
index 50edde2..5b179fb 100644
--- a/version.json
+++ b/version.json
@@ -5,9 +5,14 @@
     "^refs/heads/master$",
     "^refs/heads/v\\d+(?:\\.\\d+)?$"
   ],
+  "release": {
+    "branchName" : "release/v{version}",
+    "versionIncrement" : "minor",
+    "firstUnstableTag" : "alpha"
+  },
   "cloudBuild": {
     "buildNumber": {
       "enabled": true
     }
   }

$ git add version.json

$ git commit -m "add release info"
...

Then I do another nbgv prepare-release, it's the same result... I've also tried other options, such as nbgv prepare-release TAG, nbgv prepare-release --versionIncrement minor ... with no success.

What am I doing wrong ?

Thanks !

@clyvari
Copy link
Contributor Author

clyvari commented Jan 6, 2023

So it turns out having uncommited changes at all in the repo is a nogo.

I was tricked having no errors displayed, and by the options to install NBGV in the current folder, which in my environment turned out to be the root of my git directory.

The tip was actually error code 13 (which for some reason I didn't check before), looking at the source code, we have then an explanation.

How would you feel about having some error logging in the console ? I think it's something I can contribute.

@AArnott
Copy link
Collaborator

AArnott commented Jan 6, 2023

I see in the prepare-release output from your issue description:

Uncommitted changes (171) in directory 'C:...':

Are you looking for something more noticeable? Or is the problem that that didn't look like a fatal error when it in fact was?
I appreciate your offer to contribute. I'd welcome that. Can you let me know what you have in mind here first so we can review your proposal?

@clyvari
Copy link
Contributor Author

clyvari commented Jan 7, 2023 via email

@AArnott
Copy link
Collaborator

AArnott commented Jan 7, 2023

Sounds good to me.

@clyvari
Copy link
Contributor Author

clyvari commented Jan 10, 2023

I think I'm done with the PR.
The scope is much less than I anticipated: I did not find another instance of a missing / ambiguous error.

So my initial idea of requiring to throw with an error message in case of an error, then formatting it as an error in a central part of nbgv would have caused a lot of change and added some bit of complexity for what I now think would be very little value.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants