Skip to content

Commit

Permalink
Merge pull request #37 from ydb-platform/improve-started-filter
Browse files Browse the repository at this point in the history
  • Loading branch information
shmel1k authored Oct 31, 2024
2 parents 930d5af + cee2544 commit 75a3bb8
Show file tree
Hide file tree
Showing 25 changed files with 190 additions and 192 deletions.
1 change: 1 addition & 0 deletions .changes/header.tpl.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
# Changelog
Empty file added .changes/unreleased/.gitkeep
Empty file.
11 changes: 11 additions & 0 deletions .changes/v0.0.11.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
## 0.0.11
+ `--started` and `--version` no longer silently include nodes, which did not have this info supplied by CMS at all (due to old YDB version).
Now `ydbops` explicitly refuses to add any nodes with empty start time or empty version and produces a warning.

## 0.0.10
+ `version` command
+ new release pipeline - modify CHANGELOG.md only, rest is automatic

## 0.0.9
+ Information about version in help output
+ Scripts for build release
3 changes: 3 additions & 0 deletions .changes/v0.0.12.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
## v0.0.12 - 2024-10-31
### Changed
* migrated to changie for keeping a changelog
26 changes: 26 additions & 0 deletions .changie.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
changesDir: .changes
unreleasedDir: unreleased
headerPath: header.tpl.md
changelogPath: CHANGELOG.md
versionExt: md
versionFormat: '## {{.Version}} - {{.Time.Format "2006-01-02"}}'
kindFormat: '### {{.Kind}}'
changeFormat: '* {{.Body}}'
kinds:
- label: Added
auto: minor
- label: Changed
auto: major
- label: Deprecated
auto: minor
- label: Removed
auto: major
- label: Fixed
auto: patch
- label: Security
auto: patch
newlines:
afterChangelogHeader: 1
beforeChangelogVersion: 1
endOfVersion: 1
envPrefix: CHANGIE_
11 changes: 0 additions & 11 deletions .github/scripts/check-work-copy-equals-to-committed.sh

This file was deleted.

22 changes: 0 additions & 22 deletions .github/scripts/format-all-go-code.sh

This file was deleted.

13 changes: 0 additions & 13 deletions .github/scripts/format-go-code.sh

This file was deleted.

10 changes: 0 additions & 10 deletions .github/scripts/is_autogenerated_file.sh

This file was deleted.

38 changes: 38 additions & 0 deletions .github/workflows/create-release-pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
name: create-release-pr

on:
workflow_dispatch:

jobs:
create-release-pr:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: batch-changes
uses: miniscruff/changie-action@v2
with:
version: latest
args: batch patch

- name: merge-changes
uses: miniscruff/changie-action@v2
with:
version: latest
args: merge

- name: print the latest version
id: latest
uses: miniscruff/changie-action@v2
with:
version: latest
args: latest

- name: Create Pull Request
uses: peter-evans/create-pull-request@v7
with:
title: Release ${{ steps.latest.outputs.output }}
branch: release/${{ steps.latest.outputs.output }}
commit-message: Release ${{ steps.latest.outputs.output }}
token: ${{ github.token }}
48 changes: 0 additions & 48 deletions .github/workflows/publish-release.yml

This file was deleted.

24 changes: 0 additions & 24 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,31 +27,7 @@ jobs:
with:
version: v1.61.0
args: --verbose --disable-all --new-from-rev=origin/master --enable wrapcheck,stylecheck,funlen,mnd,cyclop
autoformatter:
name: autoformat check
concurrency:
group: lint-autoformat-${{ github.ref }}
cancel-in-progress: true
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v3
with:
go-version: "1.21"

- name: Install utilities
run: |
go install mvdan.cc/[email protected]
go install github.com/rinchsan/gosimports/cmd/[email protected]
- name: format all files with auto-formatter
run: bash ./.github/scripts/format-all-go-code.sh "$PWD"

- name: Check repository diff
run: bash ./.github/scripts/check-work-copy-equals-to-committed.sh "auto-format broken"
tests:
name: run tests
concurrency:
Expand Down
41 changes: 41 additions & 0 deletions .github/workflows/tag-and-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: tag-and-release

on:
push:
branches:
- master
paths:
- 'CHANGELOG.md'
workflow_dispatch:

jobs:
tag-and-release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: get-the-latest-version
id: latest
uses: miniscruff/changie-action@v2
with:
version: latest
args: latest

- name: create-tag
uses: mathieudutour/[email protected]
with:
custom_tag: ${{ steps.latest.outputs.output }}
github_token: ${{ github.token }}

- name: build
run: |
APP_VERSION=${{ steps.latest.outputs.output }} make build-in-docker
- name: create-github-release
uses: softprops/action-gh-release@v1
with:
body_path: .changes/${{ steps.latest.outputs.output }}.md
files: bin/ydbops*
tag_name: ${{ steps.latest.outputs.output }}
env:
GITHUB_TOKEN: ${{ github.token }}
9 changes: 9 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,14 @@
# Changelog


## v0.0.12 - 2024-10-31
### Changed
* migrated to changie for keeping a changelog

## 0.0.11
+ `--started` and `--version` no longer silently include nodes, which did not have this info supplied by CMS at all (due to old YDB version).
Now `ydbops` explicitly refuses to add any nodes with empty start time or empty version and produces a warning.

## 0.0.10
+ `version` command
+ new release pipeline - modify CHANGELOG.md only, rest is automatic
Expand Down
7 changes: 5 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
BINARY_NAME=ydbops
BUILD_DIR=bin

APP_VERSION=$(shell cicd/version.sh)
TODAY=$(shell date --iso=minutes)
GIT_COMMIT=$(shell git rev-parse HEAD)

LDFLAGS="-X github.com/ydb-platform/ydbops/cmd/version.BuildVersion=${APP_VERSION} -X github.com/ydb-platform/ydbops/cmd/version.BuildTimestamp=${TODAY} -X github.com/ydb-platform/ydbops/cmd/version.BuildCommit=${GIT_COMMIT}"
# APP_VERSION gets supplied from outside in CI as an env variable.
# By default you can still build `ydbops` manually without specifying it,
# but there won't be a nice tag in `--version`. There will be a commit SHA anyway.
APP_VERSION ?= no-APP_VERSION-supplied-in-buildtime
LDFLAGS="-X github.com/ydb-platform/ydbops/cmd/version.BuildVersion=$(APP_VERSION) -X github.com/ydb-platform/ydbops/cmd/version.BuildTimestamp=${TODAY} -X github.com/ydb-platform/ydbops/cmd/version.BuildCommit=${GIT_COMMIT}"

all: build build-macos

Expand Down
58 changes: 31 additions & 27 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,23 +4,7 @@

For comprehensive documentation, refer to [ydb.tech](https://ydb.tech/docs/en/reference/ydbops/)

## Prerequisites:

1. Go 1.21

## How to build

Execute `make build-in-docker`, you will get binaries for Linux and MacOS, both amd and arm.

## How to run tests

Ginkgo testing library is used. Do:

```
ginkgo test -vvv ./tests
```

## How to use:
## Quick non-comprehensive cheatsheet:

Please browse the `ydbops --help` first. Then read along for examples (substitute your own values).

Expand Down Expand Up @@ -72,15 +56,35 @@ ydbops restart --storage \
--user jorres --kubeconfig ~/.kube/config
```

## How to create a new version
### In Github
1. Define new semver version number (e.g. 1.1.0)
2. Update CHANGELOG.md with proper information about new version. Add the following to the beginning of the file, before previous entries:
```
## <your-version-number>
---

## For developers:

- change 1
- change 2
### Prerequisites

- Go 1.21
- `changie` tool for keeping a changelog

### How to build

Execute `make build-in-docker`, you will get binaries for Linux and MacOS, both amd and arm.

### How to run tests

Ginkgo testing library is used. Do:

```
ginkgo test -vvv ./tests
```
3. Create a pull request, wait for it to be merged
4. Github actions will create both the tag and the release with binaries for all platforms

### How to develop

- develop a feature
- invoke `changie new` and complete a small interactive form
- don't forget to changie-generated file to your PR

### How to release a new version

1. Invoke `create-release-pr` job, it will create a PR with `CHANGELOG.md` containing all diffs
2. After making sure that `CHANGELOG.md` looks nice, just merge the PR from step 1, and the commit into master
will be automatically tagged, and a new release with new binaries will be automatically published!
27 changes: 0 additions & 27 deletions cicd/changelog.sh

This file was deleted.

Loading

0 comments on commit 75a3bb8

Please sign in to comment.