Skip to content

Commit

Permalink
feat: releasing hotfixes from the 'hotfix-<major>.<minor>' branches
Browse files Browse the repository at this point in the history
  • Loading branch information
jachro committed Oct 29, 2019
1 parent 2559586 commit d0baa5e
Show file tree
Hide file tree
Showing 8 changed files with 62 additions and 17 deletions.
8 changes: 7 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ dist: xenial
branches:
only:
- master
- "/^\\d+\\.\\d+\\.\\d+$/"
- "/(^hotfix-\\d+\\.\\d+(\\.\\d+)?$)|(^\\d+\\.\\d+\\.\\d+$)/"
language: scala
jdk: openjdk8
scala:
Expand Down Expand Up @@ -60,3 +60,9 @@ deploy:
on:
tags: true
repo: SwissDataScienceCenter/renku-graph
- provider: script
skip_cleanup: true
script: bash ./.travis/travis-hotfix.sh
on:
all_branches: true
repo: SwissDataScienceCenter/renku-graph
38 changes: 38 additions & 0 deletions .travis/travis-hotfix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
#!/bin/env bash
#
# Copyright 2019 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

set -e

# if this build is not trigger by a tag
COMMIT_MESSAGE_PATTERN="Setting version to .*"
BRANCH_PATTERN="^hotfix-[0-9]+\.[0-9]+(\.[0-9]+)?$"
if [[ -z $TRAVIS_TAG ]] && [[ ! $TRAVIS_COMMIT_MESSAGE =~ $COMMIT_MESSAGE_PATTERN ]] && [[ $TRAVIS_BRANCH =~ $BRANCH_PATTERN ]]; then
# fixing git setup
echo "Fixing git setup for $TRAVIS_BRANCH"
git checkout ${TRAVIS_BRANCH}
git branch -u origin/${TRAVIS_BRANCH}
git config branch.${TRAVIS_BRANCH}.remote origin
git config branch.${TRAVIS_BRANCH}.merge refs/heads/${TRAVIS_BRANCH}
git config --global user.name "RenkuGraphBot"
git config --global user.email "jakub.chrobasik@eplf.ch"
git config credential.helper "store --file=.git/credentials"
echo "https://${GITHUB_TOKEN}:@github.com" >.git/credentials

# releasing graph-services
sbt "release skip-tests default-tag-exists-answer k with-defaults"
fi
2 changes: 1 addition & 1 deletion .travis/travis-publish.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/env bash
#
# Copyright 2018 - Swiss Data Science Center (SDSC)
# Copyright 2019 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
Expand Down
6 changes: 3 additions & 3 deletions .travis/travis-release.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/env bash
#
# Copyright 2018 - Swiss Data Science Center (SDSC)
# Copyright 2019 - Swiss Data Science Center (SDSC)
# A partnership between École Polytechnique Fédérale de Lausanne (EPFL) and
# Eidgenössische Technische Hochschule Zürich (ETHZ).
#
Expand Down Expand Up @@ -28,9 +28,9 @@ if [[ -z $TRAVIS_TAG ]] && [[ ! $TRAVIS_COMMIT_MESSAGE =~ $COMMIT_MESSAGE_PATTER
git config branch.${TRAVIS_BRANCH}.remote origin
git config branch.${TRAVIS_BRANCH}.merge refs/heads/${TRAVIS_BRANCH}
git config --global user.name "RenkuGraphBot"
git config --global user.email "jakub.chrobasik@eplf.ch"
git config --global user.email "jakub.chrobasik@eplf.ch"
git config credential.helper "store --file=.git/credentials"
echo "https://${GITHUB_TOKEN}:@github.com" > .git/credentials
echo "https://${GITHUB_TOKEN}:@github.com" >.git/credentials

# releasing graph-services
sbt "release skip-tests default-tag-exists-answer k with-defaults"
Expand Down
17 changes: 9 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,12 @@ export SBT_OPTS="-XX:+UseG1GC -XX:+CMSClassUnloadingEnabled -Xmx1G"

#### Releasing

- create a release branch,
- set the upstream on the branch with ```git push --set-upstream origin <release-branch-name>```,
- create a release with ```sbt release```; enter relevant versions for the release and the snapshot; do not choose to push the new commits,
- create a new branch for the new snapshot,
- checkout the release branch and hard reset to the pre-new-snapshot commit with ```git reset --hard HEAD~1```,
- push the release branch with ```git push --follow-tags origin <release-branch-name>```,
- checkout the new snapshot branch and push it,
- create PRs for both branches; remember to merge the release PR first.
The standard release process is done by Travis and it happens automatically on a Pull Request merge to master.

#### Hotfixes

In a case of hoftixes, changes to a relevant commit/tag needs to be done and pushed to a special branch with name following the `hotfix-<major>.<minor>` pattern. Once the fix is pushed, Travis will automatically release a new hotfix version according to the versions set in `version.sbt` and `helm-chart/renku-graph/Chart.yaml`. Both mentioned files needs to be updated manually so
- version in the `version.sbt` has to follow `0.10.1-SNAPSHOT`
- version in the `helm-chart/renku-graph/Chart.yaml` has to follow `0.10.1-706fb4d`

Additionally, a change to the version bump scheme needs to be done in the `build.sbt` and the default `releaseVersionBump := sbtrelease.Version.Bump.Minor` has to become `releaseVersionBump := sbtrelease.Version.Bump.Bugfix`.
2 changes: 1 addition & 1 deletion helm-chart/renku-graph/Chart.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ apiVersion: v1
appVersion: '1.0'
description: A Helm chart for renku graph services
name: renku-graph
version: 0.25.0-4a76c1a
version: 0.24.1-4a76c1a
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,7 @@ private class IOOutdatedTriplesFinder(
|WHERE {
| VALUES ?p { dcterms:isPartOf schema:isPartOf }
| {
| ?commit ?p ${projectResource.showAs[RdfResource]} ;
| ?commit ?p ${projectResource.showAs[RdfResource]} ;
| rdf:type prov:Activity ;
| prov:agent ?agent .
| ?agent rdf:type prov:SoftwareAgent ;
Expand All @@ -129,7 +129,7 @@ private class IOOutdatedTriplesFinder(
| }
| UNION
| {
| ?commit ?p ${projectResource.showAs[RdfResource]} ;
| ?commit ?p ${projectResource.showAs[RdfResource]} ;
| rdf:type prov:Activity .
| FILTER NOT EXISTS {
| ?commit prov:agent ?agent .
Expand Down
2 changes: 1 addition & 1 deletion version.sbt
Original file line number Diff line number Diff line change
@@ -1 +1 @@
version in ThisBuild := "0.25.0-SNAPSHOT"
version in ThisBuild := "0.24.1-SNAPSHOT"

0 comments on commit d0baa5e

Please sign in to comment.