GoogleCloudPlatform / GoogleCloudPlatform/cloud-builders-community

Cancelot not cancelling builds in progress

Open
#386 4 comments 3 reactions 0 assignees View on GitHub
Dominant language
Go
Stars
1.3k
Forks
848
PR merge metrics
No merged PRs in 30d

Description

## Affected builder image

`gcr.io/cloud-builders-community/cancelot`

## Expected Behavior

Cancelot should be cancelling running builds.

## Actual Behavior

The filters are not matching any running builds, even though some are currently in progress.

## Steps to Reproduce the Problem

1. Create a trigger for a GH repository matching any branch
2. Add the following build step:

```
- name: 'gcr.io/$PROJECT_ID/cloud-builders/cancelot'
id: 'Cancelot'
args: [
'--current_build_id', '$BUILD_ID',
'--branch_name', '$BRANCH_NAME',
'--same_trigger_only'
]
```

3. Push a change to a branch
4. Wait for the build to change status to `WORKING`
5. Push a change to the same branch
6. Once Cancelot runs subsequently, the filters do not return any matching builds that are in progress

## Additional Info

Step output for initial build:

```
2020/03/29 10:33:38 Starting cancelot
2020/03/29 10:33:38 Going to fetch current build details for: 338be4dd-2763-425e-9463-73d04fc923e7
2020/03/29 10:33:38 Going to check ongoing jobs for branch: fix/use-day-arithmetic-for-dst-robustness
2020/03/29 10:33:38 Builds filter created:

build_id != "338be4dd-2763-425e-9463-73d04fc923e7" AND
source.repo_source.branch_name = "fix/use-day-arithmetic-for-dst-robustness" AND
status = "WORKING" AND
start_time<"2020-03-29T10:33:15.545550039Z" AND
trigger_id = "9e080861-0f43-4fbe-88f3-3123a45394dc"
2020/03/29 10:33:39 Ongoing builds triggered by 9e080861-0f43-4fbe-88f3-3123a45394dc for fix/use-day-arithmetic-for-dst-robustness has size of: 0
```

Step output for subsequent build:

```
2020/03/29 10:31:51 Starting cancelot
2020/03/29 10:31:51 Going to fetch current build details for: c8f63287-7f94-4527-9ee4-d5181675a8b8
2020/03/29 10:31:51 Going to check ongoing jobs for branch: fix/use-day-arithmetic-for-dst-robustness
2020/03/29 10:31:51 Builds filter created:

build_id != "c8f63287-7f94-4527-9ee4-d5181675a8b8" AND
source.repo_source.branch_name = "fix/use-day-arithmetic-for-dst-robustness" AND
status = "WORKING" AND
start_time<"2020-03-29T10:31:29.481194096Z" AND
trigger_id = "9e080861-0f43-4fbe-88f3-3123a45394dc"
2020/03/29 10:31:52 Ongoing builds triggered by 9e080861-0f43-4fbe-88f3-3123a45394dc for fix/use-day-arithmetic-for-dst-robustness has size of: 0
```

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.