Skip to content

Commit

Permalink
fix DCI merge queue job
Browse files Browse the repository at this point in the history
  • Loading branch information
fredericlepied committed Jan 6, 2024
1 parent ceb04c6 commit 85b426b
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 4 deletions.
6 changes: 4 additions & 2 deletions .github/workflows/dci-merge.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ on:
jobs:

dci-job:
name: "DCI"
name: "DCI Merge Job"
runs-on: bos2
steps:

Expand All @@ -19,7 +19,9 @@ jobs:
git fetch origin ${{ github.event.merge_group.base_sha }}
git fetch origin ${{ github.event.merge_group.head_sha }}
if git diff --name-only ${{ github.event.merge_group.base_sha }} ${{ github.event.merge_group.head_sha }} | grep -E 'roles/|plugins/'; then
./hack/dci-merge.sh
echo "Starting DCI job"
export GITHUB_TOKEN=${{ secrets.GITHUB_TOKEN }}
./hack/dci-merge.sh ${{ github.event.merge_group.head_sha }}
else
echo "No code change"
fi
Expand Down
19 changes: 17 additions & 2 deletions hack/dci-merge.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
#
# Copyright (C) 2023 Red Hat, Inc.
# Copyright (C) 2023, 2024 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
Expand All @@ -16,6 +16,9 @@

# script called from a merge queue branch of the redhatci/ansible-collection-redhatci-ocp repo

HEAD_SHA="$1"
GITHUB_JOBNAME="DCI / DCI Job"
STATUSES_URL="https://api.github.com/repos/redhatci/ansible-collection-redhatci-ocp/statuses/$HEAD_SHA"
VIRT=
DCI_QUEUE=
SNO_DCI_QUEUE=
Expand All @@ -38,6 +41,12 @@ GH_HEADERS=(
"Authorization: token ${GITHUB_TOKEN}"
)

send_status() {
curl -s "${GH_HEADERS[@]/#/-H}" -X POST -d "{\"state\":\"$1\",\"context\":\"$GITHUB_JOBNAME\"}" "$STATUSES_URL"
}

set -x

# Lookup the merge commits and get their PR descriptions to detect Test-Hints: strings
COMMIT=HEAD
VIRT=
Expand Down Expand Up @@ -143,6 +152,12 @@ export DCI_SILENT=1
cd "$DIR" || exit 1

# shellcheck disable=SC2086
dci-queue schedule --block -C "$DCI_QUEUE" -- env DCI_SILENT=$DCI_SILENT UPGRADE_ARGS="$UPGRADE_ARGS" RES=@RESOURCE APP_NAME=$APP_NAME APP_ARGS="$APP_ARGS" $BASEDIR/test-runner $VIRT $FORCE_CHECK $TAG $UPGRADE $NO_COMMENT $DIR "$@" $OPTS
if dci-queue schedule --block -C "$DCI_QUEUE" -- env DCI_SILENT=$DCI_SILENT UPGRADE_ARGS="$UPGRADE_ARGS" RES=@RESOURCE APP_NAME=$APP_NAME APP_ARGS="$APP_ARGS" $BASEDIR/test-runner $VIRT $FORCE_CHECK $TAG $UPGRADE $NO_COMMENT $DIR "$@" $OPTS; then
send_status success
exit 0
else
send_status failure
exit 1
fi

# dci-merge.sh ends here

0 comments on commit 85b426b

Please sign in to comment.