diff --git a/CHANGELOG.md b/CHANGELOG.md index a739077355..548c4267ab 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,90 +1,97 @@ - -## [v0.9.0-rc3](https://github.com/garden-io/garden/compare/v0.9.0-rc2...v0.9.0-rc3) (2019-02-06) -### Bug Fixes - -* **core:** missing module configs in dumpConfig response ([c8609a2](https://github.com/garden-io/garden/commit/c8609a2)) -* **core:** error in actions.getStatus helper ([a4cf625](https://github.com/garden-io/garden/commit/a4cf625)) -* **dashboard:** handle empty ingress in service status ([870d5f3](https://github.com/garden-io/garden/commit/870d5f3)) -* **dashboard:** conform to new "get config" response ([bfa2c0f](https://github.com/garden-io/garden/commit/bfa2c0f)) - -### Code Refactoring - -* remove experimental Go CLI ([e9ef3aa](https://github.com/garden-io/garden/commit/e9ef3aa)) -* **go-cli:** replace unison with mutagen (wip) ([b7a0d33](https://github.com/garden-io/garden/commit/b7a0d33)) - - -## [v0.9.0-rc2](https://github.com/garden-io/garden/compare/v0.9.0-rc1...v0.9.0-rc2) (2019-02-04) + +## [v0.9.1](https://github.com/garden-io/garden/compare/v0.9.0...v0.9.1) (2019-02-12) ### Bug Fixes -* **core:** using module version in templates didn't work with watch ([6c209af](https://github.com/garden-io/garden/commit/6c209af)) -* **core:** certain template strings could not be resolved in configs ([3d582c4](https://github.com/garden-io/garden/commit/3d582c4)) -* **get-tasks:** print msg if no tasks found ([f64d59c](https://github.com/garden-io/garden/commit/f64d59c)) -* **k8s:** incorrect role binding for tiller service account ([9a61840](https://github.com/garden-io/garden/commit/9a61840)) -* **openfaas:** override release name to avoid conflict across namespaces ([2eea9bd](https://github.com/garden-io/garden/commit/2eea9bd)) -* **server:** ensure log entries have level silly ([#496](https://github.com/garden-io/garden/issues/496)) ([5b11322](https://github.com/garden-io/garden/commit/5b11322)) +* **dashboard:** set min select width ([06386bf](https://github.com/garden-io/garden/commit/06386bf)) +* **server:** serve dashboard from all dashboard routes ([5abf580](https://github.com/garden-io/garden/commit/5abf580)) -### Code Refactoring - -* **commands:** remove create commands ([88d18d8](https://github.com/garden-io/garden/commit/88d18d8)) -* **logger:** rename preserveLevel opt to childEntriesInheritLevel ([0b3efab](https://github.com/garden-io/garden/commit/0b3efab)) - -### BREAKING CHANGE - - -Module configurations using the `services` template key need to be -updated to use `modules` instead. +### Features -The (admittedly poorly supported) google-cloud-function module type has -been changed to include only one function per module. This is more -consistent with other module types, and avoids complex refactoring -to fit with the changes in the templating context. +* **dashboard:** update font colour ([dccbf87](https://github.com/garden-io/garden/commit/dccbf87)) +* **dashboard:** conform colours to style guide ([44b54e0](https://github.com/garden-io/garden/commit/44b54e0)) +* **dashboard:** ui improvments ([4d38659](https://github.com/garden-io/garden/commit/4d38659)) +* **dashboard:** enable by default ([574f56d](https://github.com/garden-io/garden/commit/574f56d)) -After this, the `create project` and `create module` commands will no -longer be available. We're removing them for now because currently -they're more confusing than they are useful. There's an open Github} - -## [v0.9.0-rc1](https://github.com/garden-io/garden/compare/v0.8.1...v0.9.0-rc1) (2019-01-28) + +## [v0.9.0](https://github.com/garden-io/garden/compare/v0.8.1...v0.9.0) (2019-02-08) ### Bug Fixes +* improved error messages when deps are missing ([#484](https://github.com/garden-io/garden/issues/484)) ([c5e6dce](https://github.com/garden-io/garden/commit/c5e6dce)) +* add path to module validation error messages ([b1c54b0](https://github.com/garden-io/garden/commit/b1c54b0)) +* delete outdated system namespaces ([cda0c7c](https://github.com/garden-io/garden/commit/cda0c7c)) * add missing package to garden-service/package.json ([4688e56](https://github.com/garden-io/garden/commit/4688e56)) * don't watch project-level log files ([81c8d04](https://github.com/garden-io/garden/commit/81c8d04)) -* add path to module validation error messages ([b1c54b0](https://github.com/garden-io/garden/commit/b1c54b0)) +* **core:** error in actions.getStatus helper ([a4cf625](https://github.com/garden-io/garden/commit/a4cf625)) +* **core:** missing module configs in dumpConfig response ([c8609a2](https://github.com/garden-io/garden/commit/c8609a2)) +* **core:** using module version in templates didn't work with watch ([6c209af](https://github.com/garden-io/garden/commit/6c209af)) +* **core:** certain template strings could not be resolved in configs ([3d582c4](https://github.com/garden-io/garden/commit/3d582c4)) +* **dashboard:** conform to new "get config" response ([bfa2c0f](https://github.com/garden-io/garden/commit/bfa2c0f)) +* **dashboard:** handle empty ingress in service status ([870d5f3](https://github.com/garden-io/garden/commit/870d5f3)) * **dashboard:** limit number of log lines that are fetched ([#461](https://github.com/garden-io/garden/issues/461)) ([3c214ce](https://github.com/garden-io/garden/commit/3c214ce)) +* **deploy:** make watch parameter implicit when hot-reloading ([0819605](https://github.com/garden-io/garden/commit/0819605)) * **exec:** missing tasks key in module schema ([cc13f33](https://github.com/garden-io/garden/commit/cc13f33)) -* **get-tasks:** print msg if no tasks found ([0868a98](https://github.com/garden-io/garden/commit/0868a98)) +* **get-tasks:** print msg if no tasks found ([f64d59c](https://github.com/garden-io/garden/commit/f64d59c)) +* **k8s:** configure RBAC properly for Tiller ([d182929](https://github.com/garden-io/garden/commit/d182929)) +* **k8s:** fix issue with log following for K8s ([6624964](https://github.com/garden-io/garden/commit/6624964)) +* **k8s:** incorrect role binding for tiller service account ([9a61840](https://github.com/garden-io/garden/commit/9a61840)) +* **logger:** only inherit parent level if option is set ([#493](https://github.com/garden-io/garden/issues/493)) ([99fdb12](https://github.com/garden-io/garden/commit/99fdb12)) +* **openfaas:** override release name to avoid conflict across namespaces ([2eea9bd](https://github.com/garden-io/garden/commit/2eea9bd)) * **perf:** reuse port-forwards when hot-reloading ([6db83a7](https://github.com/garden-io/garden/commit/6db83a7)) +* **server:** ensure log entries have level silly ([#496](https://github.com/garden-io/garden/issues/496)) ([5b11322](https://github.com/garden-io/garden/commit/5b11322)) +* **status:** return more correct/granular statuses ([d4a7cf2](https://github.com/garden-io/garden/commit/d4a7cf2)) ### Code Refactoring * add configureProvider plugin action ([bdf6994](https://github.com/garden-io/garden/commit/bdf6994)) -* rename `validate` module action to `configure` ([7b02fdd](https://github.com/garden-io/garden/commit/7b02fdd)) -* use events for file watching instead of callbacks ([f6a99c2](https://github.com/garden-io/garden/commit/f6a99c2)) * rename `generic` plugin to `exec` ([4c85d46](https://github.com/garden-io/garden/commit/4c85d46)) +* use events for file watching instead of callbacks ([f6a99c2](https://github.com/garden-io/garden/commit/f6a99c2)) +* rename `validate` module action to `configure` ([7b02fdd](https://github.com/garden-io/garden/commit/7b02fdd)) +* allow consecutive dashes in identifier regex ([37fe9c3](https://github.com/garden-io/garden/commit/37fe9c3)) +* remove experimental Go CLI ([e9ef3aa](https://github.com/garden-io/garden/commit/e9ef3aa)) +* **commands:** remove create commands ([88d18d8](https://github.com/garden-io/garden/commit/88d18d8)) * **dashboard:** use React Hooks API for state management ([588dd6c](https://github.com/garden-io/garden/commit/588dd6c)) * **dashboard:** rename root dir to dashboard ([6b48430](https://github.com/garden-io/garden/commit/6b48430)) -* **k8s:** shorten default namespace names ([15aa5de](https://github.com/garden-io/garden/commit/15aa5de)) +* **go-cli:** replace unison with mutagen (wip) ([b7a0d33](https://github.com/garden-io/garden/commit/b7a0d33)) * **k8s:** minor change to speed up container deploys ([91da102](https://github.com/garden-io/garden/commit/91da102)) +* **k8s:** shorten default namespace names ([15aa5de](https://github.com/garden-io/garden/commit/15aa5de)) +* **logger:** remove root prop from LogNode class ([b1e8fa6](https://github.com/garden-io/garden/commit/b1e8fa6)) +* **logger:** rename preserveLevel opt to childEntriesInheritLevel ([0b3efab](https://github.com/garden-io/garden/commit/0b3efab)) ### Features -* add servicePort config option ([57b23f3](https://github.com/garden-io/garden/commit/57b23f3)) -* added get tasks command ([250315d](https://github.com/garden-io/garden/commit/250315d)) * rename command to args for container type ([84f5a8d](https://github.com/garden-io/garden/commit/84f5a8d)) +* added get tasks command ([250315d](https://github.com/garden-io/garden/commit/250315d)) +* add servicePort config option ([57b23f3](https://github.com/garden-io/garden/commit/57b23f3)) +* **cli:** add --hot alias for --hot-reload flag ([22ac4f6](https://github.com/garden-io/garden/commit/22ac4f6)) * **dashboard:** update UI (closes [#460](https://github.com/garden-io/garden/issues/460)) ([e59897c](https://github.com/garden-io/garden/commit/e59897c)) * **dashboard:** expose provider links in sidebar ([48c9e13](https://github.com/garden-io/garden/commit/48c9e13)) * **k8s:** add Helm module inheritance via the `base` field ([8a7a7e5](https://github.com/garden-io/garden/commit/8a7a7e5)) * **k8s:** proper support for Helm charts ([48f0375](https://github.com/garden-io/garden/commit/48f0375)) * **k8s:** make hot reloading work for remote clusters ([7ca3dc3](https://github.com/garden-io/garden/commit/7ca3dc3)) +* **k8s:** allow overriding release name in Helm modules ([1530105](https://github.com/garden-io/garden/commit/1530105)) * **k8s:** allow disabling nginx setup in local-kubernetes provider ([33511bc](https://github.com/garden-io/garden/commit/33511bc)) +* **logger:** allow controlling level with env var ([#452](https://github.com/garden-io/garden/issues/452)) ([ec8bd45](https://github.com/garden-io/garden/commit/ec8bd45)) * **versioncmd:** add version command ([8be4761](https://github.com/garden-io/garden/commit/8be4761)) ### BREAKING CHANGE +Module configurations using the `services` template key need to be +updated to use `modules` instead. + +The (admittedly poorly supported) google-cloud-function module type has +been changed to include only one function per module. This is more +consistent with other module types, and avoids complex refactoring +to fit with the changes in the templating context. + +After this, the `create project` and `create module` commands will no +longer be available. We're removing them for now because currently +they're more confusing than they are useful. There's an open Github + We no longer default to "nginx" as the ingress class to annotation container module ingresses. If you need it configured, you need to set it via the `ingressClass` parameter in the `local-kubernetes` provider @@ -111,43 +118,28 @@ and the old namespace needs to be manually removed. Projects using the `generic` module type need to update the relevant `garden.yml` files, to reference the `exec` module type instead. -The `--tail|-t` flag for the `garden logs` command now takes an integer parameter -and specifies the number of log lines to display, whereas previously it was a boolean -flag that determined whether or not to stream the logs. For streaming, we now have -the `--follow|-f` flag. This conforms to other similar CLI tools. -## [v0.8.1](https://github.com/garden-io/garden/compare/v0.8.1-rc1...v0.8.1) (2018-12-10) +## [v0.8.1](https://github.com/garden-io/garden/compare/v0.8.0...v0.8.1) (2018-12-10) ### Bug Fixes -* **dashboard:** fix contants import in setupProxy.js ([e2c5bbd](https://github.com/garden-io/garden/commit/e2c5bbd)) -* **k8s:** revert removal of `-i` flag on kubectl run commands ([663deea](https://github.com/garden-io/garden/commit/663deea)) -* **k8s:** incorrect flags sent to `kubectl run` when not interactive ([260b976](https://github.com/garden-io/garden/commit/260b976)) -* **log:** log footer line was duplicated after config reload ([a8b50b1](https://github.com/garden-io/garden/commit/a8b50b1)) -* **tasks:** task errors had lost their color ([66390e1](https://github.com/garden-io/garden/commit/66390e1)) - -### Code Refactoring - -* **task-graph:** add task key to TaskResult interface ([3ce6633](https://github.com/garden-io/garden/commit/3ce6633)) - - - -## [v0.8.1-rc1](https://github.com/garden-io/garden/compare/v0.8.0...v0.8.1-rc1) (2018-12-10) - -### Bug Fixes - -* do not run dependant tasks unless updated services depend on them ([1ae0284](https://github.com/garden-io/garden/commit/1ae0284)) * minor logging issue ([61e4428](https://github.com/garden-io/garden/commit/61e4428)) -* stale version in some tasks triggered by watch handler ([da134b4](https://github.com/garden-io/garden/commit/da134b4)) -* performance regression on startup ([b856e36](https://github.com/garden-io/garden/commit/b856e36)) -* fixed another dependency calculation bug ([99df5d9](https://github.com/garden-io/garden/commit/99df5d9)) -* fixed dependency bug & simplified TaskGraph ([4a8428c](https://github.com/garden-io/garden/commit/4a8428c)) * make dev cmd consistent with deploy cmd ([85f31f9](https://github.com/garden-io/garden/commit/85f31f9)) +* fixed dependency bug & simplified TaskGraph ([4a8428c](https://github.com/garden-io/garden/commit/4a8428c)) +* fixed another dependency calculation bug ([99df5d9](https://github.com/garden-io/garden/commit/99df5d9)) +* performance regression on startup ([b856e36](https://github.com/garden-io/garden/commit/b856e36)) +* do not run dependant tasks unless updated services depend on them ([1ae0284](https://github.com/garden-io/garden/commit/1ae0284)) +* stale version in some tasks triggered by watch handler ([da134b4](https://github.com/garden-io/garden/commit/da134b4)) * fix dev command terminating on config change ([261e974](https://github.com/garden-io/garden/commit/261e974)) +* **dashboard:** fix contants import in setupProxy.js ([e2c5bbd](https://github.com/garden-io/garden/commit/e2c5bbd)) * **k8s:** exec and run commands didn't work properly in interactive mode ([420953d](https://github.com/garden-io/garden/commit/420953d)) +* **k8s:** revert removal of `-i` flag on kubectl run commands ([663deea](https://github.com/garden-io/garden/commit/663deea)) * **k8s:** log tailing now returns logs for new pods at runtime ([432e6dc](https://github.com/garden-io/garden/commit/432e6dc)) * **k8s:** remove replicasets and daemonsets when deleting services ([6c63314](https://github.com/garden-io/garden/commit/6c63314)) +* **k8s:** incorrect flags sent to `kubectl run` when not interactive ([260b976](https://github.com/garden-io/garden/commit/260b976)) +* **log:** log footer line was duplicated after config reload ([a8b50b1](https://github.com/garden-io/garden/commit/a8b50b1)) +* **tasks:** task errors had lost their color ([66390e1](https://github.com/garden-io/garden/commit/66390e1)) ### Code Refactoring @@ -156,6 +148,7 @@ the `--follow|-f` flag. This conforms to other similar CLI tools. * add placeholder method to logger + fix rendering issues ([fa8d81e](https://github.com/garden-io/garden/commit/fa8d81e)) * rename logEntry to log and require for tests, cmds and actions ([13cf263](https://github.com/garden-io/garden/commit/13cf263)) * **formatting:** improve quoting style of objects to consistent-as-needed ([687c6f3](https://github.com/garden-io/garden/commit/687c6f3)) +* **task-graph:** add task key to TaskResult interface ([3ce6633](https://github.com/garden-io/garden/commit/3ce6633)) ### Features @@ -434,11 +427,7 @@ The `tests[].variables` config key has been removed from the -## [v0.2.0](https://github.com/garden-io/garden/compare/v0.2.0-0...v0.2.0) (2018-06-27) - - - -## [v0.2.0-0](https://github.com/garden-io/garden/compare/v0.1.2...v0.2.0-0) (2018-06-27) +## [v0.2.0](https://github.com/garden-io/garden/compare/v0.1.2...v0.2.0) (2018-06-27) ### Bug Fixes @@ -499,11 +488,7 @@ project.global key. -## [v0.1.2](https://github.com/garden-io/garden/compare/v0.1.1-0...v0.1.2) (2018-06-02) - - - -## [v0.1.1-0](https://github.com/garden-io/garden/compare/v0.1.0...v0.1.1-0) (2018-06-02) +## [v0.1.2](https://github.com/garden-io/garden/compare/v0.1.0...v0.1.2) (2018-06-02) ### Bug Fixes @@ -635,3 +620,4 @@ environment configuration with a global configuration specified on the new `global` key in the project config. The schema for the `providers` key also different - its keys should now match plugin names, and contain configuration for those plugins. + diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 919b477423..a257e78725 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -104,7 +104,7 @@ Our release process generates the following packages: To make a new release, set your current working directory to the garden root directory and follow the steps below. -1. Run the release script: `./bin/release `. The script does the following: +1. Run the release script: `./bin/release.tsx [--force]`. The script does the following: * Checks out a branch named `release-`. * Updates `package.json` and `package-lock.json` for `garden-service` and the changelog. * Commits the changes, tags the commit and pushes the tag, triggering a CI process the creates the release artifacts. @@ -112,7 +112,11 @@ To make a new release, set your current working directory to the garden root dir 3. Go to our Github [Releases tab](https://github.com/garden-io/garden/releases) and click the **Draft a new release** button. 4. Fill in the **Tag version** and **Release title** fields with the new release version (same as you used for the tag). 5. Upload the downloaded artifacts. -6. Write release notes (not necessary for RCs). The notes should _at least_ contain the changelog. +6. Write release notes (not necessary for RCs). The notes should _at least_ contain the changelog. To generate a changelog for just that tag, run `git-chglog `. 7. Click the **Publish release** button. 8. Push the branch and make a pull request. 9. If you're making an RC, you're done! Otherwise, you need to update Homebrew package: `gulp update-brew`. + +## Changelog + +We keep a changelog under `CHANGELOG.md` that get's updated on every release. For pre-releases, we include every pre-release tag in that release cycle in the changelog. So if we're releasing, say, `v0.9.1-3`, the changelog will include entries for `v0.9.1-0`, `v0.9.1-1`, `v0.9.1-2`, assuming those tags exist. Once we make a proper release, we remove the pre-release tags so that the changelog only shows changes between `v0.9.0` and `v0.9.1`. A changelog with the pre-releases is of course always available in our Git history. diff --git a/README.md b/README.md index 3892f90005..3da53031f6 100644 --- a/README.md +++ b/README.md @@ -28,7 +28,7 @@ You can find the Garden documentation at [https://docs.garden.io](https://docs.g Overview: - [Basics](https://docs.garden.io/basics), for installation instructions, our quick start guide, and an overview of the main concepts around Garden. - [Using Garden](https://docs.garden.io/using-garden), for features and usage, Garden configuration files, usage with remote clusters, and setting up hot reload. -- [Example Projects](https://docs.garden.io/examples) contains guides based on some of the [examples](https://github.com/garden-io/garden/tree/master/examples). +- [Example Projects](https://docs.garden.io/examples) contains guides based on some of the [examples](https://github.com/garden-io/garden/tree/v0.9.0/examples). - [Reference](https://docs.garden.io/reference), for the glossary, commands reference, configuration files reference, and template strings reference. - [FAQs](https://docs.garden.io/faqs). @@ -44,7 +44,7 @@ Overview: ## Examples -There are many examples of how to use Garden in a myriad of different ways in the [examples](https://github.com/garden-io/garden/tree/master/examples) folder of our repository. +There are many examples of how to use Garden in a myriad of different ways in the [examples](https://github.com/garden-io/garden/tree/v0.9.0/examples) folder of our repository. For written guides based on some of these examples, check out the [examples section](https://docs.garden.io/examples) of our documentation. diff --git a/bin/release b/bin/release deleted file mode 100755 index e77dff7432..0000000000 --- a/bin/release +++ /dev/null @@ -1,90 +0,0 @@ -#!/usr/bin/env bash -set -eo pipefail - -# Performs the following steps to prepare for a release: -# -# 1. Checks out to a branch named release-${version} -# 2. Updates the version field in garden-service/package.json. -# 3. Updates garden-service/package-lock.json by doing npm install. -# 4. Creates a tag for the version (we need this for the changelog). -# 5. Generates the changelog, based on the tag from the previous step. TODO: Use --next-tag flag when no longer experimental -# and skip step 3. -# 6. Adds and commits CHANGELOG.md, garden-service/package.json and garden-service/package-lock.json -# 7. Updates the tag after the commit -# 8. Pushes the tag. This triggers CircleCI process that creates the release artifacts - -# Bumps garden-service/package.json version. Adapted from here: https://gist.github.com/timseverien/5c1ba6548df32ca3a16b -function bump { - version=$1 - search='("version":[[:space:]]*").+(")' - replace="\1${version}\2" - - sed -i ".tmp" -E "s/${search}/${replace}/" "garden-service/package.json" - rm "garden-service/package.json.tmp" -} - -# Runs the release steps documented above. -function release { - echo " -Preparing to release version ${version}... - " - - # Checkout out to a dedicated release branch - git checkout -b release-${version} - - # Update garden-service/package.json version - bump ${version} - - # Update package-lock.json version - cd garden-service && npm install && cd .. - - # Create tag ${tag_name} - git tag -a ${tag_name} -m "chore(release): release ${tag_name}" - - # Update changelog - changelog=$(git-chglog ${tag_name}) - printf '%s\n\n%s\n' "${changelog}}" "$(cat CHANGELOG.md)" > CHANGELOG.md - - # Commit changes - git add CHANGELOG.md garden-service/package.json garden-service/package-lock.json && git commit -m "chore(release): bump version to ${version}" - - # Update tag - git tag -f -a ${tag_name} -m "chore(release): release ${tag_name}" - - # Push tag - git push origin ${tag_name} --no-verify - - echo " -------------------------------------------------------------------------------- -Version ${version} has been tagged, committed, and pushed to Github! 🎉 - -A CI job that creates the release artifcats is currently in process: https://circleci.com/gh/garden-io/garden - -Please refer to our contributing docs for the next steps: https://github.com/garden-io/garden/blob/master/CONTRIBUTING.md -------------------------------------------------------------------------------- - " -} - -# Set variables and prompt user -garden_root=$(cd `dirname $0` && cd .. && pwd) -cd ${garden_root} - -version=$1 -tag_name="v${version}" - -if [[ -z $version ]]; then - echo "Error: Version missing" - exit 1 -fi - -while true; do - read -p "Running this script will create a version tag for ${tag_name} and push it to Github. -This triggers a CI process that creates the release artifacts. - -Are you sure you want to continue? " yn - case $yn in - [Yy]* ) release; break;; - [Nn]* ) exit;; - * ) echo "Please answer yes or no.";; - esac -done diff --git a/bin/release.ts b/bin/release.ts new file mode 100755 index 0000000000..fe47040636 --- /dev/null +++ b/bin/release.ts @@ -0,0 +1,212 @@ +#!/usr/bin/env ts-node + +import * as execa from "execa" +import * as semver from "semver" +import * as inquirer from "inquirer" +import chalk from "chalk" +import parseArgs = require("minimist") +import replace = require("replace-in-file") +import deline = require("deline") +import { resolve, join } from "path" + +type ReleaseType = "minor" | "patch" | "preminor" | "prepatch" | "prerelease" +const RELEASE_TYPES = ["minor", "patch", "preminor", "prepatch", "prerelease"] + +/** + * Performs the following steps to prepare for a release: + * 1. Check out to a branch named release-${version} + * 2. Bump the version in garden-service/package.json and garden-service/package-lock.json. + * 5. Update the changelog. + * 6. Add and commit CHANGELOG.md, garden-service/package.json and garden-service/package-lock.json + * 7. Tag the commit. + * 8. Push the tag. This triggers CircleCI process that creates the release artifacts. + * 9. If we're making a minor release, update links to examples and re-push the tag. + * + * Usage: ./bin/release.ts [--force] + */ +async function release() { + // Parse arguments + const argv = parseArgs(process.argv.slice(2)) + const releaseType = argv._[0] + const force = argv.force + const gardenRoot = resolve(__dirname, "..") + const gardenServiceRoot = join(gardenRoot, "garden-service") + + // Check if branch is clean + try { + await execa("git", ["diff", "--exit-code"], { cwd: gardenRoot }) + } catch (_) { + throw new Error("Current branch has unstaged changes, aborting.") + } + + if (!RELEASE_TYPES.includes(releaseType)) { + throw new Error(`Invalid release type ${releaseType}, available types are: ${RELEASE_TYPES.join(", ")}`) + } + + // Bump package.json and package-lock.json version. Returns the version that was set. + const version = await execa.stdout("npm", [ + "version", "--no-git-tag-version", releaseType, + ], { cwd: gardenServiceRoot }) + + // Check if user wants to continue + const proceed = await prompt(version) + if (!proceed) { + await rollBack(gardenRoot) + return + } + + // Pull remote tags + console.log("Pulling remote tags...") + await execa("git", ["fetch", "origin", "--tags"], { cwd: gardenRoot }) + + // Verify tag doesn't exist + const tags = (await execa.stdout("git", ["tag"], { cwd: gardenRoot })).split("\n") + if (tags.includes(version) && !force) { + await rollBack(gardenRoot) + throw new Error(`Tag ${version} already exists. Use "--force" to override.`) + } + + // Checkout to a release branch + const branchName = `release-${version}` + console.log(`Checking out to branch ${branchName}...`) + await execa("git", ["checkout", "-b", branchName], { cwd: gardenRoot }) + + // Remove pre-release tags so they don't get included in the changelog + await stripPrereleaseTags(tags, version) + + // Update changelog + console.log("Updating changelog...") + await execa("git-chglog", [ + "--next-tag", version, + "--output", "CHANGELOG.md", + `..${version}`, + ], { cwd: gardenRoot }) + + // Add and commit changes + console.log("Committing changes...") + await execa("git", [ + "add", + "CHANGELOG.md", "garden-service/package.json", "garden-service/package-lock.json", + ], { cwd: gardenRoot }) + await execa("git", [ + "commit", + "-m", `chore(release): bump version to ${version}`, + ], { cwd: gardenRoot }) + + // Tag the commit and push the tag + console.log("Pushing tag...") + await createTag(version, gardenRoot, force) + + // Reset local tag state (after stripping release tags) + await execa("git", ["fetch", "origin", "--tags"], { cwd: gardenRoot }) + + // For minor releases, we update links to examples in the docs so that they point to the relevant tag. + // E.g.: "github.com/garden-io/tree/v0.8.0/example/..." becomes "github.com/garden-io/tree/v0.9.0/example/..." + // Note that we do this after pushing the tag originally. This because we check that links are valid in CI + // and the check would fail if the tag hasen't been created in the first place. + if (releaseType === "minor") { + console.log("Updating links to examples and re-pushing tag...") + await updateExampleLinks(version) + + // Add and commit changes to example links + await execa("git", [ + "add", + "README.md", "docs", + ], { cwd: gardenRoot }) + await execa("git", ["commit", "--amend", "--no-edit"], { cwd: gardenRoot }) + + // Tag the commit and force push the tag after updating the links (this triggers another CI build) + await createTag(version, gardenRoot, true) + } + + console.log(deline` + \nVersion ${chalk.bold.cyan(version)} has been ${chalk.bold("tagged")}, ${chalk.bold("committed")}, + and ${chalk.bold("pushed")} to Github! 🎉\n + + A CI job that creates the release artifacts is currently in process: https://circleci.com/gh/garden-io/garden\n + + Please refer to our contributing docs for the next steps: + https://github.com/garden-io/garden/blob/master/CONTRIBUTING.md + `) +} + +async function createTag(version: string, gardenRoot: string, force: boolean) { + // Tag the commit + const createTagArgs = ["tag", "-a", version, "-m", `chore(release): release ${version}`] + if (force) { + createTagArgs.push("-f") + } + await execa.stdout("git", createTagArgs, { cwd: gardenRoot }) + + // Push the tag + const pushTagArgs = ["push", "origin", version, "--no-verify"] + if (force) { + pushTagArgs.push("-f") + } + await execa("git", pushTagArgs, { cwd: gardenRoot }) +} + +async function updateExampleLinks(version: string) { + const options = { + files: ["docs/**/*.md", "README.md"], + from: /github\.com\/garden-io\/garden\/tree\/.*\/examples/g, + to: `github.com/garden-io/garden/tree/${version}/examples/`, + } + const changes = await replace(options) + console.log("Modified files:", changes.join(", ")) +} + +async function rollBack(gardenRoot: string) { + // Clean up changes to package.json and package-lock.json. This is safe since we know the branch is clean. + console.log("Undoing changes to package.json and package-lock.json") + await execa.stdout("git", [ + "checkout", + "garden-service/package.json", + "garden-service/package-lock.json", + ], { cwd: gardenRoot }) +} + +async function prompt(version: string): Promise { + const message = deline` + Running this script will create a tag for ${chalk.bold.cyan(version)} and push it to Github. + This triggers a CI process that creates the release artifacts.\n + + Are you sure you want to continue? + ` + const ans = await inquirer.prompt({ + name: "continue", + message, + }) + return ans.continue.startsWith("y") +} + +/** + * We don't include pre-release tags in the changelog except for the current release cycle. + * So if we're releasing, say, v0.9.1-3, we include the v0.9.1-0, v0.9.1-1, and v0.9.1-2 tags. + * + * Once we release v0.9.1, we remove the pre-release tags, so the changelog will only show the changes + * between v0.9.0 and v0.9.1. + */ +async function stripPrereleaseTags(tags: string[], version: string) { + const prereleaseTags = tags.filter(t => !!semver.prerelease(t)) + + for (const tag of prereleaseTags) { + // If we're not releasing a pre-release, we remove the tag. Or, + // if we are releasing a pre-release and the tag is not from the same cycle, we remove it. + // E.g., if the current tag is v0.5.0-2 and we're releasing v0.9.0-2, we remove it. + // If the current tag is v0.9.0-0 and we're releasing v0.9.0-2, we keep it. + if (!semver.prerelease(version) || semver.diff(version, tag) !== "prerelease") { + await execa.stdout("git", ["tag", "-d", tag]) + } + } +} + +(async () => { + try { + await release() + process.exit(0) + } catch (err) { + console.log(err) + process.exit(1) + } +})().catch(() => { }) diff --git a/docs/examples/hello-world.md b/docs/examples/hello-world.md index 4e07d75867..33cd0d3707 100644 --- a/docs/examples/hello-world.md +++ b/docs/examples/hello-world.md @@ -6,9 +6,9 @@ In this example, we'll have a practical look at the main characteristics of a Ga - Ports, endpoints, and health check settings - Tests -This project contains four configuration files. [This one](https://github.com/garden-io/garden/tree/master/examples/hello-world/garden.yml) for project-wide settings, and three separate ones for each of the modules: [`hello-container`](https://github.com/garden-io/garden/tree/master/examples/hello-world/services/hello-container/garden.yml), [`hello-function`](https://github.com/garden-io/garden/tree/master/examples/hello-world/services/hello-function/garden.yml), and [`hello-npm-package`](https://github.com/garden-io/garden/tree/master/examples/hello-world/libraries/hello-npm-package/garden.yml). +This project contains four configuration files. [This one](https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world/garden.yml) for project-wide settings, and three separate ones for each of the modules: [`hello-container`](https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world/services/hello-container/garden.yml), [`hello-function`](https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world/services/hello-function/garden.yml), and [`hello-npm-package`](https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world/libraries/hello-npm-package/garden.yml). -_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/master/examples/hello-world](https://github.com/garden-io/garden/tree/master/examples/hello-world)._ +_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world](https://github.com/garden-io/garden/tree/v0.9.0/examples/hello-world)._ # Configuring dependencies diff --git a/docs/examples/remote-sources.md b/docs/examples/remote-sources.md index cb292fb388..bce20c6c5c 100644 --- a/docs/examples/remote-sources.md +++ b/docs/examples/remote-sources.md @@ -10,11 +10,11 @@ Important concepts: > Remote _module_: The remote source code for a single Garden module. In this case, the `garden.yml` config file is stored in the main project repository while the module code itself is in the remote repository. -_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/master/examples/remote-sources](https://github.com/garden-io/garden/tree/master/examples/remote-sources)._ +_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/v0.9.0/examples/remote-sources](https://github.com/garden-io/garden/tree/v0.9.0/examples/remote-sources)._ ## About -This project is the same as the [vote example](https://github.com/garden-io/garden/tree/master/examples/vote)—except that in this case the services live in their own repositories. The repositories are: +This project is the same as the [vote example](https://github.com/garden-io/garden/tree/v0.9.0/examples/vote)—except that in this case the services live in their own repositories. The repositories are: * [Database services](https://github.com/garden-io/garden-example-remote-sources-db-services) (contains the Postgres and Redis services) * [Web services](https://github.com/garden-io/garden-example-remote-sources-web-services) (contains the Python Vote web service and the Node.js Result web service) diff --git a/docs/examples/simple-project.md b/docs/examples/simple-project.md index 47f6c43c26..df2661a20d 100644 --- a/docs/examples/simple-project.md +++ b/docs/examples/simple-project.md @@ -17,7 +17,7 @@ This tutorial assumes that you have already have a running [installation of Gard ## Clone the example repo -The code for this tutorial can be found in our Github repository under the [examples directory](https://github.com/garden-io/garden/tree/master/examples). We'll use the [simple-project-start](https://github.com/garden-io/garden/tree/master/examples/simple-project-start/) example and work our way from there. The final version is under [simple-project](https://github.com/garden-io/garden/tree/master/examples/simple-project). +The code for this tutorial can be found in our Github repository under the [examples directory](https://github.com/garden-io/garden/tree/v0.9.0/examples). We'll use the [simple-project-start](https://github.com/garden-io/garden/tree/v0.9.0/examples/simple-project-start/) example and work our way from there. The final version is under [simple-project](https://github.com/garden-io/garden/tree/v0.9.0/examples/simple-project). First, let's clone the examples repo, change into the directory, and take a look inside: ```sh diff --git a/docs/examples/tls-project.md b/docs/examples/tls-project.md index bd0b723127..b79de3f0db 100644 --- a/docs/examples/tls-project.md +++ b/docs/examples/tls-project.md @@ -5,7 +5,7 @@ This project shows how you can configure a TLS certificate to use for local deve For the example to work you need to configure a local certificate authority (CA) on your computer for development. We'll use [mkcert](https://github.com/FiloSottile/mkcert) for this purpose. -_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/master/examples/local-tls](https://github.com/garden-io/garden/tree/master/examples/local-tls)._ +_Note: The source code for this project can be found at: [https://github.com/garden-io/garden/tree/v0.9.0/examples/local-tls](https://github.com/garden-io/garden/tree/v0.9.0/examples/local-tls)._ ## Setup diff --git a/examples/remote-sources/README.md b/examples/remote-sources/README.md index 61815be661..b869ebee6a 100644 --- a/examples/remote-sources/README.md +++ b/examples/remote-sources/README.md @@ -10,7 +10,7 @@ Important concepts: ## About -This project is the same as the [vote example](https://github.com/garden-io/garden/tree/master/examples/vote)—except that in this case the services live in their own repositories. The repositories are: +This project is the same as the [vote example](https://github.com/garden-io/garden/tree/v0.9.0/examples/vote)—except that in this case the services live in their own repositories. The repositories are: * [Database services](https://github.com/garden-io/garden-example-remote-sources-db-services) (contains the Postgres and Redis services) * [Web services](https://github.com/garden-io/garden-example-remote-sources-web-services) (contains the Python Vote web service and the Node.js Result web service) diff --git a/garden-service/package-lock.json b/garden-service/package-lock.json index 4b92f39728..f730ea6b8e 100644 --- a/garden-service/package-lock.json +++ b/garden-service/package-lock.json @@ -1,6 +1,6 @@ { "name": "garden-cli", - "version": "0.9.0-rc3", + "version": "0.9.1", "lockfileVersion": 1, "requires": true, "dependencies": { diff --git a/garden-service/package.json b/garden-service/package.json index 2d6caa4256..785d0332e9 100644 --- a/garden-service/package.json +++ b/garden-service/package.json @@ -1,6 +1,6 @@ { "name": "garden-cli", - "version": "0.9.0-rc3", + "version": "0.9.1", "description": "A full-featured development framework for containers and serverless", "repository": { "type": "git", diff --git a/package-lock.json b/package-lock.json index 3b77c64b4b..df40a1d8e2 100644 --- a/package-lock.json +++ b/package-lock.json @@ -3377,6 +3377,12 @@ "integrity": "sha1-hMbhWbgZBP3KWaDvRM2HDTElD5o=", "dev": true }, + "deline": { + "version": "1.0.4", + "resolved": "https://registry.npmjs.org/deline/-/deline-1.0.4.tgz", + "integrity": "sha1-bAXIeDaSbhocY+R4gvPS6yxvFMk=", + "dev": true + }, "depd": { "version": "1.1.2", "resolved": "https://registry.npmjs.org/depd/-/depd-1.1.2.tgz", @@ -9441,6 +9447,17 @@ "remove-trailing-separator": "^1.1.0" } }, + "replace-in-file": { + "version": "3.4.3", + "resolved": "https://registry.npmjs.org/replace-in-file/-/replace-in-file-3.4.3.tgz", + "integrity": "sha512-m62vEDCIL1B8uzymh+YKMLb4N4LdX5A5ObxOjap4wyCHzWqblAUYO5vhjWwk7zfR8PkTRIdPZVo/u4h33clnew==", + "dev": true, + "requires": { + "chalk": "^2.4.1", + "glob": "^7.1.2", + "yargs": "^12.0.5" + } + }, "request": { "version": "2.88.0", "resolved": "https://registry.npmjs.org/request/-/request-2.88.0.tgz", @@ -9741,9 +9758,9 @@ "dev": true }, "semver": { - "version": "5.4.1", - "resolved": "https://registry.npmjs.org/semver/-/semver-5.4.1.tgz", - "integrity": "sha512-WfG/X9+oATh81XtllIo/I8gOiY9EXRdv1cQdyykeXK17YcUW3EXUAi2To4pcH6nZtJPr7ZOpM5OMyWJZm+8Rsg==", + "version": "5.6.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-5.6.0.tgz", + "integrity": "sha512-RS9R6R35NYgQn++fkDWaOmqGoj4Ek9gGs+DPxNUZKuwE183xjJroKvyo1IzVFeXvUrvmALy6FWD5xrdJT25gMg==", "dev": true }, "semver-compare": { diff --git a/package.json b/package.json index 22cd6e17fa..91520457f3 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,10 @@ "@types/handlebars": "^4.0.39", "@types/lodash": "^4.14.119", "@types/node": "^10.12.15", + "@types/semver": "^5.5.0", "axios": "^0.18.0", + "deline": "^1.0.4", + "execa": "^1.0.0", "fs-extra": "^7.0.1", "gulp": "^4.0.0", "gulp-cached": "^1.1.1", @@ -32,6 +35,8 @@ "lerna": "^3.6.0", "lodash": "^4.17.11", "markdown-link-check": "^3.7.2", + "replace-in-file": "^3.4.3", + "semver": "^5.6.0", "shx": "^0.3.2", "snyk": "^1.117.2", "ts-node": "^7.0.1",