Commit 93ce0bd6 authored by Adrian DC's avatar Adrian DC
Browse files

feat: prepare #237: migrate 'CI_LOCAL_NO_GIT_SAFETIES' to settings

parent bc0546ca
Loading
Loading
Loading
Loading
+2 −2
Changes for README.md: 2 added lines, 2 removed lines.
Original line number Diff line number Diff line
@@ -85,13 +85,13 @@ is the common and unique interface between GitLab CI and gitlabci-local.
| --shell SHELL       | Configure the default bash/debug shell entrypoint |

| Jobs arguments    |                                                                                                   |
| ----------------- | ------------------------------------------------------------------------------------ |
| ----------------- | ------------------------------------------------------------------------------------------------- |
| --all             | Enable all jobs by default in selections                                                          |
| --defaults        | Use default variables for .local:configurations                                                   |
| -f, --force       | Force the action (use with --pull)                                                                |
| -i, --ignore-case | Ignore case when searching for names                                                              |
| -m, --manual      | Allow manual jobs to be used                                                                      |
| --no-git-safeties | Disable automated Git safeties configuration<br>(or define CI_LOCAL_NO_GIT_SAFETIES) |
| --no-git-safeties | Disable automated Git safeties configuration<br>(or default settings: [runner] > no_git_safeties) |
| --no-script-fail  | Fail on missing 'script' nodes of jobs<br>(or define CI_LOCAL_NO_SCRIPT_FAIL)                     |
| -R, --no-regex    | Disable regex search of names                                                                     |
| --scripts         | Dump parsed jobs entrypoint scripts                                                               |
+7 −3
Changes for gitlabci_local/cli/main.py: 7 added lines, 3 removed lines.
Original line number Diff line number Diff line
@@ -126,7 +126,7 @@ def main() -> None:
    group.add_argument(
        '--no-git-safeties', dest='no_git_safeties', action='store_true',
        help='Disable automated Git safeties configuration\n'
        f'(or define {Bundle.ENV_NO_GIT_SAFETIES})')
        '(or default settings: [runner] > no_git_safeties)')
    group.add_argument(
        '--no-script-fail', dest='no_script_fail', action='store_true',
        help='Fail on missing \'script\' nodes of jobs\n'
@@ -224,8 +224,12 @@ def main() -> None:
        settings.set(group='engines', key='engine', value=options.engine)

    # Prepare no_git_safeties
    if not options.no_git_safeties and Bundle.ENV_NO_GIT_SAFETIES in environ:
        options.no_git_safeties = True
    if not options.no_git_safeties:
        if settings.has('runner', 'no_git_safeties'):
            options.no_git_safeties = int(settings.get('runner', 'no_git_safeties')) == 1
        else:
            options.no_git_safeties = False
            settings.set('runner', 'no_git_safeties', 1 if options.no_script_fail else 0)

    # Prepare no_script_fail
    if not options.no_script_fail:
+0 −1
Changes for gitlabci_local/package/bundle.py: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -39,7 +39,6 @@ class Bundle:
    ENV_IMAGE_DEFAULT: str = 'CI_LOCAL_IMAGE_DEFAULT'
    ENV_LOCAL: str = 'CI_LOCAL'
    ENV_NETWORK: str = 'CI_LOCAL_NETWORK'
    ENV_NO_GIT_SAFETIES: str = 'CI_LOCAL_NO_GIT_SAFETIES'
    ENV_NO_SCRIPT_FAIL: str = 'CI_LOCAL_NO_SCRIPT_FAIL'
    ENV_NOTIFY_BINARY_PATH: str = 'NOTIFY_BINARY_PATH'
    ENV_PODMAN_BINARY_PATH: str = 'PODMAN_BINARY_PATH'
+0 −1
Changes for tests/safeties/test.sh: 0 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -15,5 +15,4 @@ set -ex

# Run tests
gitlabci-local --no-git-safeties -p && exit 1 || true
CI_LOCAL_NO_GIT_SAFETIES=true gitlabci-local -p && exit 1 || true
gitlabci-local -p