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

Get rid of VERSION file. #4741

Open
bwplotka opened this issue Oct 6, 2021 · 9 comments
Open

Get rid of VERSION file. #4741

bwplotka opened this issue Oct 6, 2021 · 9 comments

Comments

@bwplotka
Copy link
Member

bwplotka commented Oct 6, 2021

In order to do so we need to:

  • Fix promu to handle this case automatically (take correct tag and if in main take tag +1 -dev
  • Move out of promu to go-releaser or something (we already discussed this)

cc @simonpasquier

@bwplotka
Copy link
Member Author

bwplotka commented Oct 6, 2021

Related conversation: #4738 (comment)

@stale
Copy link

stale bot commented Jan 9, 2022

Hello 👋 Looks like there was no activity on this issue for the last two months.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Jan 9, 2022
@stale
Copy link

stale bot commented Mar 2, 2022

Closing for now as promised, let us know if you need this to be reopened! 🤗

@stale stale bot closed this as completed Mar 2, 2022
@matej-g matej-g reopened this Mar 3, 2022
@stale stale bot removed the stale label Mar 3, 2022
@bisakhmondal
Copy link
Contributor

I can make the changes. Just to be sure,

  • I took a look at promu findVersion function which actually doesn't return the current version when I run into my CLI ( ref )
  • same is true fir go-releaser

It is generated by git describe --dirty --always --tags, the format will be {Tag}-$N-{CommitSHA}

🔥➜ thanos git:(main) git describe --tags $(git rev-list --tags --max-count=1)

v0.25.1
🔥➜ thanos git:(main) git describe --tags  --always --dirty                    

v0.24.0-137-g3026e58f

I am thinking about using git describe --tags $(git rev-list --tags --max-count=1) from makefile and dump with output in (tag+1-dev) into the VERSION file. after promu build, we can delete it from the makefile. How does it sound? Thank you

cc @matej-g

@matej-g
Copy link
Collaborator

matej-g commented Mar 14, 2022

I am thinking about using git describe --tags $(git rev-list --tags --max-count=1) from makefile and dump with output in (tag+1-dev) into the VERSION file. after promu build, we can delete it from the makefile. How does it sound? Thank you

Maybe I'm missing something here, why do we want to dump it into VERSION file?

@bisakhmondal
Copy link
Contributor

bisakhmondal commented Mar 14, 2022

Hi @matej-g, thanks for the reply. Actually, I was not sure How the VERSION file works in promu. So I looked up into the repository .promu.yml and it looks kinda promu injects the Version through go text/template ( -X github.com/prometheus/common/version.Version={{.Version}}).

From a quick glance to the promu source code, they use the following snippet to fetch the version of the repository.

func findVersion() (string, error) {
	for _, file := range []string{"VERSION", "version/VERSION"} {
		b, err := ioutil.ReadFile(file)
		if err != nil {
			continue
		}
		return strings.Trim(string(b), "\n\r "), nil
	}

	return strings.TrimPrefix(shellOutput("git", "describe", "--tags", "--always", "--dirty"), "v"), nil
}

ref1: https://github.com/prometheus/promu/blob/b1a2edae78614c8b0ae9e2faa88d14098e96f6d2/pkg/repository/info.go#L149-L159
ref2: https://github.com/prometheus/promu/blob/b1a2edae78614c8b0ae9e2faa88d14098e96f6d2/pkg/repository/info.go#L117

As evident from the snippet, it tries to run git describe --tags --always --dirty to capture the version in the absence of a VERSION file. But it returns old dirty tags (my last comment). The same is true for go-releaser (https://goreleaser.com/customization/templates/#fn:5)

So I was thinking if we get rid of the VERSION file, we need some way to provide the actual version and do the increment through some automated snippets because the default way is not sufficient. That was my preliminary research, it seems I am definitely missing a lot of things : ) Could you please help me clarifying how we are expecting to get rid of the manual versioning? As clearly, I don't have the full context here. Thank you.

@bwplotka
Copy link
Member Author

bwplotka commented Mar 16, 2022

Thanks for checking this! I think all you said makes sense, so it's a matter of either:

A) Sticking to #2028 when doing releases. This will make promu to work as intended IMO. The reason why it does not work now is that we never merge tags back to main (we merge release changes but not tag). See #2028
B) Contributing to promu to configure how promu finds version if we are not happy
C) Moving to go-release

@stale
Copy link

stale bot commented Jun 12, 2022

Hello 👋 Looks like there was no activity on this issue for the last two months.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Jun 12, 2022
@matej-g matej-g removed the stale label Jun 13, 2022
@stale
Copy link

stale bot commented Aug 13, 2022

Hello 👋 Looks like there was no activity on this issue for the last two months.
Do you mind updating us on the status? Is this still reproducible or needed? If yes, just comment on this PR or push a commit. Thanks! 🤗
If there will be no activity in the next two weeks, this issue will be closed (we can always reopen an issue if we need!). Alternatively, use remind command if you wish to be reminded at some point in future.

@stale stale bot added the stale label Aug 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants