Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

✨ Handling of staging hotfixes #2649

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 15 additions & 2 deletions .github/workflows/ci-staging.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,10 +27,15 @@ jobs:
docker_compose_sha: 8097769d32e34314125847333593c8edb0dfc4a5b350e4839bef8c2fe8d09de7
fail-fast: false
env:
FROM_TAG_PREFIX: master-github
TO_TAG_PREFIX: staging-github
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: set target variable
run: |
target=$(git name-rev --refs="refs/remotes/origin/*" --name-only ${GITHUB_SHA})
echo "TARGET=${target}" >> $GITHUB_ENV
- name: setup docker buildx
id: buildx
uses: docker/setup-buildx-action@v1
Expand All @@ -43,5 +48,13 @@ jobs:
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
- name: set git tag
run: echo "GIT_TAG=${GITHUB_REF##*/}" >> $GITHUB_ENV
- name: deploy
- if: contains(env.TARGET, 'remotes/origin/master')
env:
FROM_TAG_PREFIX: master-github
name: deploy from master to staging
run: ./ci/deploy/dockerhub-tag-version.bash
- if: contains(env.TARGET, 'remotes/origin/hotfix_staging_')
env:
FROM_TAG_PREFIX: hotfix-staging-github
name: deploy from hotfix staging to staging
run: ./ci/deploy/dockerhub-tag-version.bash
13 changes: 9 additions & 4 deletions .github/workflows/ci-testing-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2439,13 +2439,18 @@ jobs:
run: sudo ./ci/github/helpers/setup_docker_compose.bash ${{ matrix.docker_compose }} ${{ matrix.docker_compose_sha }}
- name: set owner variable
run: echo "OWNER=${GITHUB_REPOSITORY%/*}" >> $GITHUB_ENV
- name: deploy master
if: github.ref == 'refs/heads/master'
- if: github.ref == 'refs/heads/master'
name: deploy master image
env:
TAG_PREFIX: master-github
run: ./ci/deploy/dockerhub-deploy.bash
- name: deploy hotfix
if: contains(github.ref, 'refs/heads/hotfix_v')
- if: contains(github.ref, 'refs/heads/hotfix_v')
name: deploy release hotfix image
env:
TAG_PREFIX: hotfix-github
run: ./ci/deploy/dockerhub-deploy.bash
- if: contains(github.ref, 'refs/heads/hotfix_staging_')
name: deploy staging hotfix image
env:
TAG_PREFIX: hotfix-staging-github
run: ./ci/deploy/dockerhub-deploy.bash
17 changes: 7 additions & 10 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -616,25 +616,22 @@ endef
_git_get_repo_orga_name = $(shell git config --get remote.origin.url | \
grep --perl-regexp --only-matching "((?<=git@github\.com:)|(?<=https:\/\/github\.com\/))(.*?)(?=.git)")

.PHONY: .check-master-branch
.check-master-branch:
.PHONY: .check-on-master-branch .create_github_release_url
.check-on-master-branch:
@if [ "$(_git_get_current_branch)" != "master" ]; then\
echo -e "\e[91mcurrent branch is not master branch."; exit 1;\
fi

.PHONY: release-staging release-prod
release-staging release-prod: .check-master-branch ## Helper to create a staging or production release in Github (usage: make release-staging name=sprint version=1 git_sha=optional or make release-prod version=1.2.3 git_sha=optional)
.create_github_release_url:
# ensure tags are uptodate
@git pull --tags
@echo -e "\e[33mOpen the following link to create the $(if $(findstring -staging, $@),staging,production) release:";
@echo -e "\e[32mhttps://github.com/$(_git_get_repo_orga_name)/releases/new?prerelease=$(if $(findstring -staging, $@),1,0)&target=$(_url_encoded_target)&tag=$(_url_encoded_tag)&title=$(_url_encoded_title)&body=$(_url_encoded_logs)";
@echo -e "\e[33mOr open the following link to create the $(if $(findstring -staging, $@),staging,production) release and paste the logs:";
@echo -e "\e[32mhttps://github.com/$(_git_get_repo_orga_name)/releases/new?prerelease=$(if $(findstring -staging, $@),1,0)&target=$(_url_encoded_target)&tag=$(_url_encoded_tag)&title=$(_url_encoded_title)";
@echo -e "\e[34m$(_prettify_logs)"
.PHONY: release-staging release-prod
release-staging release-prod: .check-on-master-branch .create_github_release_url ## Helper to create a staging or production release in Github (usage: make release-staging name=sprint version=1 git_sha=optional or make release-prod version=1.2.3 git_sha=optional)

