From a55d36de0610cc3f9750c0d7066c226b8fed50cc Mon Sep 17 00:00:00 2001 From: Federico Stagni Date: Thu, 11 Jul 2024 12:52:53 +0200 Subject: [PATCH] test: for the PilotWrapper tests use the artifacts --- .github/workflows/pilotWrapper.yml | 27 ++++++++++++++++++- .../Test_GenerateAndExecutePilotWrapper.py | 4 +-- 2 files changed, 28 insertions(+), 3 deletions(-) diff --git a/.github/workflows/pilotWrapper.yml b/.github/workflows/pilotWrapper.yml index eb0840af82d..3c7bc9fe9de 100644 --- a/.github/workflows/pilotWrapper.yml +++ b/.github/workflows/pilotWrapper.yml @@ -37,4 +37,29 @@ jobs: run: | cp tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py . eval "$(conda shell.bash hook)" && conda activate python_${{ matrix.python }} - python Test_GenerateAndExecutePilotWrapper.py file://${{ github.workspace }}/src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py ${{ matrix.pilot_branch }} + # use github APIs to get the artifacts URLS from https://github.com/DIRACGrid/Pilot/, for those named Pilot_${{ matrix.pilot_branch }} + url=$(curl -s https://api.github.com/repos/DIRACGrid/Pilot/actions/artifacts | jq -r '.artifacts[] | select(.name == "Pilot_${{ matrix.pilot_branch }}") | .archive_download_url') + echo $url + + # download and unzip the url above + curl -L \ + -H "Accept: application/vnd.github+json" \ + -H "Authorization: Bearer ${{ secrets.GITHUB_TOKEN }}" \ + -H "X-GitHub-Api-Version: 2022-11-28" \ + $url --output Pilot_${{ matrix.pilot_branch }}.zip + + file_type=$(file --mime-type -b Pilot_${{ matrix.pilot_branch }}.zip) + + if [ "$file_type" != "application/zip" ]; then + echo "The downloaded file is not a ZIP file. File type: $file_type" + exit 1 + fi + + + mkdir -p ${{ matrix.pilot_branch }}/pilot + cp Pilot_${{ matrix.pilot_branch }}.zip ${{ matrix.pilot_branch }}/pilot + cd ${{ matrix.pilot_branch }}/pilot + unzip Pilot_${{ matrix.pilot_branch }}.zip + cd ../.. + + python Test_GenerateAndExecutePilotWrapper.py file://${{ github.workspace }}/src/DIRAC/WorkloadManagementSystem/Utilities/PilotWrapper.py file://${{ github.workspace }}/${{ matrix.pilot_branch }} diff --git a/tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py b/tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py index 653d5ad6d48..7c93b06d458 100644 --- a/tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py +++ b/tests/Integration/WorkloadManagementSystem/Test_GenerateAndExecutePilotWrapper.py @@ -39,7 +39,7 @@ rf = url_library_urlopen(sys.argv[1], context=context) else: rf = url_library_urlopen(sys.argv[1]) -pilotBranch = sys.argv[2] +locc = sys.argv[2] with open("PilotWrapper.py", "wb") as pj: pj.write(rf.read()) @@ -52,7 +52,7 @@ res = pilotWrapperScript( pilotOptions="--setup=CI -N ce.dirac.org -Q DIRACQUEUE -n DIRAC.CI.ORG --debug", - location="diracproject.web.cern.ch/diracproject/tars/Pilot/DIRAC/" + pilotBranch + "/,wrong.cern.ch", + location=locc + "/,wrong.cern.ch", ) with open("pilot-wrapper.sh", "wb") as pj: