Commit 645d9683 authored by Adrian DC's avatar Adrian DC
Browse files

feat: prepare #203: implement entrypoint printer with '--scripts'

parent 22a4ee92
Loading
Loading
Loading
Loading
Loading
+1 −0
Changes for README.md: 1 added line, 0 removed lines.
Original line number Diff line number Diff line
@@ -87,6 +87,7 @@ is the common and unique interface between GitLab CI and gitlabci-local.
| -i, --ignore-case | Ignore case when searching for names                                    |
| -m, --manual      | Allow manual jobs to be used                                            |
| -R, --no-regex    | Disable regex search of names                                           |
| --scripts         | Dump parsed jobs entrypoint scripts                                     |
| -t TAGS           | Handle listed tags as manual jobs<br>Default list: deploy,local,publish |

| Features arguments |                                            |
+2 −0
Changes for gitlabci_local/cli/main.py: 2 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -115,6 +115,8 @@ def main():
                       help='Allow manual jobs to be used')
    group.add_argument('-R', '--no-regex', dest='no_regex', action='store_true',
                       help='Disable regex search of names')
    group.add_argument('--scripts', dest='scripts', action='store_true',
                       help='Dump parsed jobs entrypoint scripts')
    group.add_argument(
        '-t', dest='tags',
        help=f"Handle listed tags as manual jobs\nDefault list: {','.join(tags_default)}")
+1 −1
Changes for gitlabci_local/features/pipelines.py: 1 added line, 1 removed line.
Original line number Diff line number Diff line
@@ -86,7 +86,7 @@ class PipelinesFeature:
        pipeline_history.result = result

        # Non quiet jobs
        if not pipeline_history.jobs_quiet:
        if not pipeline_history.jobs_quiet and not self.__options.scripts:

            # Pipeline jobs footer
            if pipeline_history.jobs_count > 1:
+5 −0
Changes for gitlabci_local/jobs/runner.py: 5 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -454,6 +454,11 @@ class Jobs:
              | S_IRGRP | S_IROTH | S_IXOTH)
        script_file.close()

        # Print script contents
        if self.__options.scripts:
            script_file.print()
            return True

        # Acquire CI environment
        env_job_name = job_data['options']['env_job_name']
        env_job_path = job_data['options']['env_job_path']
+10 −0
Changes for gitlabci_local/jobs/scripts.py: 10 added lines, 0 removed lines.
Original line number Diff line number Diff line
@@ -89,6 +89,16 @@ class Scripts:
        # Result
        return self.__file.name

    # Print
    def print(self):

        # Flush file
        self.flush()

        # Print content
        with open(self.__file.name, encoding='utf8', mode='r') as file:
            print(file.read())

    # Shebang
    def shebang(self):