From 18821f977d1c5c4072b7aeb1ff13281d67e478aa Mon Sep 17 00:00:00 2001 From: Zuzana Miklankova Date: Tue, 12 Mar 2024 18:47:48 +0100 Subject: [PATCH] add github action for checking if imagestreams are properly regenerated --- .github/workflows/check-imagestreams.yml | 54 ++++++++++++++++++++++++ 1 file changed, 54 insertions(+) create mode 100644 .github/workflows/check-imagestreams.yml diff --git a/.github/workflows/check-imagestreams.yml b/.github/workflows/check-imagestreams.yml new file mode 100644 index 00000000..53a66725 --- /dev/null +++ b/.github/workflows/check-imagestreams.yml @@ -0,0 +1,54 @@ +--- +name: Imagestreamfiles check +on: + issue_comment: + types: + - created + +permissions: + contents: read + +jobs: + check: + name: "Check imagestream generator generated files" + runs-on: ubuntu-20.04 + if: | + github.event.issue.pull_request + && (contains(github.event.comment.body, '[test]') || contains(github.event.comment.body, '[test-all]')) + && contains(fromJson('["OWNER", "MEMBER"]'), github.event.comment.author_association) + steps: + - name: Checkout repo + uses: actions/checkout@v4 + + - name: Check imagestream files + id: check + shell: bash + run: | + sudo apt -y update && sudo apt install -y python3-yaml + git clone https://github.com/sclorg/ci-scripts.git ci-scripts + sha=$(git rev-parse HEAD) + result="success" + python ci-scripts/ocp-stream-generator/ocp-stream-generator/stream_generator.py + git diff --exit-code -- imagestreams || result="failure" + echo "result=$result" >> "$GITHUB_OUTPUT" + echo "sha=$sha" >> "$GITHUB_OUTPUT" + + - name: Set final commit status + uses: myrotvorets/set-commit-status-action@v2.0.0 + with: + status: ${{ steps.check.outputs.result }} + context: "Imagestream files check" + sha: ${{ steps.check.outputs.sha }} + + - name: Exit on ERR + shell: bash + run: | + _result=${{ steps.check.outputs.result }} + if [ "$_result" == failure ]; then + git show -s -- imagestreams + echo "::error::Imagestream files are not regenerated properly." + echo "::warning::Please use 'sclorg/ci-scripts/ocp-stream-generator'" + echo "::warning::to regenerate them." + exit 1 + fi +...