Skip to content

Commit

Permalink
changeset
Browse files Browse the repository at this point in the history
  • Loading branch information
pazone committed Mar 13, 2024
1 parent df55062 commit 0f4df5d
Showing 1 changed file with 19 additions and 9 deletions.
28 changes: 19 additions & 9 deletions .buildkite/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -90,16 +90,12 @@ def create_entity(self):
msg = tm.render(stage=self)
return msg

# Conditions:

def is_step_enabled(step: Step, conditions) -> bool:
# TODO:
# If PR then
# If Changeset

pull_request = os.getenv('BUILDKITE_PULL_REQUEST')
if pull_request and pull_request == "false":
return True
def is_pr(value) -> bool:
return os.getenv('BUILDKITE_PULL_REQUEST') == value

def step_comment(step: Step) -> bool:
comment = os.getenv('GITHUB_PR_TRIGGER_COMMENT')
if comment:
# the comment should be a subset of the values in .buildkite/pull-requests.json
Expand All @@ -111,6 +107,21 @@ def is_step_enabled(step: Step, conditions) -> bool:
# i.e: /test filebeat unitTest
return comment_prefix + " " + step.name in comment

def is_in_changeset() -> bool:
# TODO
return True

def is_step_enabled(step: Step, conditions) -> bool:
# TODO:
# If PR then
# If Changeset

if is_pr("false"):
return True

if step_comment(step):
return True

labels_env = os.getenv('GITHUB_PR_LABELS')
if labels_env:
labels = labels_env.split()
Expand Down Expand Up @@ -145,7 +156,6 @@ def is_group_enabled(group: Group, conditions) -> bool:

return group.category.startswith("mandatory")


def fetch_stage(name: str, stage, project: str, category: str) -> Step:
"""Create a step given the yaml object."""

Expand Down

0 comments on commit 0f4df5d

Please sign in to comment.