Run pipeline manually with except changes

#1

Wanted to NOT trigger CI pipeline when a README.md is committed, so added to .gitlab-ci.yml for each job:

  except:
    changes:
    - README.md

which worked as expected. But if try to trigger the pipeline manually with the “Run Pipeline” button, I get the following error:

The form contains the following error:
No stages / jobs for this pipeline.

Remove the except setting and pipeline can be manually triggered as expected.

Newbie here, is this expected behavior? Definitely no show-stopper but would be nice to have both features.

.gitlab-ci.yml

cache:
  paths:
  - node_modules/

stages:
- local_build
- image_build

build:
  image: node:latest
  stage: local_build
  script:
  - npm config set https-proxy $NPM_HTTPS_PROXY
  - npm install
  - npm run build:prod
  artifacts:
    paths:
    - build
  except:
    changes:
    - README.md

docker:
  image: docker:latest
  stage: image_build
  script:
  - docker info
  - docker login -u $DOCKER_REG_USER -p $DOCKER_REG_PASSWD $DOCKER_REG_HOST
  - docker build --no-cache -t $DOCKER_REG_HOST/image .
  - docker push $DOCKER_REG_HOST/image
  except:
    changes:
    - README.md

0 Likes

Run pipeline failed
#2

Hi @pfzoso, have you already solved the problem? If not, could you show the whole .gitlab-ci.yml?

0 Likes

#3

Thanks, added .gitlab-ci.yml

0 Likes

#4

Hi, sorry for the belated response (have not noticed that you added the file).

Could you try to indent the names of the stages:

stages:
   - local_build
   - image_build
0 Likes

#5

Thanks but I don’t see how that would make a diff, it is valid YAML syntax. Not sure you understand my issue. I have no problem triggering pipelines with commit, only manual triggers. Forgot to mention we are on version 11.4.9 which I have no control over. Thanks for responding though and would be nice to know if you have tried this yourself and what version you are using.

thanks

0 Likes

#6

Hi there,

This is the intended behaviour. Manually running the pipeline will run it against the last commit in the branch you select after clicking “Run Pipeline”, so if that branch’s last commit contains changes to your README.md file, then the jobs containing the except will be skipped.

You can test this out on your end on a testing branch by making a commit that changes the README.md file, then executing the pipeline again manually - you will see that the jobs containing the exception will be skipped. Then, make a commit that does not edit the README.md file and run the pipeline again, you should see that those jobs are no longer excluded.

Hope this helps! :slight_smile:

1 Like

#7

This is not the behavior I see. My last commits have only been edits to .gitlab-ci.yml.

  1. edit .gitlab-ci.yml removing README exception
  2. commit
  3. pipeline triggered by commit
  4. pipeline can be manually triggered
  5. edit .gitlab-ci.yml adding README exception
  6. commit
  7. pipeline triggered by commit
  8. pipeline cannot be manually triggered, above error displayed
  9. rinse and repeat
0 Likes

#8

Hi,

Thanks for the clarification, sorry I overlooked that. I’ve done some more testing and found that the error is presented only when the except is present in all jobs within the .gitlab-ci.yml file. As far as I can tell, this looks to be a bug. I recommend opening a bug report on the matter. You may want to attach a link to this thread as a reference point within that bug tracker as well.

0 Likes

#9

Hi guys

have the same issue. Have you opened issue on gitlab ?

Alex

0 Likes

#10

Any chance to prioritize this higher.

0 Likes

#11

the same here, would be prefect to prioritize this.

0 Likes

#12

opened issue 59253

0 Likes