Commit c3f1c78e authored by Adrian DC's avatar Adrian DC
Browse files

fix: resolve #146: ensure before_script really checks for issues

parent b9495e4c
Loading
Loading
Loading
Loading
Loading
+2 −1
Changes for gitlabci_local/runner.py: 2 added lines, 1 removed line.
Original line number Diff line number Diff line
@@ -266,7 +266,8 @@ def runner(options, job_data, last_result, jobs_status):
        script_file.write('\n')
        script_file.write('\n'.join(scripts_before))
        script_file.write('\n')
        script_file.write('} && ')
        script_file.write('}')
        script_file.write('\n')
        script_file.flush()

    # Prepare script commands
+67 −0
Changes for tests/scripts/.gitlab-ci.yml: 67 added lines, 0 removed lines.
Original line number Diff line number Diff line
image: alpine:3

stages:
  - scripts

before_script:
  - echo '__BEFORE_SCRIPT__'

after_script:
  - echo '__AFTER_SCRIPT__'

'Job 1':
  stage: scripts
  script:
    - echo 'Job 1'

'Job 2':
  stage: scripts
  script:
    - echo 'Job 2'
    - 'false'

'Job 3':
  stage: scripts
  before_script:
    - echo 'Before Job 3'
    - 'false'
  script:
    - echo 'Job 3'
  after_script:
    - echo 'After Job 3'

'Job 4':
  stage: scripts
  before_script:
    - echo 'Before Job 3'
  script:
    - echo 'Job 3'
  after_script:
    - echo 'After Job 3'
    - 'false'

'Job 5':
  stage: scripts
  script:
    - 'false'
    - echo 'Job 5'

'Job 6':
  stage: scripts
  before_script:
    - 'false'
    - echo 'Before Job 6'
  script:
    - echo 'Job 6'
  after_script:
    - echo 'After Job 6'

'Job 7':
  stage: scripts
  before_script:
    - echo 'Before Job 7'
  script:
    - echo 'Job 7'
  after_script:
    - 'false'
    - echo 'After Job 7'

tests/scripts/test.sh

0 → 100644
+19 −0
Changes for tests/scripts/test.sh: 19 added lines, 0 removed lines.
Original line number Diff line number Diff line
#!/bin/sh

# Access folder
script_path=$(readlink -f "${0}")
test_path=$(readlink -f "${script_path%/*}")
cd "${test_path}/"

# Configure tests
set -ex

# Run tests
gitlabci-local -p && exit 1 || true
gitlabci-local 'Job 1'
gitlabci-local 'Job 2' && exit 1 || true
gitlabci-local 'Job 3' && exit 1 || true
gitlabci-local 'Job 4'
gitlabci-local 'Job 5' && exit 1 || true
gitlabci-local 'Job 6' && exit 1 || true
gitlabci-local 'Job 7'