I’ve got a strange issue in gitlab-ci. On one of our job, I wanted to create or update an existing branch on github from our gitlab runner.
For that I have to check if the branch already exists on the remote server. The plan was to clone the repository with the wanted branch and in case of failure create a branch based on the default branch.
The problem being that for some reasons, gitlabci would always enter the if statement even if the folder was created or the process exited with 0.
So I changed the job to use the when: on_failure to create the branch. It works almost well except that the following job I created which is on_success seems to not care if the on_failure job is a success or not.
So in some case it execute job A B skip C and execute D.
In other cases it execute job A fails B execute C and skip D.
What I’d like to see in the second case if A fails B execute C execute D.
Or if there’s a way to check the existence of the branch in job B and either checkout or create a new branch and then deploy in D.
It’s annoying because even if it can create the new branch now, it never deploy it to github.
The documentation seems to show that on_success is execute when a prior job successfully executed. Which should work because on_failure was executed without error before the job D.