Skip to content

Commit

Permalink
feat: auto trigger chart version bump (#1695)
Browse files Browse the repository at this point in the history
* feat: add increase chart version script and job

* feat: filter release tag on CI config

* fix: make increase chart script work

* test: docker image

* feat: add watcher&watcher-info on increase version

* chore: remove commented configs and back to non-playground

* fix: extra space
  • Loading branch information
boolafish committed Aug 18, 2020
1 parent cb3659f commit cbbc2dc
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 0 deletions.
29 changes: 29 additions & 0 deletions .circleci/ci_increase_chart_version.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
#!/bin/sh

"""
This is the script that would send a dispatch event to the helm chart repo to
auto increase chart version.
Required env vars:
- CIRCLE_TAG
- CHART_NAME
- HELM_CHART_REPO
- GITHUB_API_TOKEN
"""

set -e
set -x

increase_chart_version() {
APP_VERSION="${CIRCLE_TAG#*v}"

echo "increase chart version for chart: ${CHART_NAME} with APP_VERSION: ${APP_VERSION}"

curl --location --request POST 'https://api.github.com/repos/omgnetwork/'${HELM_CHART_REPO}'/dispatches' \
--header 'Accept: application/vnd.github.v3+json' \
--header 'authorization: token '${GITHUB_API_TOKEN}'' \
--header 'Content-Type: application/json' \
--data-raw '{"event_type": "increase-chart-version", "client_payload": { "chart_name": "'${CHART_NAME}'", "app_version": "'${APP_VERSION}'" }}'
}

increase_chart_version
46 changes: 46 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,36 @@ jobs:
path: current_release/
- run: IMAGE_NAME=$WATCHER_INFO_IMAGE_NAME sh .circleci/ci_publish.sh

increase_chart_version_childchain:
docker:
- image: cimg/base:2020.01
environment:
CHART_NAME: childchain
HELM_CHART_REPO: helm-development
steps:
- checkout
- run: sh .circleci/ci_increase_chart_version.sh

increase_chart_version_watcher:
docker:
- image: cimg/base:2020.01
environment:
CHART_NAME: watcher
HELM_CHART_REPO: helm-development
steps:
- checkout
- run: sh .circleci/ci_increase_chart_version.sh

increase_chart_version_watcher_info:
docker:
- image: cimg/base:2020.01
environment:
CHART_NAME: watcher-info
HELM_CHART_REPO: helm-development
steps:
- checkout
- run: sh .circleci/ci_increase_chart_version.sh

deploy_child_chain:
executor: deployer
steps:
Expand Down Expand Up @@ -987,3 +1017,19 @@ workflows:
branches:
only:
- master
# Increase chart version for new release
- increase_chart_version_childchain:
requires: [publish_child_chain, publish_watcher, publish_watcher_info]
filters: &only_release_tag
branches:
ignore: /.*/
tags:
only:
# eg. v1.0.3-pre.0, v1.0.3, ...
- /^v[0-9]+\.[0-9]+\.[0-9]+.*/
- increase_chart_version_watcher:
requires: [publish_child_chain, publish_watcher, publish_watcher_info]
filters: *only_release_tag
- increase_chart_version_watcher_info:
requires: [publish_child_chain, publish_watcher, publish_watcher_info]
filters: *only_release_tag

0 comments on commit cbbc2dc

Please sign in to comment.