Skip to content
Open
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
3 changes: 2 additions & 1 deletion Documentation/config/failfast-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,11 @@ failfast:
on-comments: [/retest, /test]
on-labels: [ok-to-test]
on-pullrequests: ['*']
rebase: 'true'
debug: false
env: development
failfast_url: https://jobs.failfast-ci.com
github: {context: gitlab-ci, integration_id: '6059', secret_token: null}
github: {context: gitlab-ci, context-status: gitlab-ci, integration_id: '6059', secret_token: null}
gitlab:
enable_container_registry: false
enable_issues: false
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ fmt-ci:
find . -iname "*.jsonnet" | xargs jsonnet fmt -i -n 2
find . -iname "*.libsonnet" | xargs jsonnet fmt -i -n 2

gen-ci: fmt-ci
gen-ci:
ffctl gen

mypy:
Expand Down
7 changes: 5 additions & 2 deletions hub2labhook/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
import os
import yaml

from hub2labhook.utils import strtobool


def logfile_path(jsonfmt=False, debug=False):
"""
Expand All @@ -14,7 +16,7 @@ def logfile_path(jsonfmt=False, debug=False):
- conf/logging_debug.conf # jsonfmt=false, debug=true
- conf/logging.conf # jsonfmt=false, debug=false
Can be parametrized via envvars: JSONLOG=true, DEBUGLOG=true
"""
"""
_json = ""
_debug = ""

Expand Down Expand Up @@ -89,7 +91,7 @@ def envbool(value: str):
GITHUB_CONTEXT = getenv("GITHUB_CONTEXT", "gitlab-ci")
GITHUB_INTEGRATION_ID = getenv("GITHUB_INTEGRATION_ID", "000")
GITHUB_SECRET_TOKEN = getenv("GITHUB_SECRET_TOKEN", None)

FAILFASTCI_TEST_REBASE = getenv("FAILFASTCI_TEST_REBASE", "true", strtobool)
FAILFASTCI_NAMESPACE = getenv("FAILFASTCI_NAMESPACE", "failfast-ci")
FAILFASTCI_API = getenv("FAILFAST_CI_API", "https://jobs.failfast-ci.com")

Expand Down Expand Up @@ -121,6 +123,7 @@ def __init__(self, defaults=None, confpath=None):
'env': APP_ENVIRON,
'failfast_url': FAILFASTCI_API,
'build': {
'rebase': FAILFASTCI_TEST_REBASE,
'on-pullrequests': ['*'],
'on-branches': ['master'],
'on-labels': [
Expand Down
3 changes: 3 additions & 0 deletions hub2labhook/pipeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,9 @@ def _checkout_repo(self, gevent, repo_path):
'expected_sha': gevent.head_sha,
'sha': gitbin.rev_parse('HEAD')
})

if FFCONFIG.failfast['build']['rebase'] is True:
Copy link
Contributor

Choose a reason for hiding this comment

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

if FFCONFIG.failfast['build']['rebase']: is probably more pythonic

gitbin.rebase("master")
return gitbin

def _get_ci_file(self, repo_path):
Expand Down
7 changes: 7 additions & 0 deletions hub2labhook/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,10 @@ def pretty_time_delta(seconds):

def clone_url_with_auth(base_url, auth):
return base_url.replace("https://", "https://%s@" % auth)


def strtobool(s):
if s in ["yes", "on", "true", "True", "TRUE"]:
Copy link
Contributor

@Miouge1 Miouge1 Apr 19, 2019

Choose a reason for hiding this comment

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

You can refactor this as simple one liner return s in ["yes", "on", ...]

return True
else:
return False