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

🐛 CI: properly get original git branch name #2970

Conversation

sanderegg
Copy link
Member

@sanderegg sanderegg commented Apr 7, 2022

What do these changes do?

getting the branch name the commit was on is not so straightforward...

when the CI runs the current SHA is in GITHUB_SHA environement

When releasing to staging or production one creates a git TAG.

  1. use-case is doing the tag on the master branch --> this should trigger a regular release to staging or production depending on the tag pattern
  2. second use-case is doing the tag on a so-called hotfix branch, which triggers the same pattern but tags the resulting docker images differntly.

When the CI runs it checks-out the tag. Then one needs to find where the tag is on. to this end the following git call is run:

git name-rev --refs="refs/remotes/origin/master" --refs="refs/remotes/origin/hotfix_v*" --refs="refs/remotes/origin/hotfix_staging_*" --name-only ${GITHUB_SHA}

this returns the name of the branch where this commit lives, but only searching in branches such as master, hotfix_v or hotfix_staging_ patterns. This should leave out snyk or dependabot generated branches.

Related issue/s

How to test

Checklist

@sanderegg sanderegg added this to the a-mile-stone milestone Apr 7, 2022
@sanderegg sanderegg self-assigned this Apr 7, 2022
@codecov
Copy link

codecov bot commented Apr 7, 2022

Codecov Report

Merging #2970 (c1b03d5) into master (5c09b8f) will decrease coverage by 12.7%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff            @@
##           master   #2970      +/-   ##
=========================================
- Coverage    79.0%   66.3%   -12.8%     
=========================================
  Files         681      57     -624     
  Lines       28385    1563   -26822     
  Branches     3657     134    -3523     
=========================================
- Hits        22442    1037   -21405     
+ Misses       5157     506    -4651     
+ Partials      786      20     -766     
Flag Coverage Δ
integrationtests ?
unittests 66.3% <ø> (-8.2%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
...rvice_integration/pytest_plugin/validation_data.py
...ore_service_director_v2/api/routes/computations.py
...er/src/simcore_service_webserver/rest_constants.py
...er/src/simcore_service_webserver/security_roles.py
...simcore_service_director_v2/modules/dask_client.py
...core-sdk/src/simcore_sdk/node_ports/_items_list.py
.../simcore_service_webserver/diagnostics_settings.py
...mcore_service_webserver/projects/projects_utils.py
...s/models-library/src/models_library/basic_regex.py
...2/src/simcore_service_director_v2/utils/clients.py
... and 614 more

Copy link
Member

@mrnicegyu11 mrnicegyu11 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks a lot

@sanderegg sanderegg merged commit b6fa6c2 into ITISFoundation:master Apr 7, 2022
@sanderegg sanderegg deleted the maintenance/properly_get_branch_name branch April 7, 2022 14:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants