buildkite / buildkite/docs

Unexpected behaviour when mixing depends_on and branches

Open
#1,453 3 comments 0 reactions 0 assignees View on GitHub
Dominant language
Ruby
Stars
59
Forks
313
PR merge metrics
No merged PRs in 30d

Description

I'm trying to construct a CI/CD pipeline that should build for all Git branches, publish an artifact only for the `main` branch, and deploy if an artifact was published, e.g.

```yml
- command: ./gradlew build
key: build

- command: ./gradlew jib
key: publish
branches: "main"

- command: deploy.sh
key: deploy
depends_on: publish
```
What I've found is that the `deploy` step executes even though the `publish` step does not. Worse, if the `publish` step isn't even defined, the `deploy` step still runs, e.g.
```yml
- command: ./gradlew build
key: build

# - command: ./gradlew jib
# key: publish
# branches: "main"

- command: deploy.sh
key: deploy
depends_on: publish
```
I haven't tried the `if` property so I don't know if it works the same way as `branches, but I wouldn't expect this to be the behaviour for `depends_on`. I would expect the step to fail, or at worse, wait indefinitely.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.