Following some usage statistics we have dug into some configuration tweaks for Semaphore 2.
We noticed that this project has no auto_cancel option set for its pipeline.
Auto-cancel Previous Pipelines on a New Push
--- https://docs.semaphoreci.com/use-cases/auto-cancel-previous-pipelines-on-a-new-push/
This parameter simply tells Semaphore to cancel any running pipeline if a new push is done.
This can avoid having newer pushes wait for available resources to be run through the pipeline.
What to do
Here are two options you can pick from.
Auto cancel for all branches
This one is simple. You only need to had the following entry at the root of the semaphore.yml file. Just after the agent block.
auto_cancel:
queued:
when: "true" # enable auto-cancel for branches, tags and pull-requests
Do like @Flokkie97 : https://github.com/nedap/hera/blob/7b81b51e4abb6603cad7d1de8e8ba2bd3735a4da/.semaphore/semaphore.yml#L17-L19
Auto cancel but not for master
Master and releases branches might require to be built for every push or merge so that releasables are available.
To have such a conditional you can use the following added at the root of the semaphore.yml file.
You only need to had the following entry at the root of the semaphore.yml file. Just after the agent block.
auto_cancel:
running:
when: "branch != 'master'"
Do like @Flokkie97 (yes, he changed his mind) : https://github.com/nedap/hera/blob/master/.semaphore/semaphore.yml#L17-L19
Wrap up
There are cases where you might not want that included, and that's fine. Keep in mind that even
if you don't mind every push waiting it also potentially means other pushes from other team members are waiting for resources.
"...with great power there must also come -- great responsibility!"
Following some usage statistics we have dug into some configuration tweaks for Semaphore 2.
We noticed that this project has no
auto_canceloption set for its pipeline.This parameter simply tells Semaphore to cancel any running pipeline if a new push is done.
This can avoid having newer pushes wait for available resources to be run through the pipeline.
What to do
Here are two options you can pick from.
Auto cancel for all branches
This one is simple. You only need to had the following entry at the root of the
semaphore.ymlfile. Just after theagentblock.Do like @Flokkie97 : https://github.com/nedap/hera/blob/7b81b51e4abb6603cad7d1de8e8ba2bd3735a4da/.semaphore/semaphore.yml#L17-L19
Auto cancel but not for master
Master and releases branches might require to be built for every push or merge so that releasables are available.
To have such a conditional you can use the following added at the root of the semaphore.yml file.
You only need to had the following entry at the root of the
semaphore.ymlfile. Just after theagentblock.Do like @Flokkie97 (yes, he changed his mind) : https://github.com/nedap/hera/blob/master/.semaphore/semaphore.yml#L17-L19
Wrap up
There are cases where you might not want that included, and that's fine. Keep in mind that even
if you don't mind every push waiting it also potentially means other pushes from other team members are waiting for resources.