Skip to content

Commit

Permalink
fix(#6): env var GITLAB_CI is not set
Browse files Browse the repository at this point in the history
  • Loading branch information
leorolland authored Jul 27, 2022
1 parent be066ff commit 861e04e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
4 changes: 3 additions & 1 deletion gitflow_toolbox/common/get_current_gitlab.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

import gitlab

from gitflow_toolbox.common.get_env import get_env
Expand All @@ -10,7 +12,7 @@ def get_current_gitlab() -> gitlab.Gitlab:
gitlab.Gitlab: current gitlab instance (or 'source', 'from' gitlab)
"""
# If running in a gitlab CI job
if get_env("GITLAB_CI"):
if os.getenv("GITLAB_CI"):
# Use provided token, if not available, use default token from job
private_token = get_env("GITLAB_PRIVATE_TOKEN", "CI_JOB_TOKEN")
return gitlab.Gitlab(get_env("CI_SERVER_URL"), private_token)
Expand Down
4 changes: 3 additions & 1 deletion gitflow_toolbox/common/get_current_project.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
import os

from gitlab.v4.objects.projects import Project

from gitflow_toolbox.common.get_current_gitlab import get_current_gitlab
Expand All @@ -12,7 +14,7 @@ def get_current_project() -> Project:
"""
gitlab = get_current_gitlab()
# If running in a gitlab CI job
if get_env("GITLAB_CI"):
if os.getenv("GITLAB_CI"):
# Use provided CI project, if not available, use project from current job
project_id = get_env("GITLAB_PROJECT_ID", "CI_PROJECT_ID")
return gitlab.projects.get(project_id)
Expand Down

0 comments on commit 861e04e

Please sign in to comment.