From b0e0c9465dedeb510412a4b938458b1f23c42e92 Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Thu, 8 Feb 2024 17:35:04 +0000 Subject: [PATCH 01/10] feat: create module set for release with all modules --- versions.yaml | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 versions.yaml diff --git a/versions.yaml b/versions.yaml new file mode 100644 index 000000000..820b3bf00 --- /dev/null +++ b/versions.yaml @@ -0,0 +1,21 @@ +module-sets: + vmclarity: + version: v0.6.0 + modules: + - github.com/openclarity/vmclarity/uibackend/types + - github.com/openclarity/vmclarity/uibackend/server + - github.com/openclarity/vmclarity/uibackend/client + - github.com/openclarity/vmclarity/core + - github.com/openclarity/vmclarity/provider + - github.com/openclarity/vmclarity/utils + - github.com/openclarity/vmclarity/installation + - github.com/openclarity/vmclarity/cli + - github.com/openclarity/vmclarity/testenv + - github.com/openclarity/vmclarity/api/types + - github.com/openclarity/vmclarity/api/server + - github.com/openclarity/vmclarity/api/client + - github.com/openclarity/vmclarity/e2e + - github.com/openclarity/vmclarity/containerruntimediscovery/types + - github.com/openclarity/vmclarity/containerruntimediscovery/server + - github.com/openclarity/vmclarity/containerruntimediscovery/client + - github.com/openclarity/vmclarity/orchestrator \ No newline at end of file From bec7d052713aef188e38d3b813fc1d117958411d Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Fri, 9 Feb 2024 10:53:50 +0000 Subject: [PATCH 02/10] feat: build multimod --- makefile.d/20-tools.mk | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/makefile.d/20-tools.mk b/makefile.d/20-tools.mk index 9b433516a..3248b0d52 100644 --- a/makefile.d/20-tools.mk +++ b/makefile.d/20-tools.mk @@ -231,3 +231,16 @@ bin/typos-$(TYPOS_VERSION): | $(BIN_DIR) @curl -sSfL 'https://github.com/crate-ci/typos/releases/download/v$(TYPOS_VERSION)/typos-v$(TYPOS_VERSION)-$(TYPOS_ARCH)-$(TYPOS_OSTYPE).tar.gz' --output - \ | tar xzvOf - './typos' > $@ @chmod +x $@ + +#### +## Go MultiMod Releaser +#### + +MULTIMOD_BIN := $(BIN_DIR)/multimod +MULTIMOD_REPO_DIR := $(BIN_DIR)/opentelemetry-go-build-tools +MULTIMOD := $(BIN_DIR)/multimod + +bin/multimod: + @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone git@github.com:open-telemetry/opentelemetry-go-build-tools.git $(MULTIMOD_REPO_DIR); fi + @cd $(MULTIMOD_REPO_DIR)/multimod && go build -o $(MULTIMOD_BIN) main.go + @rm -rf $(MULTIMOD_REPO_DIR) From 37aa48b0ca4c3918c8b871d6ecc9d8e0243766fd Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Fri, 9 Feb 2024 11:15:45 +0000 Subject: [PATCH 03/10] feat: add multimod verify and prerelease --- Makefile | 9 +++++++++ RELEASE.md | 26 ++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 RELEASE.md diff --git a/Makefile b/Makefile index 9f19c6859..022d31fce 100644 --- a/Makefile +++ b/Makefile @@ -491,3 +491,12 @@ endif $(DIST_DIR)/CHANGELOG.md: $(ROOT_DIR)/cliff.toml bin/git-cliff | $(DIST_DIR) $(GITCLIFF_BIN) --config $(ROOT_DIR)/cliff.toml --output $@ $(GITCLIFF_OPTS) + +.PHONY: multimod-verify +multimod-verify: bin/multimod + @echo "Validating versions.yaml file" + $(MULTIMOD) verify + +.PHONY: multimod-prerelease +multimod-prerelease: bin/multimod + $(MULTIMOD) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false diff --git a/RELEASE.md b/RELEASE.md new file mode 100644 index 000000000..dc73ab820 --- /dev/null +++ b/RELEASE.md @@ -0,0 +1,26 @@ +# Release + +VMClarity adopted the [Go MultiMod Releaser](https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/multimod) to create a new release for each module. + +Find below the steps to create a release. + +## 1. Update the new release version + +Checkout to a new branch and update the version defined for VMClarity's module-set in `versions.yaml`. Please note that currently the same version is used for all methods. E.g. + +``` + vmclarity: +- version: v0.6.0 ++ version: v0.7.0 +``` + +Commit this change and verify the versioning with `make multimod-verify`. + +## 2. Bump all dependencies to new release version + +To update all `go.mod` files with the new release version, run `make multimod-prerelease` and review the changes in the last commit. + +## 3. Tag the new release commit + +## 4. Release + From 5f522da2ed95a803250e3f3c0bdad2c1d7daa415 Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Fri, 9 Feb 2024 13:04:52 +0000 Subject: [PATCH 04/10] feat: add create and push tags --- Makefile | 7 +++++++ RELEASE.md | 7 +++++-- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 022d31fce..deb61d7d6 100644 --- a/Makefile +++ b/Makefile @@ -500,3 +500,10 @@ multimod-verify: bin/multimod .PHONY: multimod-prerelease multimod-prerelease: bin/multimod $(MULTIMOD) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false + +.PHONY: multimod-push-tags +multimod-push-tags: bin/multimod + set -e; for tag in `$(MULTIMOD) tag --module-set-name vmclarity --commit-hash HEAD --print-tags | grep -v "Using" `; do \ + echo "pushing tag $${tag}"; \ + git push origin $${tag}; \ + done; diff --git a/RELEASE.md b/RELEASE.md index dc73ab820..84774f3f5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -18,9 +18,12 @@ Commit this change and verify the versioning with `make multimod-verify`. ## 2. Bump all dependencies to new release version -To update all `go.mod` files with the new release version, run `make multimod-prerelease` and review the changes in the last commit. +To update all `go.mod` files with the new release version, run `make multimod-prerelease` and review the changes in the last commit. Then, create a pull request. -## 3. Tag the new release commit +## 3. Create and push tags + +Once the previous changes have been approved and merged, pull the latest changes in the `main` branch. Then, create the tags for the last commit and push them with `make multimod-push-tags`. ## 4. Release +Finally, create a Release on GitHub. From a139f28f5684bc5a5b7ddc5b47652c954bff7a4a Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Mon, 12 Feb 2024 18:12:05 +0000 Subject: [PATCH 05/10] docs: improve release instructions --- .github/workflows/semantic-pr.yml | 1 + RELEASE.md | 56 ++++++++++++++++++++++++------- versions.yaml | 2 +- 3 files changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index 040787fea..0636f7402 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -34,6 +34,7 @@ jobs: revert style test + release scopes: | api diff --git a/RELEASE.md b/RELEASE.md index 84774f3f5..8e73fe53d 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -1,29 +1,61 @@ # Release -VMClarity adopted the [Go MultiMod Releaser](https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/multimod) to create a new release for each module. +This document outlines the process for creating a new release for VMClarity using the [Go MultiMod Releaser](https://github.com/open-telemetry/opentelemetry-go-build-tools/tree/main/multimod). All code block examples provided below correspond to an update to version `v0.7.0`, please update accordingly. -Find below the steps to create a release. +## 1. Update the New Release Version -## 1. Update the new release version - -Checkout to a new branch and update the version defined for VMClarity's module-set in `versions.yaml`. Please note that currently the same version is used for all methods. E.g. +* Create a new branch for the release version update. +```sh +git checkout -b release/v0.7.0 +``` +* Modify the `versions.yaml` file to update the version for VMClarity's module-set. Keep in mind that the same version is applied to all modules. ``` vmclarity: - version: v0.6.0 + version: v0.7.0 ``` -Commit this change and verify the versioning with `make multimod-verify`. +* Commit the changes with a suitable message. +```sh +git add versions.yaml +git commit -m "release: update module set to version v0.7.0" +``` + +* Run the version verification command to check for any issues. +```sh +make multimod-verify +``` + +## 2. Bump All Dependencies to the New Release Version -## 2. Bump all dependencies to new release version +* Run the following command to update all `go.mod` files to the new release version. +```sh +make multimod-prerelease +``` + +* Review the changes made in the last commit to ensure correctness. + +* Push the branch to the GitHub repository. +```sh +git push origin release/v0.7.0 +``` -To update all `go.mod` files with the new release version, run `make multimod-prerelease` and review the changes in the last commit. Then, create a pull request. +* Create a pull request with the changes. -## 3. Create and push tags +## 3. Create and Push Tags -Once the previous changes have been approved and merged, pull the latest changes in the `main` branch. Then, create the tags for the last commit and push them with `make multimod-push-tags`. +* After the pull request is approved and merged, update your local main branch. +```sh +git checkout main +git pull origin main +``` -## 4. Release +* Create and push the tags for the last commit to the repository. +```sh +make multimod-push-tags +``` -Finally, create a Release on GitHub. +## Post-release Checks +Verify that the `Release` workflow was completed successfully in the GitHub Actions section. +Ensure that the release is visible in the GitHub releases page. Additionally, check that the release description is correct and all assets are listed. diff --git a/versions.yaml b/versions.yaml index 820b3bf00..ce40adcd3 100644 --- a/versions.yaml +++ b/versions.yaml @@ -18,4 +18,4 @@ module-sets: - github.com/openclarity/vmclarity/containerruntimediscovery/types - github.com/openclarity/vmclarity/containerruntimediscovery/server - github.com/openclarity/vmclarity/containerruntimediscovery/client - - github.com/openclarity/vmclarity/orchestrator \ No newline at end of file + - github.com/openclarity/vmclarity/orchestrator From f37c46a3163290c53767e3589c3487ff34a3910c Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Thu, 15 Feb 2024 13:00:10 +0000 Subject: [PATCH 06/10] refactor: code review --- Makefile | 6 +++--- RELEASE.md | 2 +- makefile.d/20-tools.mk | 1 - 3 files changed, 4 insertions(+), 5 deletions(-) diff --git a/Makefile b/Makefile index deb61d7d6..9f11e5326 100644 --- a/Makefile +++ b/Makefile @@ -495,15 +495,15 @@ $(DIST_DIR)/CHANGELOG.md: $(ROOT_DIR)/cliff.toml bin/git-cliff | $(DIST_DIR) .PHONY: multimod-verify multimod-verify: bin/multimod @echo "Validating versions.yaml file" - $(MULTIMOD) verify + $(MULTIMOD_BIN) verify .PHONY: multimod-prerelease multimod-prerelease: bin/multimod - $(MULTIMOD) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false + $(MULTIMOD_BIN) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false .PHONY: multimod-push-tags multimod-push-tags: bin/multimod - set -e; for tag in `$(MULTIMOD) tag --module-set-name vmclarity --commit-hash HEAD --print-tags | grep -v "Using" `; do \ + set -e; for tag in `$(MULTIMOD_BIN) tag --module-set-name vmclarity --commit-hash HEAD --print-tags | grep -v "Using" `; do \ echo "pushing tag $${tag}"; \ git push origin $${tag}; \ done; diff --git a/RELEASE.md b/RELEASE.md index 8e73fe53d..48fa8e00c 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -10,7 +10,7 @@ git checkout -b release/v0.7.0 ``` * Modify the `versions.yaml` file to update the version for VMClarity's module-set. Keep in mind that the same version is applied to all modules. -``` +```diff vmclarity: - version: v0.6.0 + version: v0.7.0 diff --git a/makefile.d/20-tools.mk b/makefile.d/20-tools.mk index 3248b0d52..bb193b321 100644 --- a/makefile.d/20-tools.mk +++ b/makefile.d/20-tools.mk @@ -238,7 +238,6 @@ bin/typos-$(TYPOS_VERSION): | $(BIN_DIR) MULTIMOD_BIN := $(BIN_DIR)/multimod MULTIMOD_REPO_DIR := $(BIN_DIR)/opentelemetry-go-build-tools -MULTIMOD := $(BIN_DIR)/multimod bin/multimod: @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone git@github.com:open-telemetry/opentelemetry-go-build-tools.git $(MULTIMOD_REPO_DIR); fi From 2c96a5343240e75b8bae726f55f1b6a5fe3a7366 Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Tue, 27 Feb 2024 14:21:03 +0000 Subject: [PATCH 07/10] feat: create module tags once release is published --- .github/workflows/post-release.yaml | 44 +++++++++++++++++++++++++++++ .github/workflows/release.yaml | 22 --------------- Makefile | 7 ----- RELEASE.md | 9 ++++-- 4 files changed, 50 insertions(+), 32 deletions(-) create mode 100644 .github/workflows/post-release.yaml diff --git a/.github/workflows/post-release.yaml b/.github/workflows/post-release.yaml new file mode 100644 index 000000000..b903783f5 --- /dev/null +++ b/.github/workflows/post-release.yaml @@ -0,0 +1,44 @@ +name: Post Release +on: + release: + types: [published] + +jobs: + prepare: + name: Prepare + runs-on: ubuntu-latest + outputs: + modules: ${{ steps.modules.outputs.modules }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Get modules + id: modules + run: | + # shellcheck disable=SC2016 + echo "modules=$(find . -name go.mod -type f -print0 | xargs -0 awk '/module/ {print $2}' | jq -c -R '[.,inputs] | map(sub("^github.com\/openclarity\/vmclarity\/";""))')" >> "$GITHUB_OUTPUT" + + create_module_tags: + needs: + - prepare + name: Create module tags + runs-on: ubuntu-latest + strategy: + matrix: + tags: ${{ fromJson(needs.prepare.outputs.modules) }} + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + + - name: Create tags + uses: actions/github-script@v7 + with: + github-token: ${{ secrets.GITHUB_TOKEN }} + script: | + github.rest.git.createRef({ + owner: context.repo.owner, + repo: context.repo.repo, + ref: 'refs/tags/${{ matrix.tags }}/${{ github.ref_name }}', + sha: context.sha + }) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index b97757366..0ce7b00ce 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -151,25 +151,3 @@ jobs: draft: true name: "Release ${{ github.ref_name }}" updateOnlyUnreleased: true - - # TODO(sambetts) We need to publish a tag in the format "api/" tag - # so that go mod is able to import the api module without overriding. We need - # to work out how to do this cleanly from github actions on release so that - # we don't need to manage it manually. We could do something this which will - # create another release: - # - # api_release: - # needs: release - # name: Release API Module - # runs-on: ubuntu-latest - # steps: - # - name: Checkout - # uses: actions/checkout@v4 - # with: - # fetch-depth: 0 - # - name: Release API - # uses: softprops/action-gh-release@v1 - # with: - # name: VMClarity {{ github.ref }} API - # body: See main {{ github.ref }} release for release notes. - # tag_name: api/{{ github.ref }} diff --git a/Makefile b/Makefile index 9f11e5326..b90bfdc99 100644 --- a/Makefile +++ b/Makefile @@ -500,10 +500,3 @@ multimod-verify: bin/multimod .PHONY: multimod-prerelease multimod-prerelease: bin/multimod $(MULTIMOD_BIN) prerelease --all-module-sets --skip-go-mod-tidy=true --commit-to-different-branch=false - -.PHONY: multimod-push-tags -multimod-push-tags: bin/multimod - set -e; for tag in `$(MULTIMOD_BIN) tag --module-set-name vmclarity --commit-hash HEAD --print-tags | grep -v "Using" `; do \ - echo "pushing tag $${tag}"; \ - git push origin $${tag}; \ - done; diff --git a/RELEASE.md b/RELEASE.md index 48fa8e00c..4e42e7ebb 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -41,7 +41,7 @@ make multimod-prerelease git push origin release/v0.7.0 ``` -* Create a pull request with the changes. +* Create a pull request for these changes with a title like "release: prepare version v0.7.0". ## 3. Create and Push Tags @@ -51,11 +51,14 @@ git checkout main git pull origin main ``` -* Create and push the tags for the last commit to the repository. +* To trigger the release workflow, create and push to the repository a release tag for the last commit. ```sh -make multimod-push-tags +git tag -a v0.7.0 +git push origin v0.7.0 ``` +Please note that the release tag is not necessarily associated with the "release: prepare version v0.7.0" commit. For example, if any bug fixes were required after this commit, they can be merged and included in the release. + ## Post-release Checks Verify that the `Release` workflow was completed successfully in the GitHub Actions section. Ensure that the release is visible in the GitHub releases page. Additionally, check that the release description is correct and all assets are listed. From ff0861874f0654ec14321fe4e3d97fa26e17e064 Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Thu, 7 Mar 2024 14:25:54 +0000 Subject: [PATCH 08/10] docs: improve release instructions --- RELEASE.md | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/RELEASE.md b/RELEASE.md index 4e42e7ebb..172a4c4d5 100644 --- a/RELEASE.md +++ b/RELEASE.md @@ -59,6 +59,10 @@ git push origin v0.7.0 Please note that the release tag is not necessarily associated with the "release: prepare version v0.7.0" commit. For example, if any bug fixes were required after this commit, they can be merged and included in the release. -## Post-release Checks -Verify that the `Release` workflow was completed successfully in the GitHub Actions section. -Ensure that the release is visible in the GitHub releases page. Additionally, check that the release description is correct and all assets are listed. +## 4. Publish release + +* Wait until the release workflow is completed successfully. + +* Navigate to the [Releases page](https://github.com/openclarity/vmclarity/releases) and verify the draft release description as well as the assets listed. + +* Once the draft release has been verified, click on `Edit` release and then on `Publish Release`. From 177876796974f89a7b19f6c4cc26cbee5cd5036d Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Thu, 7 Mar 2024 17:01:22 +0000 Subject: [PATCH 09/10] release: pin multimod version --- makefile.d/20-tools.mk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/makefile.d/20-tools.mk b/makefile.d/20-tools.mk index bb193b321..e0437b79a 100644 --- a/makefile.d/20-tools.mk +++ b/makefile.d/20-tools.mk @@ -240,6 +240,6 @@ MULTIMOD_BIN := $(BIN_DIR)/multimod MULTIMOD_REPO_DIR := $(BIN_DIR)/opentelemetry-go-build-tools bin/multimod: - @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone git@github.com:open-telemetry/opentelemetry-go-build-tools.git $(MULTIMOD_REPO_DIR); fi - @cd $(MULTIMOD_REPO_DIR)/multimod && go build -o $(MULTIMOD_BIN) main.go + @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone git@github.com:open-telemetry/opentelemetry-go-build-tools.git --branch multimod/v0.13.0 $(MULTIMOD_REPO_DIR); fi + @go build -C $(MULTIMOD_REPO_DIR)/multimod -o $(MULTIMOD_BIN) main.go @rm -rf $(MULTIMOD_REPO_DIR) From 753ee72d432732df31286ad67b37cbb138c81210 Mon Sep 17 00:00:00 2001 From: Catarina Paralta <46568597+paralta@users.noreply.github.com> Date: Fri, 8 Mar 2024 11:09:42 +0000 Subject: [PATCH 10/10] refactor: clone with https Co-authored-by: Ramiz Polic <32913827+ramizpolic@users.noreply.github.com> --- makefile.d/20-tools.mk | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/makefile.d/20-tools.mk b/makefile.d/20-tools.mk index e0437b79a..97d4f54b6 100644 --- a/makefile.d/20-tools.mk +++ b/makefile.d/20-tools.mk @@ -236,10 +236,11 @@ bin/typos-$(TYPOS_VERSION): | $(BIN_DIR) ## Go MultiMod Releaser #### +MULTIMOD_VERSION := 0.13.0 MULTIMOD_BIN := $(BIN_DIR)/multimod MULTIMOD_REPO_DIR := $(BIN_DIR)/opentelemetry-go-build-tools bin/multimod: - @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone git@github.com:open-telemetry/opentelemetry-go-build-tools.git --branch multimod/v0.13.0 $(MULTIMOD_REPO_DIR); fi + @if [ ! -d $(MULTIMOD_REPO_DIR) ]; then git clone https://github.com/open-telemetry/opentelemetry-go-build-tools --branch multimod/v$(MULTIMOD_VERSION) $(MULTIMOD_REPO_DIR); fi @go build -C $(MULTIMOD_REPO_DIR)/multimod -o $(MULTIMOD_BIN) main.go @rm -rf $(MULTIMOD_REPO_DIR)