diff options
author | Bjarke Istrup Pedersen <gurli@gurlinet.dk> | 2024-07-03 09:40:04 +0200 |
---|---|---|
committer | Bjarke Istrup Pedersen <gurli@gurlinet.dk> | 2024-07-03 09:40:04 +0200 |
commit | 2c411f0a316a63c0e716414b0d775639267dbbe3 (patch) | |
tree | a6529bda7fa3b43ca13961307dcfba469ca13c7d | |
parent | ddbba63f14348afcb4a76b8d2cbe16dc99b04332 (diff) | |
download | vyos-jenkins-2c411f0a316a63c0e716414b0d775639267dbbe3.tar.gz vyos-jenkins-2c411f0a316a63c0e716414b0d775639267dbbe3.zip |
Move branch filter logic
By moving it up here, we make sure only jobs that should be built is added to the JOBS array in the first place.
This is a better way, since the skipped jobs won't occupy the build slots (since we take X number of jobs from the JOBS array for each batch, for a CONCURRENT_JOBS_COUNT of 10 - if 6 is skipped, only 4 jobs will be started).
Now, they are not added to the JOBS array, so the rest works as intended.
-rw-r--r-- | auto/helper-logic | 17 |
1 files changed, 5 insertions, 12 deletions
diff --git a/auto/helper-logic b/auto/helper-logic index 7642c9a..7c1360c 100644 --- a/auto/helper-logic +++ b/auto/helper-logic @@ -423,6 +423,11 @@ function BuildJobs { for BRANCH in $BRANCHES do + # Branch filter + if ! echo $BRANCH | grep -E "$SELECTED_BRANCH_REGEX" > /dev/null; then + continue + fi + JOBS+=( "$JOB_NAME|$BRANCH" ) done done < <(cat $1 | jq -c '.[]') @@ -484,12 +489,6 @@ function BuildJobs { JOB_NAME="${jobSplit[0]}" JOB_BRANCH="${jobSplit[1]}" - # Branch filter - if ! echo $JOB_BRANCH | grep -E "$SELECTED_BRANCH_REGEX" > /dev/null; then - PrintJobExcluded $JOB_NAME $JOB_BRANCH - continue - fi - # Download job data and parse it. URL="${JENKINS_URL}/job/${JOB_NAME}/job/${JOB_BRANCH}/lastBuild/api/json" DATA=$(curl -Ss -g --fail-with-body "$URL") @@ -565,12 +564,6 @@ function BuildJobs { JOB_NAME="${jobSplit[0]}" JOB_BRANCH="${jobSplit[1]}" - # Branch filter - if ! echo $JOB_BRANCH | grep -E "$SELECTED_BRANCH_REGEX" > /dev/null; then - PrintJobExcluded $JOB_NAME $JOB_BRANCH - continue - fi - # Download job data and parse it. URL="${JENKINS_URL}/job/${JOB_NAME}/job/${JOB_BRANCH}/lastBuild/api/json" DATA=$(curl -Ss -g --fail-with-body "$URL") |