GithubHelp home page GithubHelp logo

Comments (15)

tomasbjerre avatar tomasbjerre commented on June 9, 2024

It can now give you the most recent tag matching a semantic version.

You can construct a changelog between that tag and HEAD.

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

Is there any way to not use semantic versioning for this request? I'm building an AMI build pipeline that I'd like to use something else (like the release date) as version. But I'd have to look back to either the most recent tag, or most recent tag named "release" or something.

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

If you just want the most recent tag, perhaps this works? https://gist.github.com/rponte/fdc0724dd984088606b0

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

Am not having luck with 3.19 and getting tags. Is there a trick to what it's looking for?

I pushed a tag to the remote:
commit 069953e545e417cf89f5478dfcd5599e43e07500 (tag: 2022-02-11, tag: 1.0.0)
Author: Alan Sparks [email protected]
Date: Thu Feb 10 15:18:49 2022 -0700

Added this to a pipeline step:
def highestVersion = getHighestSemanticVersion()
currentVersion = highestVersion.findTag().orElse("")
println(" Git tag:" + currentVersion.toString())

But the printed value is empty.

Also had to add script approvals for se.bjurr.gitchangelog.internal.semantic.SemanticVersion findTag and for orElse().
-Alan

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

Are you sure Jenkins is fetching the tags?

This is why I like to use the command line tool:
https://github.com/tomasbjerre/git-changelog-command-line#example---semantic-versioning-from-conventional-commits

Easier to fiddle with locally.

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

I'm seeing this in the Jenkins build log, I thought --tags would be including the tags. I was wanting to avoid installing NPM stuff on the server just for debugging...

11:04:40 > git fetch --tags --progress --prune -- [email protected]:CCoE/chglog.git +refs/heads/master:refs/remotes/origin/master # timeout=10
11:04:40 Checking out Revision 026ea085cf74bf

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

I ment you can use the command line locally. It uses the same code.

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

So, I'm a little lost. If I run "git tag", I get:
$ git tag
1.0.0
2022-02-11
release

If I run your utility, I get:
$ npx git-changelog-command-line --print-highest-version-tag
Exception in thread "main" java.util.NoSuchElementException: No value present
at java.base/java.util.Optional.get(Optional.java:148)
at se.bjurr.gitchangelog.main.Main.main(Main.java:746)

I see 1.0.0 there on the remote. Is the code looking for a tag format in particular?
-Alan

EDIT: I see - the tag has to be of format: vx.x.x.

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

Do you have just a few commits in the repo? A shallow clone maby? Is the tag on the first commit in the repo?
I actually found a bug here, perhaps same as you are experiencing.

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

I still can't figure out how to get what I need here. It's not making sense to me.

I have a branch, with a git log including:
`commit 482fea9011c61dc2d05a08260d3a328c3df1acdf (HEAD -> chglog, origin/chglog)
Author: Alan Sparks [email protected]
Date: Fri Jul 15 12:33:08 2022 -0600

remove PDSC-polkit

commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
Merge: 0f0f225 56065b3
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:11:01 2022 -0600

Upgrade to Packer 1.7

commit 0f0f2259a6501377d811ee1b5c122e25fc139389
Merge: ed7b1d3 82f2b5e
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:07:59 2022 -0600

Merge branch 'chglog' of gitlab.devops.ss.saas.microfocus.com:ami/foundation/amazon-2 into chglog

commit 56065b331d9fe444e71f215ec075e5036b8980cc (tag: 20220413)
Author: Alan Sparks [email protected]
sparksa@ubuntu1:~/glab/ami/foundation/amazon-2$ git log|cat
commit 482fea9011c61dc2d05a08260d3a328c3df1acdf
Author: Alan Sparks [email protected]
Date: Fri Jul 15 12:33:08 2022 -0600

remove PDSC-polkit

commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
Merge: 0f0f225 56065b3
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:11:01 2022 -0600

Upgrade to Packer 1.7

`

So I've tried all the combinations of commits and refs I can think of, and the command line version keeps adding way more than between the HEAD and the tag or commit I'm trying to stop at (tag: 20220413, commit 56065b331d9fe444e71f215ec075e5036b8980cc):

`npx git-changelog-command-line --from-commit 56065b331d9fe444e71f215ec075e5036b8980cc --to-commit HEAD -std --template template.txt

  • remove PDSC-polkit

    -- Alan Sparks 2022-07-15 18:33:08

  • Upgrade to Packer 1.7

    -- Alan Sparks 2022-04-13 19:11:01

  • Merge branch 'chglog' of gitlab.devops.ss.saas.microfocus.com:ami/foundation/amazon-2 into chglog

    -- Alan Sparks 2022-04-13 19:07:59

  • source ami filter in AMIspec

    -- Alan Sparks 2022-04-13 18:59:20

  • packer version and template update

    -- Alan Sparks 2022-04-13 18:59:20

  • duplicate source_ami def

    -- Alan Sparks 2022-04-13 18:59:20

  • fix name tag

    -- Alan Sparks 2022-04-13 18:59:20

  • add override to template

    -- Alan Sparks 2022-04-13 18:59:20

  • fix name tag

    -- Alan Sparks 2022-03-16 22:09:41

  • duplicate source_ami def

    -- Alan Sparks 2022-03-16 19:41:01

  • packer version and template update

    -- Alan Sparks 2022-03-16 19:38:18

  • add override to template

    -- Alan Sparks 2022-03-04 23:07:05

  • source ami filter in AMIspec

    -- Alan Sparks 2022-03-04 22:23:45
    `

It's even stranger to me that it picks it's own place in the log to stop, that 3/4 date isn't the first commit.
Is there a bug here? Is there no way to get the changes between HEAD and the most recent tag ref?
-Alan

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

It would be easier to understand your use case if you supplied a graph like:
git log --oneline --graph

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

The full graph, as in previous comment, and also the template being used would help understand this.

I made a test in this repo:

git clone [email protected]:tomasbjerre/git-changelog-lib.git
git checkout ba9d565
git log --oneline --graph 
* ba9d565 (HEAD) More settings can be set from command line
* 3950c64 [Gradle Release Plugin] - new version commit:  '1.1-SNAPSHOT'.
* 01484ce (tag: 1.0) [Gradle Release Plugin] - pre tag commit:  '1.0'.
* 83a8a7b Doc
* 5c54861 Test
* 051effe Work for 1.0
* 5aaeb90 Initial commit
* a1aa5ff (tag: 0.0.1) Initial commit
npx git-changelog-command-line --to-commit 01484ce -std  -tec "
{{#commits}}
  {{hash}}
{{/commits}}
"

  01484ce71bbc76e
  83a8a7b2f96ba88
  5c54861708099d9
  051effe72405e78
  5aaeb907f68915a
  a1aa5ff5b625e63
npx git-changelog-command-line --to-commit HEAD -std  -tec "
{{#commits}}
  {{hash}}
{{/commits}}
"

  ba9d565ddd15d1b
  3950c640e41f436
  01484ce71bbc76e
  83a8a7b2f96ba88
  5c54861708099d9
  051effe72405e78
  5aaeb907f68915a
  a1aa5ff5b625e63
npx git-changelog-command-line --from-commit 01484ce --to-commit HEAD -std   -tec "
{{#commits}}
  {{hash}}
{{/commits}}
"

  ba9d565ddd15d1b
  3950c640e41f436

from git-changelog-plugin.

webminster avatar webminster commented on June 9, 2024

OK, let me give something concrete. Maybe you can correct my understanding.

I have a git history like:

===============================================================
commit 482fea9011c61dc2d05a08260d3a328c3df1acdf (HEAD -> chglog, origin/chglog)
Author: Alan Sparks [email protected]
Date: Fri Jul 15 12:33:08 2022 -0600

remove PDSC-polkit

commit e482f40ba45fab3ecfc5b2d818d235be637e0fdb
Merge: 0f0f225 56065b3
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:11:01 2022 -0600

Upgrade to Packer 1.7

commit 0f0f2259a6501377d811ee1b5c122e25fc139389
Merge: ed7b1d3 82f2b5e
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:07:59 2022 -0600

Merge branch 'chglog' of gitlab.devops.ss.saas.microfocus.com:ami/foundation/amazon-2 into chglog

commit 56065b331d9fe444e71f215ec075e5036b8980cc (tag: 20220413)
Author: Alan Sparks [email protected]
Date: Wed Apr 13 13:07:13 2022 -0600

Add source AMI override/filter

=========================================================

and the git online requested looks like:

=========================================================

  • 482fea9 (HEAD -> chglog, origin/chglog) remove PDSC-polkit
  • e482f40 Upgrade to Packer 1.7
    |
    | * 56065b3 (tag: 20220413) Add source AMI override/filter
  • | 0f0f225 Merge branch 'chglog' of gitlab.devops.ss.saas.microfocus.com:ami/foundation/amazon-2 into chglog
    |\
    | * | 82f2b5e fix name tag
    | * | 8d1eda1 duplicate source_ami def
    | * | 8fa5efc packer version and template update
    | * | 14f9128 add override to template
    | * | ab74319 source ami filter in AMIspec
    | |/
    | * eab734b Changes to support CTP and SRE
  • | ed7b1d3 fix name tag
  • | 866121a duplicate source_ami def
  • | 891ffc1 packer version and template update
  • | 6fa9252 add override to template
  • | 7897ca9 source ami filter in AMIspec
    |/
  • 5f553d6 Reset cloud-init data
  • 884e34c (origin/development) Remove polkit per CVE-2021-4034

===============================================================

What I'm trying to do is get a changelog between the HEAD and to the tagged (20220413, commit 56065b331d9fe444e71f215ec075e5036b8980cc) on that branch. but I seem to keep going back farther, to commit 7897ca98ea38b16feb40d36cf70e61861580a55e.

Am I being stupid because there's a merge in there?
-Alan

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

This is intended. 7897ca9 is in the parents of HEAD and not in the parents of 20220413.

from git-changelog-plugin.

tomasbjerre avatar tomasbjerre commented on June 9, 2024

Perhaps this helps:
#84 (comment)

from git-changelog-plugin.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.