releasr

Crates.ioreleasr
lib.rsreleasr
version0.1.0
sourcesrc
created_at2022-07-03 20:07:42.709761
updated_at2022-07-03 20:07:42.709761
descriptionRelease note tracking on a per environment per semver release.
homepagehttps://github.com/Krakaw/releasr
repositoryhttps://github.com/Krakaw/releasr
max_upload_size
id618536
size91,656
Keith Simon (Krakaw)

documentation

README

Welcome to releasr 👋

Twitter: krakaw_1

Release note tracking on a per environment per semver release.

Ever delay a release and then forget the steps you need to run when it eventually does go out. Releasr is made for just those times. Attach version specific release notes and retrieve them when the deployment is ready to go out.

Every release note is attached to an environment. Once a note has been completed it won't be shown again.

Notes cannot be added to a version that has been completed already.

Install

cargo build --release
./target/release/releasr

Usage

cp .env.sample .env
./releasr

Create Environments

# Create a dev environment
curl http://localhost:8080/environments \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"name": "backend_dev", "version_url": "https://example.com/version.json", "last_deployed_version": 0}'

# Create a prod environment
curl http://localhost:8080/environments \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"name": "backend_prod", "version_url": "https://example.com/version.json", "last_deployed_version": 0}'

Attach notes for a version

# Attach a note to both environments
curl http://localhost:8080/notes \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"environment": "backend_*", "version": "1.0.0", "note": "Run initial migrations using `cargo run -- migrations`"}'
[
  {
    "id": 1,
    "version": "1.0.0",
    "version_int": 1000000,
    "note": "Run initial migrations using `cargo run -- migrations`",
    "environment": "backend_dev",
    "completed_at": null,
    "created_at": "2021-12-30T11:41:37.866539073Z",
    "modified_at": "2021-12-30T11:41:37.866539073Z"
  },
  {
    "id": 2,
    "version": "1.0.0",
    "version_int": 1000000,
    "note": "Run initial migrations using `cargo run -- migrations`",
    "environment": "backend_prod",
    "completed_at": null,
    "created_at": "2021-12-30T11:41:37.882175630Z",
    "modified_at": "2021-12-30T11:41:37.882175630Z"
  }
]
# Attach a note to a specific environment for another version
curl http://localhost:8080/notes \
  -X POST \
  -H 'Content-Type: application/json' \
  -d '{"environment": "backend_prod", "version": "1.0.1", "note": "Manually delete records from `table_x`"}'
[
  {
    "id": 3,
    "version": "1.0.1",
    "version_int": 1000001,
    "note": "Manually delete records from `table_x`",
    "environment": "backend_prod",
    "completed_at": null,
    "created_at": "2021-12-30T11:44:40.673926719Z",
    "modified_at": "2021-12-30T11:44:40.673926719Z"
  }
]

List pending notes

# To fetch all pending notes
curl http://localhost:8080/notes \
  -X GET \
  -H 'Content-Type: application/json'
[
  {
    "id": 1,
    "version": "1.0.0",
    "version_int": 1000000,
    "note": "Run initial migrations using `cargo run -- migrations`",
    "environment": "backend_dev",
    "completed_at": null,
    "created_at": "2021-12-30T11:41:37.866539073Z",
    "modified_at": "2021-12-30T11:41:37.866539073Z"
  },
  {
    "id": 2,
    "version": "1.0.0",
    "version_int": 1000000,
    "note": "Run initial migrations using `cargo run -- migrations`",
    "environment": "backend_prod",
    "completed_at": null,
    "created_at": "2021-12-30T11:41:37.882175630Z",
    "modified_at": "2021-12-30T11:41:37.882175630Z"
  },
  {
    "id": 3,
    "version": "1.0.1",
    "version_int": 1000001,
    "note": "Manually delete records from `table_x`",
    "environment": "backend_prod",
    "completed_at": null,
    "created_at": "2021-12-30T11:44:40.673926719Z",
    "modified_at": "2021-12-30T11:44:40.673926719Z"
  }
]
# To fetch specific pending notes for an environment and maximum version
curl http://localhost:8080/notes?environment=backend_prod&version=1.0.0 \
  -X GET \
  -H 'Content-Type: application/json'
[
  {
    "id": 2,
    "version": "1.0.0",
    "version_int": 1000000,
    "note": "Run initial migrations using `cargo run -- migrations`",
    "environment": "backend_prod",
    "completed_at": null,
    "created_at": "2021-12-30T11:41:37.882175630Z",
    "modified_at": "2021-12-30T11:41:37.882175630Z"
  }
]

Complete notes for an environment and version

# Once a deploy is complete and the notes have been executed, you can complete them.
curl http://localhost:8080/notes \
  -X PATCH \
  -H 'Content-Type: application/json' \
  -d '{"environment": "backend_dev", "version": "1.0.1"}'
{
  "completed_count": 1,
  "environment": {
    "last_deployed_version": 1000001,
    "name": "backend_dev",
    "version_url": "https://example.com/version.json"
  }
}

Delete a note permanently

# Delete a note using its `id`
curl http://localhost:8080/notes/2 \
  -X DELETE \
  -H 'Content-Type: application/json'
{
  "id": 2,
  "version": "1.0.0",
  "version_int": 1000000,
  "note": "Run initial migrations using `cargo run -- migrations`",
  "environment": "backend_prod",
  "completed_at": null,
  "created_at": "2021-12-30T11:41:37.882175630Z",
  "modified_at": "2021-12-30T11:41:37.882175630Z"
}

Test

cargo test

Author

👤 Krakaw

Show your support

Give a ⭐️ if this project helped you!


This README was generated with ❤️ by readme-md-generator

Commit count: 30

cargo fmt