.PHONY: release-hotfix
release-hotfix: ## Helper to create a hotfix release in Github (usage: make release-hotfix version=1.2.4 git_sha=optional)
# ensure tags are uptodate
@git pull --tags
@echo -e "\e[33mOpen the following link to create the $(if $(findstring -staging, $@),staging,production) release:";
@echo -e "\e[32mhttps://github.com/$(_git_get_repo_orga_name)/releases/new?prerelease=$(if $(findstring -staging, $@),1,0)&target=$(_url_encoded_target)&tag=$(_url_encoded_tag)&title=$(_url_encoded_title)&body=$(_url_encoded_logs)";
.PHONY: release-hotfix release-staging-hotfix
release-hotfix release-staging-hotfix: .create_github_release_url## Helper to create a hotfix release in Github (usage: make release-hotfix version=1.2.4 git_sha=optional or make release-staging-hotfix name=Sprint version=2)
80 changes: 54 additions & 26 deletions docs/releasing-workflow-instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,16 +57,16 @@ then after the review we do a couple of additions and re-release staging ``DAJIA

1. Generate *Github* release tag

```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
make release-staging name=SPRINTNAME version=VERSION (git_sha=OPTIONAL)
```
```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
make release-staging name=SPRINTNAME version=VERSION (git_sha=OPTIONAL)
```

2. Adjust the list of changes if needed
3. Press the **Publish release** button
4. The CI will be automatically triggered and will deploy the staging release


## Release process

A released version of simcore, that is marked as such on the *master* branch by leveraging *Github* release tagging mechanism. The CI is triggered and will pull the marked staging docker images (by using the given git SHA or the latest staging images), and tag them as release images.
Expand Down Expand Up @@ -95,11 +95,11 @@ The team decides to release to production the lastest staging version of ``DAJIA

1. Generate *Github* release tag

```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
make release-prod version=MAJ.MIN.PATCH git_sha=SHA_OF_THE_WANTED_STAGING_RELEASE
```
```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
make release-prod version=MAJ.MIN.PATCH git_sha=SHA_OF_THE_WANTED_STAGING_RELEASE
```

2. Adjust the list of changes if needed
3. Press the **Publish release** button
Expand Down Expand Up @@ -130,24 +130,24 @@ A bug was found in version 1.2.0 of the simcore stack. The team decides to fix i

1. Generate *Github* release tag

```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
# let's checkout the release with the issue, typically a release tag such as v1.4.5
git checkout VERSION_TAG_FOR_HOTFIXING
# create the hotfix branch, the name must follow the hotfix_v* convention, what lies after v is free
git checkout -b hotfix_v1_4_x
# develop the fix here, git commit, git push, have someone review your code
```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
# let's checkout the release with the issue, typically a release tag such as v1.4.5
git checkout VERSION_TAG_FOR_HOTFIXING
# create the hotfix branch, the name must follow the hotfix_v* convention, what lies after v is free
git checkout -b hotfix_v1_4_x
# develop the fix here, git commit, git push, have someone review your code

git commit -m "this is my awsome fix for this problematic issue"
git push --set-upstream origin/hotfix_v1_4_x
git commit -m "this is my awsome fix for this problematic issue"
git push --set-upstream origin/hotfix_v1_4_x

# - NO NEED to pull request
# - WAIT until the CI completed the its run (going through ALL the tests and generating the docker images)
# - once ALL the images are in dockerhub, create the new version
# - NO NEED to pull request
# - WAIT until the CI completed the its run (going through ALL the tests and generating the docker images)
# - once ALL the images are in dockerhub, create the new version

make release-hotfix version=MAJ.MIN.PATCH (git_sha=OPTIONAL)
```
make release-hotfix version=MAJ.MIN.PATCH (git_sha=OPTIONAL)
```

2. Adjust the list of changes if needed
3. Press the **Publish release** button
Expand All @@ -156,3 +156,31 @@ make release-hotfix version=MAJ.MIN.PATCH (git_sha=OPTIONAL)
6. The branch can be safely deleted afterwards

See ![img/git-hotfix-workflow.svg](img/git-hotfix-workflow.svg)

### Instructions to generate a hotfix for staging

1. Generate *Github* release tag

```bash
git clone https://github.com/ITISFoundation/osparc-simcore.git
cd osparc-simcore
# let's checkout the release with the issue, typically a staging tag such as staging_Meerkat1
git checkout VERSION_TAG_FOR_HOTFIXING
# create the hotfix branch, the name must follow the hotfix__stagingX convention, X is just a number
git checkout -b hotfix_stagingX
# develop the fix here, git commit, git push, have someone review your code

git commit -m "this is my awsome fix for this problematic issue"
git push --set-upstream origin/hotfix_stagingX

# - NO NEED to pull request
# - WAIT until the CI completed the its run (going through ALL the tests and generating the docker images)
# - once ALL the images are in dockerhub, create the new version
make release-staging-hotfix name=SPRINT version=VERSION (git_sha=OPTIONAL)
```

2. Adjust the list of changes if needed
3. Press the **Publish release** button
4. The CI will be automatically triggered and will deploy the staging release
5. **Once the deploy was successfully done: create a PR from that branch to the master branch if it applies
6. The branch can be safely deleted afterwards