Pipeline: "external" jobs should only run when pipeline succeeds

So I just integrated my GitLab project with ZEIT Now. I have an existing CI pipeline that runs tests etc., and I would like the “Now deploy” step to wait for these pipeline stages to succeed. Is that possible and how?
See screenshot (the “external” stage should have waited for test and build to succeed):

Add your YAML file content it will help answering your question.

1 Like

Of course - here goes:

gitlab-ci.yml:

image: node:latest

stages:
  - test
  - build

run_test:
  stage: test
  script:
    - yarn install
    - CI=true && yarn run test

build_app:
  stage: build
  script:
    - yarn install
    - yarn run build

And in project settings > Integrations, it shows the integration with Zeit of course:

Screenshot 2020-01-30 at 18.54.16

What about adding External like this:

stages:
  - test
  - build
  - external
  ...
whatever:
   stage: external
   script:
   ...
1 Like

Here an example using needs. Build is forcing an error.

mac:build:
  stage: build
  script:
  - echo "mac:build"
  - exit 1

mac:rspec:
  stage: test
  # when: manual
  needs: ["mac:build"]
  script:
  - echo "mac:rspec"

mac:production:
  stage: deploy
  needs: ["mac:build","mac:rspec"]
  script:
  - echo "mac:production"

It will looks like this. On gitlab.com for what reason ever the 2 last stages recognised as manual in case of failure… on success the vis. is OK.

1 Like