Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ci(build): fail if there are more than 4 builds running #98

Draft
wants to merge 2 commits into
base: main
Choose a base branch
from
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 9 additions & 4 deletions .github/workflows/build-and-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -20,20 +20,25 @@ permissions:
contents: write

jobs:
check-input:
check-preconditions:
runs-on: ubuntu-latest
steps:
- name: Fail if version starts with "v"
id: check-v
id: check-preconditions
run: |
VERSION=${{ inputs.version }}
if [[ $VERSION == v* ]]; then
echo "Run this action without 'v' prefix - ${VERSION:1}. Don't cancel a build in progress build because things might not be cleaned up by terraform"
exit 1
fi
shell: bash

RUNNING=$(gh run list --workflow .github/workflows/build-and-release.yaml --json status,conclusion,createdAt,updatedAt | jq '[.[] | select((.status == "in_progress") or (.updatedAt > (now - 7200 | strftime("%Y-%m-%dT%H:%M:%SZ"))) and (.conclusion != "failure"))] | length')
if [ "$RUNNING" -gt "4" ]; then
echo "We can't have more than 4 envoy builds that are either running or finished in the last 2 hours"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this a problem for every OS or just darwin?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@lukidzi - you're probably an expert here

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's a limit that we have in AWS to allocate only 4 dedicate machines

exit 2
fi
build:
needs: check-input
needs: check-preconditions
strategy:
matrix:
os: [darwin, linux, windows]
Expand Down