From 2348c5672c1aaad56bac8f7401e8887007c697e3 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 13:42:12 +0100 Subject: [PATCH 1/7] Using gh actions instead of curl-based approach to call rest tests --- .github/workflows/deploy.yml | 208 +++++++++++++++++++++-------------- 1 file changed, 126 insertions(+), 82 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 951a56d570c..d92bed58de5 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,33 +80,33 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/erase-db - if: inputs.ERASE_DB - with: - INSTANCE: ${{ env.INSTANCE }} - NAME: dspace-${{ env.INSTANCE }} - - - name: deploy dspace-import on dev-5 - working-directory: build-scripts/run/ - run: | - ./start.sh dspace-$INSTANCE - cd ../.. - # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above - # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull - docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build - - # this must be here and not in the start.sh, because extra.yml replaces dspace container - ## !!!!! please remove this section if you do not want handle server !!!!!!! - echo "=====" - echo "installing handle server" - docker exec dspace${INSTANCE} /dspace/bin/make-handle-config - echo "made handle config:" - docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct - docker exec dspace${INSTANCE} /dspace/bin/start-handle-server - echo "started handle server" - # this seems to be the easiest solution for now - docker restart dockerized-nginx-with-shibboleth-nginx-1 - /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' + # - uses: ./.github/actions/erase-db + # if: inputs.ERASE_DB + # with: + # INSTANCE: ${{ env.INSTANCE }} + # NAME: dspace-${{ env.INSTANCE }} + + # - name: deploy dspace-import on dev-5 + # working-directory: build-scripts/run/ + # run: | + # ./start.sh dspace-$INSTANCE + # cd ../.. + # # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above + # # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull + # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build + + # # this must be here and not in the start.sh, because extra.yml replaces dspace container + # ## !!!!! please remove this section if you do not want handle server !!!!!!! + # echo "=====" + # echo "installing handle server" + # docker exec dspace${INSTANCE} /dspace/bin/make-handle-config + # echo "made handle config:" + # docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct + # docker exec dspace${INSTANCE} /dspace/bin/start-handle-server + # echo "started handle server" + # # this seems to be the easiest solution for now + # docker restart dockerized-nginx-with-shibboleth-nginx-1 + # /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' import-5: @@ -193,44 +193,67 @@ jobs: echo "dspace healthcheck:" docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" - playwright-after-deploy8: - needs: deploy-8 - if: '!inputs.IMPORT' - uses: ./.github/workflows/playwright-tests.yml - secrets: inherit + # playwright-after-deploy8: + # needs: deploy-8 + # if: '!inputs.IMPORT' + # uses: ./.github/workflows/playwright-tests.yml + # secrets: inherit rest-tests-after-deploy8: runs-on: ubuntu-latest - needs: playwright-after-deploy8 + # needs: playwright-after-deploy8 + needs: deploy-8 + if: '!inputs.IMPORT' timeout-minutes: 120 + env: + GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} steps: - name: run rest-tests run: | - curl -H "Accept: application/vnd.github.everest-preview+json" \ - -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ - --request POST \ - https://api.github.com/repos/dataquest-dev/\ - dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ - --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null - - # wait for it to start - sleep 30s - - # get result of last job - RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) - - # while job did not finish, sleep - while [[ $RES == 'null' ]]; do - sleep 10s - RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) - done; - - echo $RES - # if last result is not success, return -1 and fail - if [[ $RES != \"success\" ]]; then - echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository" + REPO="dataquest-dev/dspace-rest-test" + WORKFLOW="run_unittests.yml" + + # Record time before dispatch to find the correct run later + TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) + echo "Triggering REST tests at $TRIGGER_TIME" + + # Trigger the workflow with inputs + gh workflow run "$WORKFLOW" \ + --repo "$REPO" \ + --ref master \ + -f CUSTOMER="${{ github.ref_name }}" \ + -f URL="http://dev-5.pc:88/repository/server/api" + + echo "Workflow dispatch triggered, waiting for run to appear..." + sleep 15 + + # Find the run we just triggered + RUN_ID="" + for i in $(seq 1 12); do + RUN_ID=$(gh run list \ + --repo "$REPO" \ + --workflow "$WORKFLOW" \ + --event workflow_dispatch \ + --created ">=$TRIGGER_TIME" \ + --json databaseId \ + --jq '.[0].databaseId // empty') + + if [[ -n "$RUN_ID" ]]; then + echo "Found workflow run: $RUN_ID" + break + fi + echo "Attempt $i: Run not found yet, waiting 15s..." + sleep 15 + done + + if [[ -z "$RUN_ID" ]]; then + echo "::error::Could not find the triggered workflow run after 3 minutes" exit 1 - fi; + fi + + # Watch the run until it completes (polls every 30s, shows live status) + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" + gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status playwright-after-import8: @@ -243,31 +266,52 @@ jobs: runs-on: ubuntu-latest needs: playwright-after-import8 timeout-minutes: 120 + env: + GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} steps: - - name: run rest-tests + - name: Trigger and watch REST tests run: | - curl -H "Accept: application/vnd.github.everest-preview+json" \ - -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" \ - --request POST \ - https://api.github.com/repos/dataquest-dev/\ - dspace-rest-test/actions/workflows/run_unittests.yml/dispatches \ - --data "{\"ref\":\"refs/heads/master\"}" 2> /dev/null - - # wait for it to start - sleep 30s - - # get result of last job - RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) - - # while job did not finish, sleep - while [[ $RES == 'null' ]]; do - sleep 10s - RES=$(curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }}" https://api.github.com/repos/dataquest-dev/dspace-rest-test/actions/workflows/run_unittests.yml/runs?per_page=1 2> /dev/null | jq .workflow_runs[0].conclusion) - done; - - echo $RES - # if last result is not success, return -1 and fail - if [[ $RES != \"success\" ]]; then - echo "rest-tests have failed! check appropriate action run in the dspace-rest-test repository" + REPO="dataquest-dev/dspace-rest-test" + WORKFLOW="run_unittests.yml" + + # Record time before dispatch to find the correct run later + TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) + echo "Triggering REST tests at $TRIGGER_TIME" + + # Trigger the workflow with inputs + gh workflow run "$WORKFLOW" \ + --repo "$REPO" \ + --ref master \ + -f CUSTOMER="${{ github.ref_name }}" \ + -f URL="http://dev-5.pc:88/repository/server/api" + + echo "Workflow dispatch triggered, waiting for run to appear..." + sleep 15 + + # Find the run we just triggered + RUN_ID="" + for i in $(seq 1 12); do + RUN_ID=$(gh run list \ + --repo "$REPO" \ + --workflow "$WORKFLOW" \ + --event workflow_dispatch \ + --created ">=$TRIGGER_TIME" \ + --json databaseId \ + --jq '.[0].databaseId // empty') + + if [[ -n "$RUN_ID" ]]; then + echo "Found workflow run: $RUN_ID" + break + fi + echo "Attempt $i: Run not found yet, waiting 15s..." + sleep 15 + done + + if [[ -z "$RUN_ID" ]]; then + echo "::error::Could not find the triggered workflow run after 3 minutes" exit 1 - fi; + fi + + # Watch the run until it completes (polls every 30s, shows live status) + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" + gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status From c0ea2ef833169ea8542bb02523554d04b04c3f2c Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 14:02:58 +0100 Subject: [PATCH 2/7] Uncommented deploy and playwright --- .github/workflows/deploy.yml | 69 ++++++++++++++++++------------------ 1 file changed, 34 insertions(+), 35 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index d92bed58de5..3e8828eda28 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,33 +80,33 @@ jobs: steps: - uses: actions/checkout@v4 - # - uses: ./.github/actions/erase-db - # if: inputs.ERASE_DB - # with: - # INSTANCE: ${{ env.INSTANCE }} - # NAME: dspace-${{ env.INSTANCE }} - - # - name: deploy dspace-import on dev-5 - # working-directory: build-scripts/run/ - # run: | - # ./start.sh dspace-$INSTANCE - # cd ../.. - # # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above - # # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull - # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build - - # # this must be here and not in the start.sh, because extra.yml replaces dspace container - # ## !!!!! please remove this section if you do not want handle server !!!!!!! - # echo "=====" - # echo "installing handle server" - # docker exec dspace${INSTANCE} /dspace/bin/make-handle-config - # echo "made handle config:" - # docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct - # docker exec dspace${INSTANCE} /dspace/bin/start-handle-server - # echo "started handle server" - # # this seems to be the easiest solution for now - # docker restart dockerized-nginx-with-shibboleth-nginx-1 - # /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' + - uses: ./.github/actions/erase-db + if: inputs.ERASE_DB + with: + INSTANCE: ${{ env.INSTANCE }} + NAME: dspace-${{ env.INSTANCE }} + + - name: deploy dspace-import on dev-5 + working-directory: build-scripts/run/ + run: | + ./start.sh dspace-$INSTANCE + cd ../.. + # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above + # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull + docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build + + # this must be here and not in the start.sh, because extra.yml replaces dspace container + ## !!!!! please remove this section if you do not want handle server !!!!!!! + echo "=====" + echo "installing handle server" + docker exec dspace${INSTANCE} /dspace/bin/make-handle-config + echo "made handle config:" + docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct + docker exec dspace${INSTANCE} /dspace/bin/start-handle-server + echo "started handle server" + # this seems to be the easiest solution for now + docker restart dockerized-nginx-with-shibboleth-nginx-1 + /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' import-5: @@ -193,16 +193,15 @@ jobs: echo "dspace healthcheck:" docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" - # playwright-after-deploy8: - # needs: deploy-8 - # if: '!inputs.IMPORT' - # uses: ./.github/workflows/playwright-tests.yml - # secrets: inherit + playwright-after-deploy8: + needs: deploy-8 + if: '!inputs.IMPORT' + uses: ./.github/workflows/playwright-tests.yml + secrets: inherit rest-tests-after-deploy8: runs-on: ubuntu-latest - # needs: playwright-after-deploy8 - needs: deploy-8 + needs: playwright-after-deploy8 if: '!inputs.IMPORT' timeout-minutes: 120 env: @@ -312,6 +311,6 @@ jobs: exit 1 fi - # Watch the run until it completes (polls every 30s, shows live status) + # Watch the run until it completes echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status From 9f404562bc5998a6461259fd469449a680402422 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 14:59:47 +0100 Subject: [PATCH 3/7] Improve finding the id of rest tests --- .github/workflows/deploy.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3e8828eda28..ecf81eeb37c 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -234,8 +234,9 @@ jobs: --workflow "$WORKFLOW" \ --event workflow_dispatch \ --created ">=$TRIGGER_TIME" \ - --json databaseId \ - --jq '.[0].databaseId // empty') + --limit 1 \ + --json databaseId,createdAt \ + --jq 'sort_by(.createdAt) | .[0].databaseId // empty') if [[ -n "$RUN_ID" ]]; then echo "Found workflow run: $RUN_ID" @@ -287,7 +288,7 @@ jobs: echo "Workflow dispatch triggered, waiting for run to appear..." sleep 15 - # Find the run we just triggered + # Find the run we just triggered (oldest after TRIGGER_TIME) RUN_ID="" for i in $(seq 1 12); do RUN_ID=$(gh run list \ @@ -295,8 +296,9 @@ jobs: --workflow "$WORKFLOW" \ --event workflow_dispatch \ --created ">=$TRIGGER_TIME" \ - --json databaseId \ - --jq '.[0].databaseId // empty') + --limit 1 \ + --json databaseId,createdAt \ + --jq 'sort_by(.createdAt) | .[0].databaseId // empty') if [[ -n "$RUN_ID" ]]; then echo "Found workflow run: $RUN_ID" From 917906a78dad50ddaf459edc4acc3093781cc54c Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 15:27:40 +0100 Subject: [PATCH 4/7] Reduced the amount of code --- .github/workflows/deploy.yml | 82 ++++++++---------------------------- 1 file changed, 17 insertions(+), 65 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index ecf81eeb37c..6e50733c3a8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -212,46 +212,22 @@ jobs: REPO="dataquest-dev/dspace-rest-test" WORKFLOW="run_unittests.yml" - # Record time before dispatch to find the correct run later - TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) - echo "Triggering REST tests at $TRIGGER_TIME" - - # Trigger the workflow with inputs gh workflow run "$WORKFLOW" \ --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ -f URL="http://dev-5.pc:88/repository/server/api" - echo "Workflow dispatch triggered, waiting for run to appear..." sleep 15 - # Find the run we just triggered - RUN_ID="" - for i in $(seq 1 12); do - RUN_ID=$(gh run list \ - --repo "$REPO" \ - --workflow "$WORKFLOW" \ - --event workflow_dispatch \ - --created ">=$TRIGGER_TIME" \ - --limit 1 \ - --json databaseId,createdAt \ - --jq 'sort_by(.createdAt) | .[0].databaseId // empty') - - if [[ -n "$RUN_ID" ]]; then - echo "Found workflow run: $RUN_ID" - break - fi - echo "Attempt $i: Run not found yet, waiting 15s..." - sleep 15 - done - - if [[ -z "$RUN_ID" ]]; then - echo "::error::Could not find the triggered workflow run after 3 minutes" - exit 1 - fi - - # Watch the run until it completes (polls every 30s, shows live status) + RUN_ID=$(gh run list \ + --repo "$REPO" \ + --workflow "$WORKFLOW" \ + --event workflow_dispatch \ + --limit 1 \ + --json databaseId \ + --jq '.[0].databaseId') + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status @@ -269,50 +245,26 @@ jobs: env: GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} steps: - - name: Trigger and watch REST tests + - name: run rest-tests run: | REPO="dataquest-dev/dspace-rest-test" WORKFLOW="run_unittests.yml" - # Record time before dispatch to find the correct run later - TRIGGER_TIME=$(date -u +%Y-%m-%dT%H:%M:%SZ) - echo "Triggering REST tests at $TRIGGER_TIME" - - # Trigger the workflow with inputs gh workflow run "$WORKFLOW" \ --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ -f URL="http://dev-5.pc:88/repository/server/api" - echo "Workflow dispatch triggered, waiting for run to appear..." sleep 15 - # Find the run we just triggered (oldest after TRIGGER_TIME) - RUN_ID="" - for i in $(seq 1 12); do - RUN_ID=$(gh run list \ - --repo "$REPO" \ - --workflow "$WORKFLOW" \ - --event workflow_dispatch \ - --created ">=$TRIGGER_TIME" \ - --limit 1 \ - --json databaseId,createdAt \ - --jq 'sort_by(.createdAt) | .[0].databaseId // empty') - - if [[ -n "$RUN_ID" ]]; then - echo "Found workflow run: $RUN_ID" - break - fi - echo "Attempt $i: Run not found yet, waiting 15s..." - sleep 15 - done - - if [[ -z "$RUN_ID" ]]; then - echo "::error::Could not find the triggered workflow run after 3 minutes" - exit 1 - fi - - # Watch the run until it completes + RUN_ID=$(gh run list \ + --repo "$REPO" \ + --workflow "$WORKFLOW" \ + --event workflow_dispatch \ + --limit 1 \ + --json databaseId \ + --jq '.[0].databaseId') + echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status From ac1a04c76b7e608f99ba41286fdc2abb967b15f5 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 16:49:12 +0100 Subject: [PATCH 5/7] Trying new return output from gh workflow run --- .github/workflows/deploy.yml | 101 ++++++++++++++++++----------------- 1 file changed, 53 insertions(+), 48 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6e50733c3a8..e663b4ffed7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,33 +80,33 @@ jobs: steps: - uses: actions/checkout@v4 - - uses: ./.github/actions/erase-db - if: inputs.ERASE_DB - with: - INSTANCE: ${{ env.INSTANCE }} - NAME: dspace-${{ env.INSTANCE }} - - - name: deploy dspace-import on dev-5 - working-directory: build-scripts/run/ - run: | - ./start.sh dspace-$INSTANCE - cd ../.. - # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above - # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull - docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build - - # this must be here and not in the start.sh, because extra.yml replaces dspace container - ## !!!!! please remove this section if you do not want handle server !!!!!!! - echo "=====" - echo "installing handle server" - docker exec dspace${INSTANCE} /dspace/bin/make-handle-config - echo "made handle config:" - docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct - docker exec dspace${INSTANCE} /dspace/bin/start-handle-server - echo "started handle server" - # this seems to be the easiest solution for now - docker restart dockerized-nginx-with-shibboleth-nginx-1 - /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' + # - uses: ./.github/actions/erase-db + # if: inputs.ERASE_DB + # with: + # INSTANCE: ${{ env.INSTANCE }} + # NAME: dspace-${{ env.INSTANCE }} + + # - name: deploy dspace-import on dev-5 + # working-directory: build-scripts/run/ + # run: | + # ./start.sh dspace-$INSTANCE + # cd ../.. + # # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above + # # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull + # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build + + # # this must be here and not in the start.sh, because extra.yml replaces dspace container + # ## !!!!! please remove this section if you do not want handle server !!!!!!! + # echo "=====" + # echo "installing handle server" + # docker exec dspace${INSTANCE} /dspace/bin/make-handle-config + # echo "made handle config:" + # docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct + # docker exec dspace${INSTANCE} /dspace/bin/start-handle-server + # echo "started handle server" + # # this seems to be the easiest solution for now + # docker restart dockerized-nginx-with-shibboleth-nginx-1 + # /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' import-5: @@ -193,40 +193,46 @@ jobs: echo "dspace healthcheck:" docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" - playwright-after-deploy8: - needs: deploy-8 - if: '!inputs.IMPORT' - uses: ./.github/workflows/playwright-tests.yml - secrets: inherit + # playwright-after-deploy8: + # needs: deploy-8 + # if: '!inputs.IMPORT' + # uses: ./.github/workflows/playwright-tests.yml + # secrets: inherit rest-tests-after-deploy8: runs-on: ubuntu-latest - needs: playwright-after-deploy8 + # needs: playwright-after-deploy8 + needs: deploy-8 if: '!inputs.IMPORT' timeout-minutes: 120 env: GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} + REPO: dataquest-dev/dspace-rest-test + WORKFLOW: run_unittests.yml steps: - name: run rest-tests run: | - REPO="dataquest-dev/dspace-rest-test" - WORKFLOW="run_unittests.yml" - - gh workflow run "$WORKFLOW" \ + OUTPUT=$(gh workflow run "$WORKFLOW" \ --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-5.pc:88/repository/server/api" + -f URL="http://dev-5.pc:88/repository/server/api" 2>&1) + + echo "$OUTPUT" + + RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') + + echo "Run ID: $RUN_ID" sleep 15 - RUN_ID=$(gh run list \ - --repo "$REPO" \ - --workflow "$WORKFLOW" \ - --event workflow_dispatch \ - --limit 1 \ - --json databaseId \ - --jq '.[0].databaseId') + # RUN_ID=$(gh run list \ + # --repo "$REPO" \ + # --workflow "$WORKFLOW" \ + # --event workflow_dispatch \ + # --limit 1 \ + # --json databaseId \ + # --jq '.[0].databaseId') echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status @@ -244,12 +250,11 @@ jobs: timeout-minutes: 120 env: GH_TOKEN: ${{ secrets.DEPLOY_DEV5_GH_ACTION_DISPATCH }} + REPO: dataquest-dev/dspace-rest-test + WORKFLOW: run_unittests.yml steps: - name: run rest-tests run: | - REPO="dataquest-dev/dspace-rest-test" - WORKFLOW="run_unittests.yml" - gh workflow run "$WORKFLOW" \ --repo "$REPO" \ --ref master \ From b6b5fd14351a748ab148a9d491efc9d82618087f Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 17:02:46 +0100 Subject: [PATCH 6/7] Use directly output from gh workflow run --- .github/workflows/deploy.yml | 28 +++------------------------- 1 file changed, 3 insertions(+), 25 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index e663b4ffed7..af793b94b81 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -218,22 +218,8 @@ jobs: -f CUSTOMER="${{ github.ref_name }}" \ -f URL="http://dev-5.pc:88/repository/server/api" 2>&1) - echo "$OUTPUT" - RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') - echo "Run ID: $RUN_ID" - - sleep 15 - - # RUN_ID=$(gh run list \ - # --repo "$REPO" \ - # --workflow "$WORKFLOW" \ - # --event workflow_dispatch \ - # --limit 1 \ - # --json databaseId \ - # --jq '.[0].databaseId') - echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status @@ -255,21 +241,13 @@ jobs: steps: - name: run rest-tests run: | - gh workflow run "$WORKFLOW" \ + OUTPUT=$(gh workflow run "$WORKFLOW" \ --repo "$REPO" \ --ref master \ -f CUSTOMER="${{ github.ref_name }}" \ - -f URL="http://dev-5.pc:88/repository/server/api" - - sleep 15 + -f URL="http://dev-5.pc:88/repository/server/api" 2>&1) - RUN_ID=$(gh run list \ - --repo "$REPO" \ - --workflow "$WORKFLOW" \ - --event workflow_dispatch \ - --limit 1 \ - --json databaseId \ - --jq '.[0].databaseId') + RUN_ID=$(echo "$OUTPUT" | grep -oE '/runs/[0-9]+' | grep -oE '[0-9]+') echo "Watching run: https://github.com/$REPO/actions/runs/$RUN_ID" gh run watch "$RUN_ID" --repo "$REPO" --interval 30 --exit-status From ba19c25a7eed03681ac978518bacc65e082e1d17 Mon Sep 17 00:00:00 2001 From: Matus Kasak Date: Tue, 17 Mar 2026 17:06:31 +0100 Subject: [PATCH 7/7] Uncommented playwright and deploy - not testing --- .github/workflows/deploy.yml | 67 ++++++++++++++++++------------------ 1 file changed, 33 insertions(+), 34 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index af793b94b81..4d45431f9a7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -80,33 +80,33 @@ jobs: steps: - uses: actions/checkout@v4 - # - uses: ./.github/actions/erase-db - # if: inputs.ERASE_DB - # with: - # INSTANCE: ${{ env.INSTANCE }} - # NAME: dspace-${{ env.INSTANCE }} - - # - name: deploy dspace-import on dev-5 - # working-directory: build-scripts/run/ - # run: | - # ./start.sh dspace-$INSTANCE - # cd ../.. - # # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above - # # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull - # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build - - # # this must be here and not in the start.sh, because extra.yml replaces dspace container - # ## !!!!! please remove this section if you do not want handle server !!!!!!! - # echo "=====" - # echo "installing handle server" - # docker exec dspace${INSTANCE} /dspace/bin/make-handle-config - # echo "made handle config:" - # docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct - # docker exec dspace${INSTANCE} /dspace/bin/start-handle-server - # echo "started handle server" - # # this seems to be the easiest solution for now - # docker restart dockerized-nginx-with-shibboleth-nginx-1 - # /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' + - uses: ./.github/actions/erase-db + if: inputs.ERASE_DB + with: + INSTANCE: ${{ env.INSTANCE }} + NAME: dspace-${{ env.INSTANCE }} + + - name: deploy dspace-import on dev-5 + working-directory: build-scripts/run/ + run: | + ./start.sh dspace-$INSTANCE + cd ../.. + # this is not necessary, since extra.yml doesn't contain any new images that weren't pulled within script above + # docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml pull + docker compose --env-file $ENVFILE -p dspace-$INSTANCE -f docker/docker-compose.yml -f docker/docker-compose-rest.yml -f /opt/dspace-envs/8/extra.yml up -d --no-build + + # this must be here and not in the start.sh, because extra.yml replaces dspace container + ## !!!!! please remove this section if you do not want handle server !!!!!!! + echo "=====" + echo "installing handle server" + docker exec dspace${INSTANCE} /dspace/bin/make-handle-config + echo "made handle config:" + docker exec dspace${INSTANCE} cat /dspace/handle-server/config.dct + docker exec dspace${INSTANCE} /dspace/bin/start-handle-server + echo "started handle server" + # this seems to be the easiest solution for now + docker restart dockerized-nginx-with-shibboleth-nginx-1 + /bin/bash -c 'while [[ "$(curl -s -o /dev/null -w ''%{http_code}'' http://dev-5.pc:8$INSTANCE/repository/server/api)" != "200" ]]; do sleep 5; done' import-5: @@ -193,16 +193,15 @@ jobs: echo "dspace healthcheck:" docker exec $DNAME /bin/bash -c "cd /dspace/bin && ./dspace healthcheck -v" - # playwright-after-deploy8: - # needs: deploy-8 - # if: '!inputs.IMPORT' - # uses: ./.github/workflows/playwright-tests.yml - # secrets: inherit + playwright-after-deploy8: + needs: deploy-8 + if: '!inputs.IMPORT' + uses: ./.github/workflows/playwright-tests.yml + secrets: inherit rest-tests-after-deploy8: runs-on: ubuntu-latest - # needs: playwright-after-deploy8 - needs: deploy-8 + needs: playwright-after-deploy8 if: '!inputs.IMPORT' timeout-minutes: 120 env: