Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
cb-util
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Christoph Alt
cb-util
Commits
abf6dcd7
Commit
abf6dcd7
authored
1 year ago
by
Christoph Alt
Browse files
Options
Downloads
Patches
Plain Diff
added a feature to the git git infos from api so that the commit can be
also choosen from a env variable
parent
ff0d75f5
Branches
Branches containing commit
No related tags found
No related merge requests found
Pipeline
#56998
passed
1 year ago
Stage: test
Stage: deploy
Stage: trigger
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
cbutil/gitlab_api.py
+9
-2
9 additions, 2 deletions
cbutil/gitlab_api.py
with
9 additions
and
2 deletions
cbutil/gitlab_api.py
+
9
−
2
View file @
abf6dcd7
import
logging
import
logging
import
os
from
typing
import
Union
from
typing
import
Union
import
requests
import
requests
...
@@ -48,8 +49,14 @@ def get_git_infos_from_api(instance_url, project_id: Project_id,
...
@@ -48,8 +49,14 @@ def get_git_infos_from_api(instance_url, project_id: Project_id,
*
,
*
,
branch
=
'
main
'
,
branch
=
'
main
'
,
commit_key
=
"
commit
"
,
commit_key
=
"
commit
"
,
commit_msg_key
=
"
commit_message
"
):
commit_msg_key
=
"
commit_message
"
,
last_commit
=
get_last_commit
(
instance_url
,
project_id
,
branch
=
branch
)
commit_env_key
=
None
):
last_commit
=
""
if
commit_env_key
:
last_commit
=
os
.
getenv
(
commit_env_key
,
None
)
if
not
last_commit
:
last_commit
=
get_last_commit
(
instance_url
,
project_id
,
branch
=
branch
)
commit
,
commit_msg
=
get_commit_infos_from_api
(
last_commit
)
commit
,
commit_msg
=
get_commit_infos_from_api
(
last_commit
)
commit_msg
=
remove_newline
(
commit_msg
)
commit_msg
=
remove_newline
(
commit_msg
)
return
{
commit_key
:
commit
,
commit_msg_key
:
commit_msg
}
return
{
commit_key
:
commit
,
commit_msg_key
:
commit_msg
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment