diff --git a/Makefile b/Makefile index cb8dcb8e7..e075db6fa 100644 --- a/Makefile +++ b/Makefile @@ -44,7 +44,7 @@ export ######################################## ############# BUILD TARGETS ############ ######################################## -.PHONY: components component-binaries cmd/smithyctl/bin protos build publish-component-containers publish-containers smithyctl-image smithyctl-image-publish clean-protos clean +.PHONY: components component-binaries cmd/smithyctl/bin cmd/changelog/bin protos build publish-component-containers publish-containers smithyctl-image smithyctl-image-publish clean-protos clean $(component_binaries): ./scripts/build_component_binary.sh $@ @@ -58,6 +58,11 @@ $(component_containers): %/docker: %/bin components: $(component_containers) +cmd/changelog/bin: + $(eval GOOS:=linux) + $(eval GOARCH:=amd64) + CGO_ENABLED=0 GOOS=$(GOOS) GOARCH=$(GOARCH) go build -C cmd/changelog -o ../../bin/cmd/$(GOOS)/$(GOARCH)/changelog main.go + cmd/smithyctl/bin: $(eval GOOS:=linux) $(eval GOARCH:=amd64) @@ -349,8 +354,11 @@ dep-update-proto: build-buf-container ######################################## ########### RELEASE UTILITIES ########## ######################################## -.PHONY: check-branch check-tag-message patch-release-tag new-minor-release-tag new-major-release-tag - +.PHONY: check-branch check-tag-message patch-release-tag new-minor-release-tag new-major-release-tag install-changelog-tool + +install-changelog-tool: + @go install github.com/smithy-security/smithy/cmd/changelog + check-branch: @if [ $$(git branch --show-current | tr -d '\n') != "main" ]; \ then \ @@ -366,22 +374,14 @@ check-tag-message: fi new-patch-release-tag: SHELL:=/bin/bash -new-patch-release-tag: check-branch check-tag-message - $(shell \ - read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \ - git tag "v$${number[0]}.$${number[1]}.$$(($${number[2]}+1))" -m "${TAG_MESSAGE}"; \ - ) +new-patch-release-tag: check-branch check-tag-message install-changelog-tool + @changelog --current-tag "${SMITHY_VERSION}" -repo-path "." -patch -message "${TAG_MESSAGE}" new-minor-release-tag: SHELL:=/bin/bash -new-minor-release-tag: check-branch check-tag-message - $(shell \ - read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \ - git tag "v$${number[0]}.$$(($${number[1]}+1)).0" -m "${TAG_MESSAGE}"; \ - ) +new-minor-release-tag: check-branch check-tag-message install-changelog-tool + @changelog --current-tag "${SMITHY_VERSION}" -repo-path "." -minor -message "${TAG_MESSAGE}" + new-major-release-tag: SHELL:=/bin/bash -new-major-release-tag: check-branch check-tag-message - $(shell \ - read -a number <<< $$(git tag -l | sort -Vr | head -n 1 | sed -E 's/^v([0-9]+)\.([0-9]+)\.([0-9]+)/\1 \2 \3/'); \ - git tag "v$$(($${number[0]}+1)).0.0" -m "${TAG_MESSAGE}"; \ - ) +new-major-release-tag: check-branch check-tag-message install-changelog-tool + @changelog --current-tag "${SMITHY_VERSION}" -repo-path "." -major -message "${TAG_MESSAGE}" diff --git a/cmd/changelog/README.md b/cmd/changelog/README.md new file mode 100644 index 000000000..2adba0f41 --- /dev/null +++ b/cmd/changelog/README.md @@ -0,0 +1,16 @@ +# Changelog Section Generator + +This binary is pointed to a repository and it generates a changelog based on the commit messages +between the latest tag and HEAD. + +## Use Cases + +### Tag first, then generate Changelog + +If a user tags HEAD first then calls this binary, latest tag will point to the HEAD commit. +If HEAD and latest tag point to the same commit. The binary will produce a changelog for the previous tag and HEAD. + +### Generate Changelog then tag + +The default mode for this project is to run it before you tag a commit. +In this case you need to provide the name of the new tag and the message of the new tag in order to generate a correct changelog entry. diff --git a/cmd/changelog/changelog.tmpl.md b/cmd/changelog/changelog.tmpl.md new file mode 100644 index 000000000..b7d223bfb --- /dev/null +++ b/cmd/changelog/changelog.tmpl.md @@ -0,0 +1,5 @@ +## {{.Tag}} + +**{{.TagMessage}}** + +{{range $val := .Messages}}{{$val.Timestamp}}: {{$val.Message}}{{end}} diff --git a/cmd/changelog/go.mod b/cmd/changelog/go.mod new file mode 100644 index 000000000..8b0c1d968 --- /dev/null +++ b/cmd/changelog/go.mod @@ -0,0 +1,33 @@ +module github.com/smithy-security/smithy/cmd/changelog + +go 1.22.2 + +require ( + github.com/blang/semver v3.5.1+incompatible + github.com/go-errors/errors v1.5.1 + github.com/go-git/go-git/v5 v5.12.0 +) + +require ( + dario.cat/mergo v1.0.0 // indirect + github.com/Microsoft/go-winio v0.6.1 // indirect + github.com/ProtonMail/go-crypto v1.0.0 // indirect + github.com/cloudflare/circl v1.3.7 // indirect + github.com/cyphar/filepath-securejoin v0.2.4 // indirect + github.com/emirpasic/gods v1.18.1 // indirect + github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 // indirect + github.com/go-git/go-billy/v5 v5.5.0 // indirect + github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da // indirect + github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 // indirect + github.com/kevinburke/ssh_config v1.2.0 // indirect + github.com/pjbgf/sha1cd v0.3.0 // indirect + github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 // indirect + github.com/skeema/knownhosts v1.2.2 // indirect + github.com/xanzy/ssh-agent v0.3.3 // indirect + golang.org/x/crypto v0.21.0 // indirect + golang.org/x/mod v0.12.0 // indirect + golang.org/x/net v0.22.0 // indirect + golang.org/x/sys v0.18.0 // indirect + golang.org/x/tools v0.13.0 // indirect + gopkg.in/warnings.v0 v0.1.2 // indirect +) diff --git a/cmd/changelog/go.sum b/cmd/changelog/go.sum new file mode 100644 index 000000000..53f20c2ed --- /dev/null +++ b/cmd/changelog/go.sum @@ -0,0 +1,149 @@ +dario.cat/mergo v1.0.0 h1:AGCNq9Evsj31mOgNPcLyXc+4PNABt905YmuqPYYpBWk= +dario.cat/mergo v1.0.0/go.mod h1:uNxQE+84aUszobStD9th8a29P2fMDhsBdgRYvZOxGmk= +github.com/Microsoft/go-winio v0.5.2/go.mod h1:WpS1mjBmmwHBEWmogvA2mj8546UReBk4v8QkMxJ6pZY= +github.com/Microsoft/go-winio v0.6.1 h1:9/kr64B9VUZrLm5YYwbGtUJnMgqWVOdUAXu6Migciow= +github.com/Microsoft/go-winio v0.6.1/go.mod h1:LRdKpFKfdobln8UmuiYcKPot9D2v6svN5+sAH+4kjUM= +github.com/ProtonMail/go-crypto v1.0.0 h1:LRuvITjQWX+WIfr930YHG2HNfjR1uOfyf5vE0kC2U78= +github.com/ProtonMail/go-crypto v1.0.0/go.mod h1:EjAoLdwvbIOoOQr3ihjnSoLZRtE8azugULFRteWMNc0= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be h1:9AeTilPcZAjCFIImctFaOjnTIavg87rW78vTPkQqLI8= +github.com/anmitsu/go-shlex v0.0.0-20200514113438-38f4b401e2be/go.mod h1:ySMOLuWl6zY27l47sB3qLNK6tF2fkHG55UZxx8oIVo4= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= +github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= +github.com/blang/semver v3.5.1+incompatible h1:cQNTCjp13qL8KC3Nbxr/y2Bqb63oX6wdnnjpJbkM4JQ= +github.com/blang/semver v3.5.1+incompatible/go.mod h1:kRBLl5iJ+tD4TcOOxsy/0fnwebNt5EWlYSAyrTnjyyk= +github.com/bwesterb/go-ristretto v1.2.3/go.mod h1:fUIoIZaG73pV5biE2Blr2xEzDoMj7NFEuV9ekS419A0= +github.com/cloudflare/circl v1.3.3/go.mod h1:5XYMA4rFBvNIrhs50XuiBJ15vF2pZn4nnUKZrLbUZFA= +github.com/cloudflare/circl v1.3.7 h1:qlCDlTPz2n9fu58M0Nh1J/JzcFpfgkFHHX3O35r5vcU= +github.com/cloudflare/circl v1.3.7/go.mod h1:sRTcRWXGLrKw6yIGJ+l7amYJFfAXbZG0kBSc8r4zxgA= +github.com/cyphar/filepath-securejoin v0.2.4 h1:Ugdm7cg7i6ZK6x3xDF1oEu1nfkyfH53EtKeQYTC3kyg= +github.com/cyphar/filepath-securejoin v0.2.4/go.mod h1:aPGpWjXOXUn2NCNjFvBE6aRxGGx79pTxQpKOJNYHHl4= +github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c= +github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a h1:mATvB/9r/3gvcejNsXKSkQ6lcIaNec2nyfOdlTBR2lU= +github.com/elazarl/goproxy v0.0.0-20230808193330-2592e75ae04a/go.mod h1:Ro8st/ElPeALwNFlcTpWmkr6IoMFfkjXAvTHpevnDsM= +github.com/emirpasic/gods v1.18.1 h1:FXtiHYKDGKCW2KzwZKx0iC0PQmdlorYgdFG9jPXJ1Bc= +github.com/emirpasic/gods v1.18.1/go.mod h1:8tpGGwCnJ5H4r6BWwaV6OrWmMoPhUl5jm/FMNAnJvWQ= +github.com/gliderlabs/ssh v0.3.7 h1:iV3Bqi942d9huXnzEF2Mt+CY9gLu8DNM4Obd+8bODRE= +github.com/gliderlabs/ssh v0.3.7/go.mod h1:zpHEXBstFnQYtGnB8k8kQLol82umzn/2/snG7alWVD8= +github.com/go-errors/errors v1.5.1 h1:ZwEMSLRCapFLflTpT7NKaAc7ukJ8ZPEjzlxt8rPN8bk= +github.com/go-errors/errors v1.5.1/go.mod h1:sIVyrIiJhuEF+Pj9Ebtd6P/rEYROXFi3BopGUQ5a5Og= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376 h1:+zs/tPmkDkHx3U66DAb0lQFJrpS6731Oaa12ikc+DiI= +github.com/go-git/gcfg v1.5.1-0.20230307220236-3a3c6141e376/go.mod h1:an3vInlBmSxCcxctByoQdvwPiA7DTK7jaaFDBTtu0ic= +github.com/go-git/go-billy/v5 v5.5.0 h1:yEY4yhzCDuMGSv83oGxiBotRzhwhNr8VZyphhiu+mTU= +github.com/go-git/go-billy/v5 v5.5.0/go.mod h1:hmexnoNsr2SJU1Ju67OaNz5ASJY3+sHgFRpCtpDCKow= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399 h1:eMje31YglSBqCdIqdhKBW8lokaMrL3uTkpGYlE2OOT4= +github.com/go-git/go-git-fixtures/v4 v4.3.2-0.20231010084843-55a94097c399/go.mod h1:1OCfN199q1Jm3HZlxleg+Dw/mwps2Wbk9frAWm+4FII= +github.com/go-git/go-git/v5 v5.12.0 h1:7Md+ndsjrzZxbddRDZjF14qK+NN56sy6wkqaVrjZtys= +github.com/go-git/go-git/v5 v5.12.0/go.mod h1:FTM9VKtnI2m65hNI/TenDDDnUf2Q9FHnXYjuz9i5OEY= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da h1:oI5xCqsCo564l8iNU+DwB5epxmsaqB+rhGL0m5jtYqE= +github.com/golang/groupcache v0.0.0-20210331224755-41bb18bfe9da/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc= +github.com/google/go-cmp v0.6.0 h1:ofyhxvXcZhMsU5ulbFiLKl/XBFqE1GSq7atu8tAmTRI= +github.com/google/go-cmp v0.6.0/go.mod h1:17dUlkBOakJ0+DkrSSNjCkIjxS6bF9zb3elmeNGIjoY= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99 h1:BQSFePA1RWJOlocH6Fxy8MmwDt+yVQYULKfN0RoTN8A= +github.com/jbenet/go-context v0.0.0-20150711004518-d14ea06fba99/go.mod h1:1lJo3i6rXxKeerYnT8Nvf0QmHCRC1n8sfWVwXF2Frvo= +github.com/kevinburke/ssh_config v1.2.0 h1:x584FjTGwHzMwvHx18PXxbBVzfnxogHaAReU4gf13a4= +github.com/kevinburke/ssh_config v1.2.0/go.mod h1:CT57kijsi8u/K/BOFA39wgDQJ9CxiF4nAY/ojJ6r6mM= +github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= +github.com/kr/pretty v0.3.1 h1:flRD4NNwYAUpkphVc1HcthR4KEIFJ65n8Mw5qdRn3LE= +github.com/kr/pretty v0.3.1/go.mod h1:hoEshYVHaxMs3cyo3Yncou5ZscifuDolrwPKZanG3xk= +github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ= +github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI= +github.com/kr/text v0.2.0 h1:5Nx0Ya0ZqY2ygV366QzturHI13Jq95ApcVaJBhpS+AY= +github.com/kr/text v0.2.0/go.mod h1:eLer722TekiGuMkidMxC/pM04lWEeraHUUmBw8l2grE= +github.com/onsi/gomega v1.27.10 h1:naR28SdDFlqrG6kScpT8VWpu1xWY5nJRCF3XaYyBjhI= +github.com/onsi/gomega v1.27.10/go.mod h1:RsS8tutOdbdgzbPtzzATp12yT7kM5I5aElG3evPbQ0M= +github.com/pjbgf/sha1cd v0.3.0 h1:4D5XXmUUBUl/xQ6IjCkEAbqXskkq/4O7LmGn0AqMDs4= +github.com/pjbgf/sha1cd v0.3.0/go.mod h1:nZ1rrWOcGJ5uZgEEVL1VUM9iRQiZvWdbZjkKyFzPPsI= +github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4= +github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0= +github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= +github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4= +github.com/rogpeppe/go-internal v1.11.0 h1:cWPaGQEPrBb5/AsnsZesgZZ9yb1OQ+GOISoDNXVBh4M= +github.com/rogpeppe/go-internal v1.11.0/go.mod h1:ddIwULY96R17DhadqLgMfk9H9tvdUzkipdSkR5nkCZA= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3 h1:n661drycOFuPLCN3Uc8sB6B/s6Z4t2xvBgU1htSHuq8= +github.com/sergi/go-diff v1.3.2-0.20230802210424-5b0b94c5c0d3/go.mod h1:A0bzQcvG0E7Rwjx0REVgAGH58e96+X0MeOfepqsbeW4= +github.com/sirupsen/logrus v1.7.0/go.mod h1:yWOB1SBYBC5VeMP7gHvWumXLIWorT60ONWic61uBYv0= +github.com/skeema/knownhosts v1.2.2 h1:Iug2P4fLmDw9f41PB6thxUkNUkJzB5i+1/exaj40L3A= +github.com/skeema/knownhosts v1.2.2/go.mod h1:xYbVRSPxqBZFrdmDyMmsOs+uX1UZC3nTN3ThzgDxUwo= +github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME= +github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs= +github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4= +github.com/stretchr/testify v1.9.0 h1:HtqpIVDClZ4nwg75+f6Lvsy/wHu+3BoSGCbBAcpTsTg= +github.com/stretchr/testify v1.9.0/go.mod h1:r2ic/lqez/lEtzL7wO/rwa5dbSLXVDPFyf8C91i36aY= +github.com/xanzy/ssh-agent v0.3.3 h1:+/15pJfg/RsTxqYcX6fHqOXZwwMP+2VyYWJeWM2qQFM= +github.com/xanzy/ssh-agent v0.3.3/go.mod h1:6dzNDKs0J9rVPHPhaGCukekBHKqfl+L3KghI1Bc68Uw= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= +golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w= +golang.org/x/crypto v0.0.0-20210921155107-089bfa567519/go.mod h1:GvvjBRRGRdwPK5ydBHafDWAxML/pGHZbMvKqRZ5+Abc= +golang.org/x/crypto v0.0.0-20220622213112-05595931fe9d/go.mod h1:IxCIyHEi3zRg3s0A5j5BB6A9Jmi73HwBIUl50j+osU4= +golang.org/x/crypto v0.3.1-0.20221117191849-2c476679df9a/go.mod h1:hebNnKkNXi2UzZN1eVRvBB7co0a+JxK6XbPiWVs/3J4= +golang.org/x/crypto v0.7.0/go.mod h1:pYwdfH91IfpZVANVyUOhSIPZaFoJGxTFbZhFTx+dXZU= +golang.org/x/crypto v0.21.0 h1:X31++rzVUdKhX5sWmSOFZxx8UW/ldWx55cbf08iNAMA= +golang.org/x/crypto v0.21.0/go.mod h1:0BP7YvVV9gBbVKyeTG0Gyn+gZm94bibOW5BjDEYAOMs= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= +golang.org/x/mod v0.8.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/mod v0.12.0 h1:rmsUpXtvNzj340zd98LZ4KntptpfRHwpFOHG188oHXc= +golang.org/x/mod v0.12.0/go.mod h1:iBbtSCu2XBx23ZKBPSOrRkjjQPZFPuis4dIYUhu/chs= +golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s= +golang.org/x/net v0.0.0-20210226172049-e18ecbb05110/go.mod h1:m0MpNAwzfU5UDzcl9v0D8zg8gWTRqZa9RBIspLL5mdg= +golang.org/x/net v0.0.0-20211112202133-69e39bad7dc2/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.2.0/go.mod h1:KqCZLdyyvdV855qA2rE3GC2aiw5xGR5TEjj8smXukLY= +golang.org/x/net v0.6.0/go.mod h1:2Tu9+aMcznHK/AK1HMvgo6xiTLG5rD5rZLDS+rp2Bjs= +golang.org/x/net v0.8.0/go.mod h1:QVkue5JL9kW//ek3r6jTKnTFis1tRmNAW2P1shuFdJc= +golang.org/x/net v0.22.0 h1:9sGLhx7iRIHEiX0oAJ3MRZMUCElJgy7Br1nO+AMN3Tc= +golang.org/x/net v0.22.0/go.mod h1:JKghWKKOSdJwpW2GEx0Ja7fmaKnMsbu+MWVZTokSYmg= +golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.1.0/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.3.0 h1:ftCYgMx6zT/asHUrPw8BLLscYtGznsLAnjq5RH9P66E= +golang.org/x/sync v0.3.0/go.mod h1:FU7BRWz2tNW+3quACPkgCx/L+uEAv1htQ0V83Z9Rj+Y= +golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= +golang.org/x/sys v0.0.0-20191026070338-33540a1f6037/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210124154548-22da62e12c0c/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs= +golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220715151400-c0bba94af5f8/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.2.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.3.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.18.0 h1:DBdB3niSjOA/O0blCZBqDefyWNYveAYMNF1Wum0DYQ4= +golang.org/x/sys v0.18.0/go.mod h1:/VUhepiaJMQUp4+oa/7Zr1D23ma6VTLIYjOOTFZPUcA= +golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= +golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8= +golang.org/x/term v0.2.0/go.mod h1:TVmDHMZPmdnySmBfhjOoOdhjzdE1h4u1VwSiw2l1Nuc= +golang.org/x/term v0.5.0/go.mod h1:jMB1sMXY+tzblOD4FWmEbocvup2/aLOaQEp7JmGp78k= +golang.org/x/term v0.6.0/go.mod h1:m6U89DPEgQRMq3DNkDClhWw02AUbt2daBVO4cn4Hv9U= +golang.org/x/term v0.18.0 h1:FcHjZXDMxI8mM3nwhX9HlKop4C0YQvCVCdwYl2wOtE8= +golang.org/x/term v0.18.0/go.mod h1:ILwASektA3OnRv7amZ1xhE/KTR+u50pbXfZ03+6Nx58= +golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ= +golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= +golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.4.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.7.0/go.mod h1:mrYo+phRRbMaCq/xk9113O4dZlRixOauAjOtrjsXDZ8= +golang.org/x/text v0.8.0/go.mod h1:e1OnstbJyHTd6l/uOt8jFFHp6TRDWZR/bV3emEE/zU8= +golang.org/x/text v0.14.0 h1:ScX5w1eTa3QqT8oi6+ziP7dTV1S2+ALU0bI+0zXKWiQ= +golang.org/x/text v0.14.0/go.mod h1:18ZOQIKpY8NJVqYksKHtTdi31H5itFRjB5/qKTNYzSU= +golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ= +golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= +golang.org/x/tools v0.6.0/go.mod h1:Xwgl3UAJ/d3gWutnCtw505GrjyAbvKui8lOU390QaIU= +golang.org/x/tools v0.13.0 h1:Iey4qkscZuv0VvIt8E0neZjtPVQFSc870HQ448QgEmQ= +golang.org/x/tools v0.13.0/go.mod h1:HvlwmtVNQAhOuCjW7xxvovg8wbNq7LwfXh/k7wXUl58= +golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= +gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c h1:Hei/4ADfdWqJk1ZMxUNpqntNwaWcugrBjAiHlqqRiVk= +gopkg.in/check.v1 v1.0.0-20201130134442-10cb98267c6c/go.mod h1:JHkPIbrfpd72SG/EVd6muEfDQjcINNoR0C8j2r3qZ4Q= +gopkg.in/warnings.v0 v0.1.2 h1:wFXVbFY8DY5/xOe1ECiWdKCzZlxgshcYVNkBHstARME= +gopkg.in/warnings.v0 v0.1.2/go.mod h1:jksf8JmL6Qr/oQM2OXTHunEvvTAsrWBLb6OOjuVWRNI= +gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI= +gopkg.in/yaml.v2 v2.4.0/go.mod h1:RDklbk79AGWmwhnvt/jBztapEOGDOx6ZbXqjP6csGnQ= +gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA= +gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM= diff --git a/cmd/changelog/main.go b/cmd/changelog/main.go new file mode 100644 index 000000000..e9e8f2041 --- /dev/null +++ b/cmd/changelog/main.go @@ -0,0 +1,300 @@ +package main + +import ( + "bytes" + _ "embed" + "flag" + "fmt" + "log" + "log/slog" + "os" + "strings" + "time" + + "text/template" + + "github.com/blang/semver" + "github.com/go-errors/errors" + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/object" +) + +type changelog struct { + Tag string + TagMessage string + Messages []commitMessage + Timestamp string +} + +type commitMessage struct { + Message string + Timestamp string +} +type annotatedTag struct { + Name string + Message string + Timestamp string +} + +type stringList []string + +type conf struct { + RepoPath string + ChangelogTmplPath string + CurrentTagName string + Patch bool + Minor bool + Major bool + Message string + Build stringList + PrintChangelog bool +} + +var ( + //go:embed changelog.tmpl.md + defaultTemplate string + errNoAnnotatedTags = errors.Errorf("no annotated tags found") + errFailedToGetHead = errors.Errorf("failed to get HEAD") + errHeadOnLatestTag = errors.Errorf("head is already on the latest tag") + signalingErrCommitFound = errors.Errorf("reached the tag commit, stop iterating") + config = conf{} +) + +func (s stringList) String() string { + return strings.Join(s, ",") +} + +func (s *stringList) Set(value string) error { + *s = strings.Split(value, ",") + return nil +} + +// getLatestAnnotatedTag retrieves the tag name and the message of the latest annotated tag. +func getAnnotatedTag(repo *git.Repository, tag string) (annotatedTag, error) { + // Get the tag references from the repository + tags, err := repo.Tags() + if err != nil { + return annotatedTag{}, errors.Errorf("failed to get tags: %v", err) + } + + var targetTag *object.Tag + // Iterate through the tags to find the latest annotated tag + err = tags.ForEach(func(tagRef *plumbing.Reference) error { + // Try to get the tag object (only annotated tags have this) + tagObj, err := repo.TagObject(tagRef.Hash()) + if err != nil { + // Skip lightweight tags, which do not have messages + return nil + } + if tagObj.Name == tag { + targetTag = tagObj + } + return nil + }) + if err != nil { + return annotatedTag{}, err + } + + if targetTag == nil { + return annotatedTag{}, errNoAnnotatedTags + } + + annotatedTag := annotatedTag{ + Name: strings.TrimSpace(targetTag.Name), + Message: strings.TrimSpace(targetTag.Message), + Timestamp: strings.TrimSpace(targetTag.Tagger.When.Format(time.RFC3339)), + } + return annotatedTag, nil +} + +// getCommitMessagesUntilHead retrieves a list of commit messages between the "fromTagName" and current HEAD +func getCommitMessagesUntilHead(fromTagName string, repo *git.Repository) ([]commitMessage, error) { + found := false + rangeMsgs := strings.TrimSpace(fromTagName) + + // Resolve HEAD reference + headRef, err := repo.Head() + if err != nil { + return nil, errFailedToGetHead + } + + // Get the tag's commit hash + tagRef, err := repo.ResolveRevision(plumbing.Revision(rangeMsgs)) + if err != nil { + return nil, errors.Errorf("failed to resolve tag reference: %v", err) + } + + // Get the commit iterator between the latest tag and target tag + commitIter, err := repo.Log(&git.LogOptions{ + From: headRef.Hash(), + Order: git.LogOrderCommitterTime, + }) + if err != nil { + return nil, errors.Errorf("failed to get commit logs: %w", err) + } + + var logOutput []commitMessage + err = commitIter.ForEach(func(c *object.Commit) error { + msg := strings.Split(c.Message, "\n\n") + logOutput = append(logOutput, commitMessage{Message: msg[0], Timestamp: c.Author.When.Format(time.RFC3339)}) + + // Stop when the commit hash matches the tag commit + if c.Hash.String() == tagRef.String() { + found = true + return signalingErrCommitFound + } + return nil + }) + + if err != nil && !errors.Is(err, signalingErrCommitFound) { + return nil, err + } + + if !found { // edge case where there are tags but the commits for those tags are not in the branch + return nil, errors.Errorf("did not find the tag reference for tag %s", fromTagName) + } + + return logOutput, nil +} + +// generateChangelog generates a changelog between the provided tag and HEAD. +func generateChangelog(repo *git.Repository, tagFrom, newTag, changelogTemplate, changelogMessage string) (string, error) { + tagObjFrom, err := getAnnotatedTag(repo, tagFrom) + if err != nil { + return "", fmt.Errorf("could not retrieve annotated tag %s, err:%w", tagFrom, err) + } + slog.Info("the latest annotated tag is", slog.String("tag", tagObjFrom.Name)) + + commitMsgs, err := getCommitMessagesUntilHead(tagObjFrom.Name, repo) + if err != nil { + return "", fmt.Errorf("could not get commit messages from tag %s to HEAD, err:%w", tagObjFrom.Name, err) + } + + if len(commitMsgs) == 1 { // HEAD has 1 commit since the last tag, the tagged one, edge case where we are on HEAD + slog.Info("Head is on the latest annotated tag, changelog will be empty (did you forget to add commits?)") + return "", errHeadOnLatestTag + } + + slog.Info("working with", slog.Int("commits", len(commitMsgs))) + change := changelog{ + Tag: newTag, + TagMessage: changelogMessage, + Messages: commitMsgs, + } + + // Format the changelog + tmpl, err := template.New("changelog").Parse(changelogTemplate) + if err != nil { + return "", err + } + buf := new(bytes.Buffer) + tmpl.Execute(buf, change) + + return buf.String(), nil +} + +// calculateNewTag will return a valid semver tag based on the configuration provided (depending which of the major/minor/patch are true) +func calculateNewTag(config conf) (string, error) { + currentVersion, err := semver.ParseTolerant(config.CurrentTagName) + if err != nil { + slog.Error("provided semver is not valid", slog.String("semver", config.CurrentTagName)) + return "", err + } + tagScore := 0 + if config.Major { + tagScore += 1 + currentVersion.Major++ + } + if config.Minor { + tagScore += 1 + currentVersion.Minor++ + } + if config.Patch { + tagScore += 1 + currentVersion.Patch++ + } + if tagScore != 1 { + return "", fmt.Errorf("you need to provide exactly one argument from '-patch', '-minor', '-major'") + } + currentVersion.Build = config.Build + return currentVersion.String(), nil +} + +// applyTag applies the 'newTagName' tag to the current HEAD of the repository provided and sets the message to 'newTagMessage' +func applyTag(repo *git.Repository, newTagName, newTagMessage string) error { + // Get the HEAD reference (the latest commit on the current branch) + head, err := repo.Head() + if err != nil { + return fmt.Errorf("failed to get HEAD reference: %w", err) + } + + // Create a new annotated tag + tagRef, err := repo.CreateTag(newTagName, head.Hash(), &git.CreateTagOptions{ + Message: newTagMessage, + Tagger: &object.Signature{ + Name: "", + Email: "", + When: time.Now(), + }, + }) + if err != nil { + return fmt.Errorf("failed to create tag: %w", err) + } + + fmt.Printf("Tag %s created at %s\n", newTagName, tagRef.Hash().String()) + return nil +} + +func main() { + flag.StringVar(&config.RepoPath, "repo-path", "", "path to the repository you want to generate a changelog for") + flag.StringVar(&config.ChangelogTmplPath, "changelog-template-path", "", "path to the go-template you want to use for templating your changelog") + flag.StringVar(&config.CurrentTagName, "current-tag", "", "name of the current latest tag, usually a semver like v1.2.3") + flag.BoolVar(&config.Minor, "minor", false, "create a new minor version") + flag.BoolVar(&config.Major, "major", false, "create a new major version") + flag.BoolVar(&config.Patch, "patch", false, "create a new patch version") + flag.Var(&config.Build, "build", "comma separated build specific strings for the semver") + flag.StringVar(&config.Message, "message", "", "message to add to the new tag") + flag.BoolVar(&config.PrintChangelog, "print", false, "do not release, just print the changelog between current-tag and HEAD") + + flag.Parse() + repo, err := git.PlainOpen(config.RepoPath) + if err != nil { + log.Fatalf("Failed to open repository '%s': %v", config.RepoPath, err) + } + + if config.CurrentTagName == "" { + log.Fatal("current-tag is empty") + } + + changelogTemplate := defaultTemplate + if config.ChangelogTmplPath != "" { + changelogBytes, err := os.ReadFile(config.ChangelogTmplPath) + if err != nil { + log.Fatal(err) + } + changelogTemplate = string(changelogBytes) + } + + var newTag string + if !config.PrintChangelog { + nt, err := calculateNewTag(config) + if err != nil { + log.Fatal(err) + } + newTag = nt + } + + changelog, err := generateChangelog(repo, config.CurrentTagName, newTag, changelogTemplate, config.Message) + if err != nil { + log.Fatalf("Error generating changelog: %v", err) + } + + if !config.PrintChangelog { + if err = applyTag(repo, newTag, changelog); err != nil { + log.Fatalf("Error generating changelog: %v", err) + } + } + + fmt.Println(changelog) +} diff --git a/cmd/changelog/main_test.go b/cmd/changelog/main_test.go new file mode 100644 index 000000000..af416060e --- /dev/null +++ b/cmd/changelog/main_test.go @@ -0,0 +1,433 @@ +package main + +import ( + _ "embed" + "fmt" + "os" + "path/filepath" + "reflect" + "testing" + "time" + + "github.com/go-git/go-git/v5" + "github.com/go-git/go-git/v5/plumbing" + "github.com/go-git/go-git/v5/plumbing/object" +) + +type gitObj struct { + msg string + name string + timestamp string + tagCommitNum int // for tags only, tag specific commit hash +} + +// createCommit creates a new commit in the repository. +func createCommit(repo *git.Repository, workspace, message, timestamp string) (plumbing.Hash, error) { + // Get the working tree + worktree, err := repo.Worktree() + if err != nil { + return plumbing.ZeroHash, err + } + + // Write a dummy file (if you're working with a non-bare repository) + filename := "dummyfile.txt" + err = os.WriteFile(filepath.Join(workspace, filename), []byte("Hello, world!"), 0644) + if err != nil { + return plumbing.ZeroHash, fmt.Errorf("failed to write dummy file: %v", err) + } + + // Add the file to the staging area + _, err = worktree.Add(filename) + if err != nil { + return plumbing.ZeroHash, fmt.Errorf("failed to add file: %v", err) + } + + when, err := time.Parse(time.RFC3339, timestamp) + if err != nil { + return plumbing.ZeroHash, err + } + // Commit the changes + commitHash, err := worktree.Commit(message, &git.CommitOptions{ + Author: &object.Signature{ + Name: "foobar", + Email: "foobar@example.com", + When: when, + }, + }) + if err != nil { + return plumbing.ZeroHash, fmt.Errorf("failed to create commit: %v", err) + } + + return commitHash, nil +} + +// createAnnotatedTag creates an annotated tag for the given commit. +func createAnnotatedTag(repo *git.Repository, commitHash plumbing.Hash, tagName, tagMessage, tagTimestamp string) (*plumbing.Reference, error) { + when, err := time.Parse(time.RFC3339, tagTimestamp) + if err != nil { + return nil, err + } + // Create the annotated tag + tagHash, err := repo.CreateTag(tagName, commitHash, &git.CreateTagOptions{ + Message: tagMessage, + Tagger: &object.Signature{ + Name: "Jane Doe", + Email: "janedoe@example.com", + When: when, + }, + }) + if err != nil { + return nil, fmt.Errorf("failed to create annotated tag: %v", err) + } + + return tagHash, nil +} + +// createInMemoryRepo creates an empty Git repository in memory. +func mustCreateRepo(workspace string, commits, tags []gitObj) *git.Repository { + repo, err := git.PlainInit(workspace, false) + if err != nil { + panic(err) + } + + commitHashes := make([]plumbing.Hash, 0, len(commits)) + for _, c := range commits { + cHash, err := createCommit(repo, workspace, c.msg, c.timestamp) + if err != nil { + panic(err) + } + commitHashes = append(commitHashes, cHash) + } + + for i, t := range tags { + commitNum := i % len(commitHashes) + if t.tagCommitNum != 0 { + commitNum = t.tagCommitNum + } + if _, err := createAnnotatedTag(repo, + commitHashes[commitNum], + t.name, t.msg, t.timestamp); err != nil { + panic(err) + } + } + return repo +} + +func Test_getLatestAnnotatedTag(t *testing.T) { + workspace := "" + dummyTimestamp := "2023-01-19T18:09:06Z" + + type args struct { + repo func() *git.Repository + } + tests := []struct { + name string + args args + want annotatedTag + wantErr error + }{ + { + name: "no tags, empty repo", + args: args{ + repo: func() *git.Repository { + workspace := t.TempDir() + return mustCreateRepo(workspace, []gitObj{}, []gitObj{}) + }, + }, + want: annotatedTag{}, + wantErr: errNoAnnotatedTags, + }, + { + name: "1 tag", + args: args{ + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + }, + []gitObj{ + { + name: "v0.0", + msg: "init", + timestamp: dummyTimestamp, + }, + }) + }, + }, + want: annotatedTag{ + Name: "v0.0", + Message: "init", + Timestamp: dummyTimestamp, + }, + wantErr: nil, + }, + { + name: "2 tags", + args: args{ + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + {msg: "baz", timestamp: dummyTimestamp}, + }, + []gitObj{ + { + name: "v0.0", + msg: "init", + timestamp: dummyTimestamp, + }, + { + name: "v0.0.1", + msg: "feature1", + timestamp: "2024-01-19T18:09:06Z", + }, + }) + + }, + }, + want: annotatedTag{ + Name: "v0.0.1", + Message: "feature1", + Timestamp: "2024-01-19T18:09:06Z", + }, + wantErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getLatestAnnotatedTag(tt.args.repo()) + if (err != nil) && err != tt.wantErr { + t.Errorf("getLatestAnnotatedTag() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("getLatestAnnotatedTag() = %v, want %v", got, tt.want) + } + }) + } + os.RemoveAll(workspace) +} + +func Test_getCommitMessagesUntilHead(t *testing.T) { + workspace := "" + dummyTimestamp := "2023-01-19T18:09:06Z" + + type args struct { + repo func() *git.Repository + from string + } + tests := []struct { + name string + args args + want []string + wantErr error + }{ + { + name: "empty repo", + args: args{ + repo: func() *git.Repository { + workspace := t.TempDir() + return mustCreateRepo(workspace, []gitObj{}, []gitObj{}) + }, + from: "", + }, + want: nil, + wantErr: errFailedToGetHead, + }, + { + name: "2 commits", + args: args{ + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + }, + []gitObj{}) + }, + from: "HEAD~1", + }, + want: []string{"bar", "foo"}, + wantErr: nil, + }, + { + name: "3 commits, from is HEAD-1", + args: args{ + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foobar", timestamp: dummyTimestamp}, + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + {msg: "baz", timestamp: dummyTimestamp}, + }, []gitObj{}) + + }, + from: "HEAD~2", + }, + + want: []string{"baz", "bar", "foo"}, + wantErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := getCommitMessagesUntilHead(tt.args.from, tt.args.repo()) + if (err != nil) && err != tt.wantErr { + t.Errorf("getCommitMessagesUntilHead() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("getCommitMessagesUntilHead() = %v, want %v", got, tt.want) + } + }) + } + os.RemoveAll(workspace) +} + +func Test_generateChangelog(t *testing.T) { + workspace := "" + dummyTimestamp := "2023-01-19T18:09:06Z" + + type args struct { + repo func() *git.Repository + template string + newTag annotatedTag + } + tests := []struct { + name string + args args + want string + wantErr error + }{ + { + name: "empty repo, default template", + args: args{ + repo: func() *git.Repository { + workspace := t.TempDir() + return mustCreateRepo(workspace, []gitObj{}, []gitObj{}) + }, + template: defaultTemplate, + newTag: annotatedTag{Name: "a", Message: "b"}, + }, + want: "", + wantErr: errNoAnnotatedTags, + }, + { + name: "2 commits, 1 tag, default template", + args: args{ + newTag: annotatedTag{Name: "v0.7.6", Message: "this is the new tag msg"}, + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + }, + []gitObj{ + { + msg: "this is my tag msg", + name: "v0.7.5", + timestamp: dummyTimestamp, + }, + }) + }, + template: defaultTemplate, + }, + want: "## v0.7.6\n**this is the new tag msg**\n\n* bar\n* foo\n\n", + wantErr: nil, + }, + { + name: "3 commits,2 tags, custom template", + args: args{ + newTag: annotatedTag{Name: "v0.7.6", Message: "this is the new tag msg"}, + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + {msg: "baz", timestamp: dummyTimestamp}, + }, []gitObj{ + { + msg: "this is my tag msg", + name: "v0.7.1", + timestamp: dummyTimestamp, + tagCommitNum: 0, + }, + { + msg: "this is my other tag msg", + name: "v0.7.5", + timestamp: "2024-01-19T18:09:06Z", + tagCommitNum: 1, + }, + }) + + }, + template: "{{.Tag}}", + }, + + want: "v0.7.6", + wantErr: nil, + }, + { + name: "3 commits,2 tags, HEAD is on the latest tag so we are generating a changelog for the previous", + args: args{ + newTag: annotatedTag{}, + repo: func() *git.Repository { + os.RemoveAll(workspace) + workspace = t.TempDir() + return mustCreateRepo(workspace, + []gitObj{ + {msg: "foo", timestamp: dummyTimestamp}, + {msg: "bar", timestamp: dummyTimestamp}, + {msg: "baz", timestamp: dummyTimestamp}, + }, []gitObj{ + { + msg: "this is my other tag msg", + name: "v0.7.5", + timestamp: "2024-01-19T18:09:06Z", + tagCommitNum: 1, + }, + { + msg: "this is my HEAD tag msg", + name: "v0.7.7", + timestamp: "2024-02-19T18:09:06Z", + tagCommitNum: 2, + }, + }) + + }, + template: "{{.Tag}}", + }, + + want: "v0.7.7", + wantErr: nil, + }, + } + for _, tt := range tests { + t.Run(tt.name, func(t *testing.T) { + got, err := generateChangelog(tt.args.repo(), tt.args.newTag, tt.args.template) + if (err != nil) && err != tt.wantErr { + t.Errorf("generateChangelog() error = %v, wantErr %v", err, tt.wantErr) + return + } + if !reflect.DeepEqual(got, tt.want) { + t.Errorf("generateChangelog() = '%v', want '%v'", got, tt.want) + } + }) + } + os.RemoveAll(workspace) +} diff --git a/docs/CHANGELOG.md b/docs/CHANGELOG.md new file mode 100644 index 000000000..ddf8189ae --- /dev/null +++ b/docs/CHANGELOG.md @@ -0,0 +1,332 @@ +## + +**v0.57.0** +2024-10-22T12:20:21+01:00: add changelog binary that allows to generate a changelog consisting of commit messages between defined tag and HEAD +2024-10-22T12:18:06+01:00: add changelog target to the makefile +2024-10-16T11:33:41+01:00: remove results output from git-clone component +**v0.56.5** +2024-10-23T21:56:39+01:00: fix bug #445, make the jira issue type configurable +2024-10-31T11:02:12Z: workaround defectdojo expecting a non-empty scanstarttime for their engagments +**v0.56.4** +2024-10-30T14:57:59Z: fix #453 by providing an optional nvdApiKey to dependency-check +**v0.56.3** +2024-10-30T17:37:44Z: Updating component runners to leverage WorkflowID. +2024-10-30T17:37:22Z: Refreshing examples to take WorkflowID in account. +2024-10-30T17:36:54Z: Leverage Workflow ID for the runner. +2024-10-30T11:55:35Z: Implementing base for SQLite local storage. +2024-10-30T17:35:41Z: Passing WorkflowID to storage methods and regenerating mocks +2024-10-30T17:34:13Z: Adding reusable uuid package. +2024-10-30T11:54:58Z: Adding SQLite dependencies and vendors. +2024-10-29T10:45:30Z: Adding docs and examples. +**v0.56.2** +2024-10-29T10:45:13Z: Implementing components on top of the runner. +2024-10-29T10:43:19Z: Implementing shared runner and basic storer +2024-10-29T10:42:58Z: Adding utilities for runner and components. +2024-10-29T10:40:37Z: Updating component interfaces and regenerating mocks. +2024-10-29T10:39:58Z: Adding dependencies for runner; adding means to generate mocks; adding basic version. +2024-10-25T11:30:48+01:00: example workflow for scorecard +**v0.56.1** +2024-10-25T11:50:07+01:00: nit: set the default annotation of the custom annotation enricher to the empty map so that it doesn't crash if its run as a noop +2024-10-25T11:49:24+01:00: bugfix #448, make scorecard binary work +2024-09-02T20:27:56+01:00: dependencies, update playwright-go +**v0.56.0** +2024-10-24T16:22:16+01:00: add example testdata for easier unittests +2024-10-24T16:21:56+01:00: add a pluggable aws-s3 wrapper +2024-10-24T16:21:30+01:00: support the pdf consumer with a pluggable playwright wrapper +2024-10-24T16:20:57+01:00: address #332, make the pdf consumer play well with the rest of the build system +2024-10-24T13:42:20+01:00: feature/update-the-logos-for-readme (#442)2024-10-21T12:47:25+01:00: Formatting docs. +2024-10-21T12:47:15+01:00: Updating getting started docs to fix a malformed pipelines deploy command. +2024-10-21T12:04:47+01:00: Update reviewdog references to smithy. +**v0.55.4** +2024-10-21T12:04:31+01:00: Updating .gitignore to ignore smithy files previously ignored by ocurity. +2024-10-21T12:04:07+01:00: Updating actions to leverage smithy references. +2024-10-21T12:03:25+01:00: Updating tests to leverage smithy. +2024-10-21T12:03:12+01:00: Updating lock. +2024-10-21T12:02:54+01:00: Update README to replace ocurity with smithy. +2024-10-21T12:02:21+01:00: Updating protobuf contracts to use smithy as reference. +2024-10-21T12:02:01+01:00: Updating docs to use smithy references. +2024-10-21T12:01:39+01:00: Updating examples to leverage smithy. +2024-10-21T12:01:20+01:00: Renaming utilities and deployment references from ocurity/dracon to smithy-security/smithy +2024-10-21T12:00:30+01:00: Renaming go references from ocurity/dracon to smithy-security/smithy +2024-10-18T11:12:42+01:00: nit: improve logging for the custom annotation enricher and adjust the name of its parameter in the example +2024-10-08T13:01:28+01:00: github security example workflow +2024-10-07T18:54:52+01:00: upgrade the github library to v65 +2024-10-07T18:54:27+01:00: add a github wrapper package +2024-10-07T18:53:08+01:00: feature/402 dependabot producer2024-10-07T18:52:14+01:00: feature/401-github-codeql producer2024-10-18T09:39:01+01:00: Defining component SDK interfaces. +2024-10-18T09:38:41+01:00: Moving OCSF generated code to the SDK for better reuse. +2024-10-15T10:17:35+01:00: fix #422, allow consumer templating to also carry information about which annotation contains the code fix +**v0.55.3** +2024-10-16T14:04:48+01:00: Reverting changes to see if we could not expand vendors in PR review diffs as it doesn't work. +**v0.55.2** +2024-10-16T13:43:01+01:00: Attempting to not expand vendors in PR Diffs. +2024-10-16T12:52:28+01:00: Do not expand vendor/ changes on PR Diffs. +2024-10-15T17:34:50+01:00: Generating OCSF Go types from Proto Schema. +2024-10-11T19:59:16+01:00: fix bug 418 typo while checking jira issue count +**v0.55.1** +2024-10-11T15:59:16+01:00: Removing unused imports. +2024-10-11T15:12:10+01:00: fix bug #414 where the jira consumer would not create issues with zero scanstart time +2024-10-14T11:39:15+01:00: Adding utilities to run buf in Docker. +2024-10-12T19:23:14+01:00: Bumping buf to v2 to build correctly and removing out of date or unused configuration. Bumping proto plugins to latest. +2024-10-11T18:32:36+01:00: temporarily remove scan start time from jira consumer +**v0.55.0** +2024-10-11T17:34:09+01:00: Adding script to cleanup sample output from json consumer +2024-10-11T00:10:52+01:00: nit, slightly change the error of the custom annotation enricher to show what was the object that could not be unmarshalled +**v0.54.0** +2024-10-10T23:48:04+01:00: close #409, refactor Jira consumer, remove addToDescription, instead offer a default template +2024-10-10T22:49:20+01:00: close feature #407 create a snyk node producer +2024-10-11T09:48:41+01:00: fix issue happening mostly with semgrep where issues would not be enriched due to the type being more than 128 characters +2024-10-03T17:22:14+01:00: nit:change the golang example to use a dedicated go vulnerable web app +**v0.53.0** +2024-10-03T17:01:41+01:00: implement #394 - add a custom key-value pair enricher +2024-10-03T16:57:51+01:00: fix issue #393 by adjusting the default workspace for the source-code +2024-10-03T15:25:30+01:00: #391: add tagging utilities +**v0.52.1** +2024-10-03T15:20:50+01:00: #389: fix ts eslint wrapper image reference +2024-10-02T12:21:04+01:00: relax elasticsearch consumer's definition of an error, make it accept all 200s as a valid response from the server +**v0.52.0** +2024-10-01T23:04:39+01:00: fix the reachability enrichers atom run command by removing backslashes +**v0.51.1** +**v0.51.0** +2024-09-26T12:19:26+01:00: fix #379, add significantly more error logging to the elasticsearch consumer +**v0.50.1** +2024-09-27T19:33:42+01:00: add snyk-python to the test workflow +2024-09-27T19:31:56+01:00: implement #381 snyk for python +2024-09-27T19:31:25+01:00: fix #382 by rewriting the snyk orchestration script +2024-09-24T12:19:14+01:00: temporarily remove cyclonedx parsing from the checkov producer to comply with the convention that each producer has 1 single producer-issues step +**v0.50.0** +2024-09-24T09:17:46+01:00: downgrade buf to 1.28.1 to prevent proto formatting false positives +**v0.49.0** +2024-09-24T09:11:13+01:00: fix deprecated reviewdog flag in lint make target +2024-09-20T09:48:26+01:00: bugfix/367 fix cyclonedx parser crash if the package does not have purl in metadata +2024-09-19T19:09:03+01:00: example checkov workflow +2024-09-19T19:08:13+01:00: implement feature 356, minimal checkov producer +2024-09-17T11:31:25+01:00: brakeman rails project test workflow +2024-09-16T17:25:02+01:00: feature/358 introduce brakeman producer +2024-09-23T15:47:10+01:00: set all parameters in es consumer to the default empty string +2024-09-22T09:09:34+01:00: update publish checkout action to v4 +2024-09-19T15:16:31+01:00: Updating example Kustomization to rely on correct local components paths. +**v0.48.0** +2024-09-19T15:15:58+01:00: Moved from original getting-started.md document so they can be checked out separately. +2024-09-19T15:14:58+01:00: Refreshing Getting Started document to be more user friendly and to the point. +2024-09-19T15:14:11+01:00: Linking Discord server. +2024-09-18T21:47:34+01:00: bugfix:364 fix sarif parser bug where if no endline was provided the output would end in '-' +2024-09-18T21:40:29+01:00: nit: add an info log for where a producer wrote its output +2024-09-18T21:34:59+01:00: example snyk workflow +**v0.47.0** +2024-09-18T21:33:21+01:00: issue 362 a base snyk producer that supports snyk docker +2024-09-19T11:51:27+01:00: Simplifying purl parsing and reachability flow for atom reachability enricher. +**v0.46.0** +2024-09-17T16:19:16+01:00: Adding example pipeline for atom reachability enricher. +**v0.42.0** +2024-09-17T16:18:52+01:00: Adding task for atom reachability enricher. +2024-09-17T16:18:31+01:00: Adding business logic and tests for atom reachability enricher. +2024-09-16T10:18:02+01:00: Adding base Golang code styling documentation location with sample rules; Moving enumeration generation document to the go styling folder. +2024-09-22T00:24:17+01:00: fix draconctl path in publish job +2024-09-11T15:21:10+01:00: Extending docs with sections about custom container platform and OS/ARCH for building binaries. Bumping remark-cli to suppress errors and warnings on linting markdown files. +2024-09-11T15:19:56+01:00: Formatting pdf Dockerfile. +2024-09-11T15:17:06+01:00: introduce multi-platform builds #3342024-09-13T21:30:36+01:00: fix 349 by adding api keys to the elasticsearch consumer so that it can work with elasticsearch saas +**v0.41.0** +2024-09-13T14:38:57+01:00: simplify producer aggregator build +2024-09-13T14:38:19+01:00: remove github-code-scanning makefile and dockerfile +2024-09-12T20:26:52+01:00: make producer aggregator work with new base image +2024-09-12T20:22:34+01:00: remove scratch as the explicit BASE_IMAGE in the makefile +2024-09-12T20:26:14+01:00: change all docker and makefiles from components that needed certificates since now the base image has certs +2024-09-12T20:24:00+01:00: make build component containers script build using a base dockerfile that has certificates +2024-09-12T17:59:26+01:00: fixup! fix CONTAINER_REPO for dev-* targets and Makefile formatting +2024-09-12T17:33:06+01:00: fix CONTAINER_REPO for dev-* targets and Makefile formatting +2024-09-12T17:30:50+01:00: fix nit to prevent warnings from docker build daemon +2024-09-10T11:30:17+01:00: fix-bug-341-postgreql-does-not-have-credentials +**v0.40.0** +2024-08-31T13:25:26+01:00: fix #330 by making the dependency track consumer debug flag into a string instead of a boolean switch +**v0.38.0** +2024-09-05T11:53:41+01:00: Revert and then improve footnotes on deploying custom Dracon components. +2024-09-05T10:53:03+01:00: Removing ThoughtMachine mentions from README. +2024-09-04T18:03:20+01:00: Fixing markdown formatting warns and errors. +2024-09-04T16:26:51+01:00: Ignore .idea/ generated by IntelliJ IDEs to prevent maintainers from accidentally pushing changes to it. +2024-09-04T16:25:25+01:00: 🐛 Fix undefined key error highlighted by Helm as the required database key was missing. +2024-09-04T16:24:08+01:00: 🐛 Fix getting started formatting and content. +2024-09-04T16:23:40+01:00: 🐛 Fix README formatting, content and links. +2024-08-30T22:04:28+01:00: fix #328 by changing the BOM upload method from UploadBom to PostBOm, as PostBom does not have a size limitation +2024-08-30T22:02:44+01:00: fix #329 by removing log.Fatal outside main method and adding structured logging and error returning to the Dependencty Track Consumer +2024-08-30T22:00:35+01:00: fix #327 by renaming the dependency track consumer debug flag +2024-08-30T16:03:22+01:00: fix reference to image.repository in deduplication migrations reference to not include deduplication_db_migrations dictionary +**v0.37.0** +2024-08-30T12:07:15+01:00: remove -quiet from gosec for visibility +**v0.36.0** +2024-08-27T18:12:50+01:00: add dockerfile with certs +2024-08-25T22:31:31+01:00: add parameter checking and debugging to dt consumer +2024-08-25T22:29:18+01:00: upgrade the dt library version +2024-08-25T22:26:34+01:00: upgrade cdxgen to the latest version +2024-08-14T12:22:53+01:00: make the migrations role optional +2024-08-14T12:22:36+01:00: allow overriding image names +2024-08-22T15:42:14+01:00: fix ossf scorecard custom docker building and publishing +**v0.35.0** +2024-08-22T15:20:14+01:00: add dependency check to the sca kustomization +2024-08-22T15:10:36+01:00: fix zaproxy image +2024-08-22T14:37:59+01:00: make cyclonedx report how many components it imported +2024-08-21T21:47:00+01:00: make source-code the default subdir +2024-08-20T14:18:54+01:00: 💬 Add descriptions for all components +2024-08-19T21:34:37+01:00: iclose #307 by making addanchors and add env vars idempotent +2024-08-19T20:16:07+01:00: close #309, add certificates to jira consumer +**v0.32.0** +2024-08-12T09:58:05+01:00: nit: rename old enrichment db migrations pod to deduplication db migrations +2024-08-08T17:03:51+01:00: Revert "👷 Add E2E integration test to CI"2024-08-09T10:08:18+01:00: add label to draconctl container +2024-08-08T16:50:51+01:00: make migrations tests ignore structured logging +**v0.31.0** +2024-08-08T16:38:23+01:00: remove positional migrations path from job in favour of the env var +2024-08-08T15:46:51+01:00: ensure that the migrations dir exists +2024-08-08T15:46:15+01:00: add info log to draconctl migrations for which dir it picks up migrations from +2024-08-07T17:55:20+01:00: 👷 Add E2E integration test to CI +2024-08-08T15:04:10+01:00: fix quoting of deduplication enricher environment variables (closes #163) +**v0.28.0** +2024-08-08T14:05:55+01:00: add resources and pull policy to the migrations job +2024-08-08T14:13:13+01:00: fix deduplication enricher environment variables (closes #294) +2024-08-07T17:44:52+01:00: 🐛 Fix bug in `make install` target +2024-08-07T16:40:03+01:00: 🐛 Fix incorrect `ocurity/dracon` prefix for local components +2024-08-07T09:08:43+01:00: make deduplication db component have expected db connection string values +2024-08-07T09:19:59+01:00: remove helm image registry from global values +2024-08-07T09:18:48+01:00: introduce install and dev-deploy makefile targets2024-08-06T16:40:27+01:00: replace container_registry with image.registry Helm parameter and re-use dev Dracon Helm values (closes #289) +**v0.27.0** +2024-08-06T16:22:42+01:00: remove image pinning logic from Helm package creation command +2024-08-06T15:40:10+01:00: cleanup leftover chart dependencies +2024-08-06T15:39:46+01:00: fix path in .gitignore +2024-08-03T19:19:32+01:00: fix example producer image URL (part of #287) +2024-08-03T19:18:54+01:00: fix dependency track image URL (part of #287) +2024-08-03T19:18:35+01:00: use Helm Chart app version as a tag for component images (part of #287) +2024-08-03T19:13:28+01:00: parallelize docker builds in github publish action +2024-08-05T15:54:16+01:00: 🔧 Add support for overriding `enrichers/deduplication` connection string2024-07-12T13:20:48+01:00: make draconctl able to log JSON +2024-08-01T13:34:01+03:00: 🔊 Change log level to `debug` for missing scan tags +2024-08-01T13:33:27+03:00: 🗃️ Add SCA example pipeline +2024-08-01T13:21:53+03:00: 🔧 Add sensible default to trivy producer +2024-08-01T12:04:24+03:00: ⬆️ Upgrade trivy `0.37.1->-0.54.1` +2024-08-01T12:03:50+03:00: 🔊 Make trivy logging more verbose +2024-08-01T11:48:41+03:00: 🐛 Fix incorrect reference to binary +2024-08-02T13:31:23+01:00: remove namespace reference from enricher deduplication database URI +**v0.26.0** +2024-07-30T13:56:43+03:00: ⬆️ Bump `actions/setup-go@v4` to `v5` +**v0.25.0** +2024-07-30T13:50:02+03:00: 👷 Add test summary for Go tests +2024-07-30T13:43:24+03:00: 👷 Replace `go test` with `gotestsum` +2024-07-30T17:09:13+03:00: 💬 Add parameter descriptions to `consumers/slack` +2024-07-30T15:58:35+03:00: 🧱 Add custom `Dockerfile` for `consumers/slack`2024-07-30T18:59:43+03:00: ⬆️ Run `go mod vendor` +2024-07-30T18:59:31+03:00: ➕ Add `go-github` as a dependency +2024-07-29T16:19:32+03:00: 🗃️ Add GHAS example pipeline +2024-07-29T15:09:15+03:00: 🗃️ Add example data for `producer/github-code-scanning` +2024-07-29T13:42:55+03:00: ✨ Add new `producer/github-code-scanning` component +2024-06-06T08:57:07+01:00: 🐛 Fix Semgrep and Bandit producers not recording CWE +2024-07-24T14:19:01+03:00: 🐛 Fix enrichers not handling multiple tools +2024-07-24T14:14:19+03:00: 🔧 Change example python pipeline +2024-07-24T14:13:59+03:00: 🔧 Change example golang pipeline +2024-07-24T12:44:36+03:00: ♻️ Refactor image pinning test +2024-07-24T12:39:59+03:00: 🐛 Fix typescript example workflow +2024-07-23T12:54:50+03:00: 🔨 Add utility script to bump local components +2024-07-23T18:05:05+03:00: 🐛 Fix `producer/semgrep` fails to run2024-07-23T17:30:12+03:00: 🐛 Fix `producer/eslint` component not starting +2024-07-23T16:36:06+03:00: 🐛 Fix erroneous image reference in `eslint` producer +2024-07-18T17:20:15+02:00: 🐛 Fix `producer/yarn-audit` not handling empty lines2024-07-18T17:30:31+02:00: 🐛 Fix incorrect parameter name in TS example pipeline +2024-07-18T17:01:28+02:00: 🔧 Replace `enricher-deduplication` with `enricher-codeowners` in examples +2024-07-18T17:00:31+02:00: 🔧 Change default ES and MongoDB URLs +2024-07-11T14:18:47+01:00: ♻️ Refactor all enrichers to always produce results +2024-07-11T14:18:28+01:00: ✅ Introduce `enrichers/test_utils.go` +2024-07-11T12:47:58+01:00: ♻️ Extract `enricher/depsdev` types into own file +2024-07-29T20:49:41+01:00: fix broken zaproxy task by removing typo +2024-07-29T20:49:23+01:00: fix unrunable task by adding a command for testssl.sh +2024-07-12T16:37:41+01:00: ♻️ Switch `producers/typescript-eslint` to produce file targets2024-07-12T16:01:01+01:00: ♻️ Switch `producers/semgrep` to produce file targets2024-07-12T08:41:59+01:00: ♻️ Switch `producers/golang-gosec` to produce file targets2024-07-12T08:39:51+01:00: ✨ Add `ExtractCode` for fileURI targets2024-07-11T15:58:33+01:00: ✨ Add `GetFileTarget` and `EnsureValidFileTarget` to base producer +2024-07-24T18:26:26+01:00: 🔥 Remove dead code in enricher-aggregator2024-07-17T19:50:52+01:00: deduplication migrations: fix migrations path and hook delete policy (Fixes OCU-150, OCU-151) +**v0.23.0** +2024-07-15T11:48:02+01:00: ♻️ Refactor `producer.ReadInFile` to use `os.ReadFile` +2024-07-09T12:22:30+01:00: 🔥 Remove `producers/typescript-npm-audit` +2024-07-08T17:07:31+01:00: 🧐 Add example data for `producers/npm-audit` +2024-07-08T17:07:15+01:00: ✨ Switch npm audit producer to record pURL targets +2024-07-08T16:37:56+01:00: 🔥 Remove deprecated `producers.ReadLines` +2024-07-08T16:37:32+01:00: 🐛 Fix broken yarn audit producer +2024-07-08T16:31:13+01:00: 🧐 Add example data for `producers/typescript-yarn-audit` +2024-07-08T14:57:07+01:00: ✨ Expand `producer/golang-nancy` to record CWE and pURL target +2024-07-08T14:55:52+01:00: 🧐 Add example data for `producers/golang-nancy` +2024-07-17T19:50:52+01:00: remove hooks from deduplication job and simplify parameters +2024-07-17T16:08:14+01:00: fix deduplication migrations Helm package name in publish action +**v0.22.0** +2024-07-17T15:47:17+01:00: fix for GH publish action +**v0.21.0** +2024-07-16T16:54:19+01:00: fix #255 by making the enricher aggregator not depend on the base enricher +2024-07-15T17:54:37+01:00: rename enrichment db migrations to deduplication-db-migrations to better reflect usage +**v0.19.0** +2024-07-15T17:28:37+01:00: remove postgresql as a dependency, close #249 +2024-07-16T16:08:15+01:00: 🐛 Fix incorrect version for enrichment-db-migrations chart +2024-07-16T16:07:41+01:00: 🐛 Remove duplicate statement from Makefile +2024-07-11T14:49:23+01:00: ⬆️ Upgrade `vendor/` dependencies +2024-06-03T13:38:56+01:00: ♻️ Create base enricher +2024-07-10T18:38:35+01:00: 📝 Add warning to `enrichers/policy:README` about memory requirements +2024-07-10T18:35:17+01:00: 🔥 Remove `enricher-policy` from example pipelines2024-07-14T20:01:38+01:00: fix #247, push the right package to oci registry for enrichmentdb migrations +2024-07-14T19:40:26+01:00: actually fix #244 by setting the correct helm flags +2024-07-14T19:24:42+01:00: fix #244 by setting the correct helm flags +2024-07-12T16:56:19+01:00: split enrichment db migrations helm chart, close #2412024-07-05T18:27:27+01:00: 📝 Add README to `producer/semgrep` +2024-07-05T18:01:22+01:00: 🐛 Fix `producer/semgrep` not supporting registry +2024-07-02T09:53:59+01:00: [OCU-122] ✨ Add new `GetPURLTarget` method to base-producer (#213)2024-06-19T15:20:38+01:00: fix formatting of migrations and enum generating docs +2024-06-19T15:11:07+01:00: 225: push the draconctl image also with the latest tag +**v0.17.0** +2024-06-14T16:15:25+01:00: migrations specific documentation +2024-06-12T16:04:31+01:00: Move draconctl migrations apply to environment variable +2024-06-14T14:15:51+01:00: #214 :wrench: Improve ComponentType and OrchestrationType enums (#221)2024-06-05T19:55:59+01:00: #203 add target for html coverage +2024-06-12T14:58:51+01:00: 🔨 Extend `Makefile` with new `generate-protos` command +**v0.16.0** +2024-06-12T14:03:02+01:00: 🚨 Run formatter +2024-06-12T14:01:54+01:00: 📝 Add docs on how to generate and update protos +2024-06-12T13:57:13+01:00: 🏷️ Generate updated go protobufs +2024-06-12T13:56:31+01:00: 👷 Add `buf.gen.yaml` +2024-06-12T13:56:06+01:00: ⬆️ Bump `buf@1.28.1->1.32.2` +2024-06-12T12:09:24+01:00: 🏷️ Extend `LaunchToolResponse` proto by new `scan_target` field +2024-06-12T11:39:59+01:00: bump braces node module (#216)2024-06-07T17:40:55+01:00: 🐛 Fix some producers failing if unable to extract code +2024-06-03T13:38:56+01:00: move constants to base component +**v0.15.0** +2024-06-03T12:06:32+01:00: add logging to base producers and consumers +2024-06-03T11:58:05+01:00: add structured dracon logging +2024-06-05T12:07:58+01:00: redirect reviewdog stderr to stdout2024-06-05T12:01:13+01:00: remove tee flag from reviewdog for reduced verbosity +2024-06-05T11:36:13+01:00: 197: commit objects to memory when fake K8s apply method is invoked +2024-06-05T11:34:50+01:00: current linter setup is very noisy, also reviewdog's github integration has a bug that double/tripple reports findings on removed code, however, when running locally, the linter works as expected, so we do the same for ci/cd +2024-06-04T12:23:06+01:00: 195: allow user to choose if they want a Kibana ingress to be deployed2024-06-03T14:21:04+01:00: make migrations job able to be deleted and recreated many times so that we can deploy multiple times +2024-06-03T17:06:17+01:00: add ref to 'missing reference' message +2024-05-21T17:39:25+01:00: 188: fix typo in make variable +**v0.13.0** +2024-05-21T17:39:25+01:00: 188: fix typo in make variable2024-05-21T13:49:41+01:00: expose component discovery methods for local components +2024-05-14T17:10:42+03:00: 183: cleanup all example pipelines +2024-05-14T16:45:53+03:00: nit: remove namespace from connection string for more flexibility +2024-05-13T23:37:10+03:00: 182: remove ensure_hashes script and helpers +2024-05-13T23:31:47+03:00: 182: remove leftover e2e and release scripts and BUILD files +2024-05-13T23:31:10+03:00: 182: remove tektoncd openapi resources and base transformer +2024-05-13T23:30:17+03:00: remove leftover make targets for generating pipelines +2024-05-14T19:40:58+03:00: update suggested version in docs to v0.13.0 +**v0.12.0** +2024-05-14T19:33:13+03:00: 180: add dracon_scan_start_time, dracon_scan_id and dracon_scan_tags to producers2024-05-14T16:43:24+01:00: [OCU-106] clean example-pipelines-helm-manifests +2024-05-10T21:46:25+01:00: [OCU-102] fix custom package deployment instructions +2024-05-10T18:03:03+01:00: [OCU-103] fix bandit and safety extra docker containers +2024-05-13T14:27:33+01:00: 176: marshal ComponentType and OrchestrationType as string2024-05-08T18:03:23+01:00: fix 170: add more checks for unresolved components2024-05-07T19:03:43+01:00: cleanup golang project example, fix mongodb deployment and pipelinerun parameters +**v0.11.0** +2024-05-07T18:15:11+01:00: fix name of Helm package uploaded by publish action +**v0.10.0** +2024-05-07T18:02:11+01:00: fix buggy assignment of version flag when creating Helm component package +**v0.9.0** +2024-05-07T17:47:25+01:00: set component package version to original tag value +**v0.8.0** +2024-05-07T17:47:25+01:00: set component package version to original tag value2024-05-07T17:12:41+01:00: add missing namespace from dracon component deploying command +2024-05-07T17:06:00+01:00: deploy dracon-oss-components as part of dev-dracon make target +2024-05-07T16:52:02+01:00: typo fixes for make phony target and docs +2024-05-07T16:39:00+01:00: re-introduce dev-deploy target with updated dependencies +**v0.7.0** +2024-05-07T16:38:06+01:00: document new Dracon deployment workflows +2024-05-07T16:28:19+01:00: refactor dracon Helm chart folder2024-05-07T16:27:52+01:00: minor fmt fix in pkg/components/package_test.go +2024-05-07T15:41:38+01:00: publish all containers not just component containers +2024-05-07T13:53:07+01:00: fixes 169: programmatically pin component images to specific Dracon version +**v0.6.0** +2024-05-07T13:41:33+01:00: fixes 169: pin all components Tasks to latest version2024-05-07T13:17:30+01:00: remove hardcoded anchor from git-clone task2024-05-07T13:04:05+01:00: yeet even more kustomization.yamls +2024-05-07T11:34:33+01:00: improve docstring of Orchestrator interface +2024-05-06T10:38:14+03:00: fix path of Helm dracon oss chart +**v0.5.0** +2024-05-06T10:29:20+03:00: make tag format more explicit for publish action trigger +2024-05-06T08:40:16+03:00: fixes 168: label all container with org.opencontainers.image.source +**v0.4.0** +2024-05-06T00:17:56+03:00: fix permissions for publishing job +**v0.3.0** +2024-05-06T00:06:11+03:00: fixes 149: give permission to publish job to write packages +**v0.2.0** +2024-05-05T23:37:01+03:00: remove accidentally commited dummy test file +