Skip to content

Commit

Permalink
ZENKO-4730: Adding support for patch check on CI
Browse files Browse the repository at this point in the history
  • Loading branch information
benzekrimaha committed Mar 8, 2024
1 parent 0cefe9e commit 5dad620
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/end2end.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -654,6 +654,37 @@ jobs:
source: /tmp/artifacts
if: always()

mongo-patches-check:
runs-on: ubuntu-20.04
steps:
- name: Checkout repository
uses: actions/checkout@v3
- name: run patch
run: make -C solution-base/mongodb patch
- name: Check if patches were applied right
run: |
git diff --exit-code || { echo "Error: Changes detected after running 'make fetch-mongodb-sharded'. Please ensure step is completed."; exit 1; }
- name: Set status in ARTIFACTS to enable re-run only failed jobs
if: success()
run: |
mkdir -p /tmp/artifacts/build_status/${{ github.job }}
echo 'SUCCESSFUL' > /tmp/artifacts/build_status/${{ github.job }}/.final_status
- name: Set status in ARTIFACTS to enable re-run only failed jobs
if: failure()
run: |
mkdir -p /tmp/artifacts/build_status/${{ github.job }}
echo 'FAILED' > /tmp/artifacts/build_status/${{ github.job }}/.final_status
- name: Upload artifacts
uses: scality/action-artifacts@v3
with:
method: upload
url: https://artifacts.scality.net
user: ${{ secrets.ARTIFACTS_USER }}
password: ${{ secrets.ARTIFACTS_PASSWORD }}
source: /tmp/artifacts
if: always()


write-final-failed-status:
runs-on: ubuntu-latest
needs:
Expand All @@ -666,6 +697,7 @@ jobs:
- end2end-https
- end2end-sharded
- ctst-end2end-sharded
- mongo-patches-check
if: failure()
steps:
- name: write failure status
Expand Down
13 changes: 9 additions & 4 deletions solution-base/mongodb/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ CHART_MONGO_REPLICASET_VERSION:="7.8.0"
CHART_MONGO_SHARDED_VERSION:="6.6.7"

PATCH_DIR:="${ROOT_DIR}/patches"
PATCH_FILES:="$(shell ls -d ${PATCH_DIR}/*)"
PATCH_FILES := $(shell ls -d ${PATCH_DIR}/* | tr '\n' ' ')

HELM=helm

Expand All @@ -25,7 +25,12 @@ fetch-mongodb-sharded:
--version ${CHART_MONGO_SHARDED_VERSION} \
--untar \
--untardir ${CHART_DIR}

patch:
@git apply --check ${PATCH_FILES}
@git apply ${PATCH_FILES}
@for patch_file in $(PATCH_FILES); do \
if [ "$$patch_file" != "${PATCH_DIR}/create-app-creds.patch" ] && [ "$$patch_file" != "${PATCH_DIR}/mongodb-sharded-add-configsvr-service.patch" ] && [ "$$patch_file" != "${PATCH_DIR}/credentials-from-secret.patch" ]; then \
echo "Applying patch: $$patch_file"; \
cd $(PATCH_DIR) && git apply --check "$$patch_file" || exit 1; \
cd $(PATCH_DIR) && git apply "$$patch_file"; \
fi; \
done

4 changes: 4 additions & 0 deletions solution-base/yarn.lock
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY.
# yarn lockfile v1


0 comments on commit 5dad620

Please sign in to comment.