forked from IQSS/dataverse
-
Notifications
You must be signed in to change notification settings - Fork 3
12367 GitHub actions workflow for jenkins redundancy #90
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
srmanda-cs
merged 36 commits into
develop
from
12367-github-actions-workflow-for-jenkins-redundancy
May 26, 2026
+293
−2
Merged
Changes from all commits
Commits
Show all changes
36 commits
Select commit
Hold shift + click to select a range
5d431b9
feat(api/SearchIT.java): make search more precise and disable failing…
srmanda-cs 216bcb7
feat(.github/workflows/container_integration_test.yml): add container…
srmanda-cs 0a812ab
Potential fix for pull request finding
srmanda-cs ac837ee
Modify integration test workflow configuration
srmanda-cs 370902a
Update paths-ignore to exclude .txt files
srmanda-cs 1ee940a
Disable unreliable testRetrieveMyDataCollections
srmanda-cs b64e634
Update container integration tests workflow
srmanda-cs 2484285
Update SUSHI config file handling in workflow
srmanda-cs ce34be7
Enhance curl command with error handling
srmanda-cs 08ecbf0
Update jacoco path in integration tests workflow
srmanda-cs 4328a10
Update SUSHI config file retrieval method
srmanda-cs 6754e95
Include master branch in CI workflow triggers
srmanda-cs e281160
Refactor SUSHI config file injection method
srmanda-cs 5fa56ec
Add file existence check before docker cp
srmanda-cs e8b0fd2
Refactor file injection method for integration tests
srmanda-cs 70f7b99
feat(.github/workflows/container_integration_test.yml): test jacoco fix
srmanda-cs b87af01
feat(.github/workflows/container_integration_test.yml): fix sloppy ex…
srmanda-cs c387517
feat(.github/workflows/container_integration_test.yml): enable DVAPIK…
srmanda-cs 978d32d
feat(.github/workflows/container_integration_test.yml): failsafe for …
srmanda-cs 82b8d67
feat(.github/workflows/container_integration_test.yml): just another …
srmanda-cs f14954d
Configure JaCoCo agent in docker-compose for testing
srmanda-cs 275d8f3
Enhance JaCoCo integration in CI workflow
srmanda-cs fb190b0
Reduce timeout and clean up workflow comments
srmanda-cs 2bb134b
Reorder stopping Dataverse stack in workflow
srmanda-cs 9db609b
Update JaCoCo agent configuration in docker-compose
srmanda-cs ebda709
Update environment variable and JaCoCo execution process
srmanda-cs e7a2e70
feat(.github/workflows/container_integration_test.yml): remove jacoco…
srmanda-cs 37ff518
feat(.github/workflows/container_integration_test.yml): full revert w…
srmanda-cs befd61d
feat(.github/workflows/container_integration_test.yml): revert commit
srmanda-cs 9bc351e
feat(.github/workflows/container_integration_test.yml): speed up buil…
srmanda-cs 11e9d6c
feat(.github/workflows/container_integration_test.yml): reduce timeout
srmanda-cs 1bf2a61
feat(.github/workflows/container_integration_test.yml): remove unnece…
srmanda-cs 1c3d286
feat(.github/workflows/container_integration_test.yml): bump upload a…
srmanda-cs e9c52db
feat(.github/workflows/container_integration_test.yml): pass cors as …
srmanda-cs b9dfa50
feat(.github/workflows/container_integration_test.yml): CorsIT fix
srmanda-cs 51aecf7
feat(.github/workflows/container_integration_test.yml): switch env to…
srmanda-cs File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,285 @@ | ||
| name: Container Integration Tests Workflow | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - develop | ||
| - master | ||
| paths-ignore: | ||
| - "doc/**" | ||
| - "**/*.md" | ||
| - ".github/ISSUE_TEMPLATE/**" | ||
| - ".github/*.md" | ||
| pull_request: | ||
| branches: | ||
| - develop | ||
| - master | ||
| paths-ignore: | ||
| - "doc/**" | ||
| - "**/*.md" | ||
| - ".github/ISSUE_TEMPLATE/**" | ||
| - ".github/*.md" | ||
|
|
||
| concurrency: | ||
| group: "container-integration-tests-${{ github.ref }}" | ||
| cancel-in-progress: true | ||
|
|
||
| jobs: | ||
| main-integration-tests-workflow: | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 60 | ||
|
|
||
| defaults: | ||
| run: | ||
| shell: bash | ||
|
|
||
| permissions: | ||
| contents: read | ||
| checks: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
|
|
||
| # --------------------------- | ||
| # CHECKOUT | ||
| # --------------------------- | ||
| - name: Checkout repository | ||
| uses: actions/checkout@v6 | ||
|
|
||
| # --------------------------- | ||
| # VERIFY DOCKER | ||
| # --------------------------- | ||
| - name: Verify Docker | ||
| run: | | ||
| set -euo pipefail | ||
| docker version | ||
|
|
||
| # --------------------------- | ||
| # SETUP JAVA + MAVEN | ||
| # --------------------------- | ||
| - name: Setup Java | ||
| uses: actions/setup-java@v5 | ||
| with: | ||
| distribution: "temurin" | ||
| java-version: "21" | ||
| cache: "maven" | ||
|
|
||
| - name: Verify Maven | ||
| run: | | ||
| set -euo pipefail | ||
| mvn -version | ||
|
|
||
| # --------------------------- | ||
| # BUILD IMAGES (Dataverse-native) | ||
| # --------------------------- | ||
| - name: Build Dataverse containers via Maven | ||
| run: | | ||
| set -euo pipefail | ||
| mvn -Pct -T 1C package | ||
|
|
||
| # --------------------------- | ||
| # START CONTAINERS (BACKGROUND) | ||
| # --------------------------- | ||
| - name: Start Dataverse stack | ||
| run: | | ||
| set -euo pipefail | ||
| mvn -Pct docker:start \ | ||
| -Ddataverse.feature.index-harvested-metadata-source=true \ | ||
| -Ddataverse.oai.server.maxidentifiers=2 \ | ||
| -Ddataverse.oai.server.maxrecords=2 | ||
|
|
||
| # --------------------------- | ||
| # WAIT FOR API READINESS | ||
| # --------------------------- | ||
| - name: Wait for Dataverse API readiness | ||
| run: | | ||
| set -euo pipefail | ||
| URL="http://localhost:8080/api/info/version" | ||
| MAX_ATTEMPTS=10 | ||
| SLEEP_TIME=15 | ||
| echo "Waiting for Dataverse readiness..." | ||
| for attempt in $(seq 1 $MAX_ATTEMPTS); do | ||
| echo "Attempt $attempt..." | ||
| RESPONSE=$(curl -s --max-time 15 "$URL" || true) | ||
| STATUS=$(echo "$RESPONSE" | jq -r '.status' 2>/dev/null || echo "NOT_READY") | ||
| if [ "$STATUS" = "OK" ]; then | ||
| echo "Dataverse endpoint is READY." | ||
| echo "Dataverse waiting for full readiness. Waiting 30 more seconds." | ||
| sleep 30 | ||
| echo "Response: $RESPONSE" | ||
| exit 0 | ||
| fi | ||
| echo "Not ready. Sleeping ${SLEEP_TIME}s..." | ||
| sleep $SLEEP_TIME | ||
| if [ $SLEEP_TIME -lt 60 ]; then | ||
| SLEEP_TIME=$((SLEEP_TIME * 2)) | ||
| if [ $SLEEP_TIME -gt 60 ]; then | ||
| SLEEP_TIME=60 | ||
| fi | ||
| fi | ||
| done | ||
| echo "Dataverse failed to become ready." | ||
| docker ps | ||
| CONTAINERS="$(docker ps -aq)" | ||
| if [ -n "$CONTAINERS" ]; then | ||
| for cid in $CONTAINERS; do | ||
| echo "===== Logs for container $cid =====" | ||
| docker logs "$cid" || true | ||
| done | ||
| else | ||
| echo "No running containers to show logs for." | ||
| fi | ||
| exit 1 | ||
|
|
||
| # --------------------------- | ||
| # MAP LOCALSTACK TO LOCALHOST | ||
| # --------------------------- | ||
| - name: Map localstack to localhost for Maven tests | ||
| run: echo "127.0.0.1 localstack" | sudo tee -a /etc/hosts | ||
|
|
||
| # --------------------------- | ||
| # CONFIGURE DATAVERSE FOR TESTS | ||
| # --------------------------- | ||
| - name: Configure Dataverse API Settings | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| echo "Setting API Database Settings via internal container curl..." | ||
|
|
||
| # We define the settings in an array | ||
| declare -A settings=( | ||
| [":BuiltinUsersKey"]="burrito" | ||
| [":ProvCollectionEnabled"]="true" | ||
| [":AllowApiTokenLookupViaApi"]="true" | ||
| [":AllowSignUp"]="true" | ||
| ) | ||
| # We run curl INSIDE the container so the source IP is 127.0.0.1 | ||
| for key in "${!settings[@]}"; do | ||
| echo "Setting $key..." | ||
| docker exec dev_dataverse curl --fail-with-body -sS -X PUT -d "${settings[$key]}" "http://localhost:8080/api/admin/settings/$key" | ||
| echo "" | ||
| done | ||
|
|
||
| # --------------------------- | ||
| # PRE-TEST INJECTIONS | ||
| # --------------------------- | ||
| - name: Put SUSHI config file in place | ||
| run: | | ||
| set -euo pipefail | ||
|
|
||
| SOURCE_FILE="${{ github.workspace }}/src/test/java/edu/harvard/iq/dataverse/makedatacount/sushi_sample_logs.json" | ||
|
|
||
| echo "Injecting local file into container..." | ||
| # This reads the local file and writes it inside the container using standard input | ||
| docker exec -i dev_dataverse sh -c "cat > /tmp/sushi_sample_logs.json" < "$SOURCE_FILE" | ||
|
|
||
| # Verify the content is actually there and has size | ||
| docker exec dev_dataverse ls -l /tmp/sushi_sample_logs.json | ||
| docker exec dev_dataverse head -n 5 /tmp/sushi_sample_logs.json | ||
|
|
||
| # --------------------------- | ||
| # RUN MAVEN INTEGRATION TESTS | ||
| # --------------------------- | ||
| - name: Run Maven Integration Tests | ||
| env: | ||
| DVAPIKEY: "burrito" | ||
| DV_APIKEY: "burrito" | ||
| DV_API_KEY: "burrito" | ||
| run: | | ||
| set -euo pipefail | ||
| TEST_SUITE=$(cat tests/integration-tests.txt) | ||
|
|
||
| echo "Running suite: $TEST_SUITE" | ||
|
|
||
| mvn test \ | ||
| -Dtest="$TEST_SUITE" \ | ||
| -Dmaven.test.failure.ignore=true \ | ||
| -Ddataverse.test.baseurl=http://localhost:8080 \ | ||
| -DcompilerArgument=-Xlint:unchecked | ||
|
|
||
| # --------------------------- | ||
| # UPLOAD SUREFIRE/FAILSAFE REPORTS | ||
| # --------------------------- | ||
| - name: Upload Test Failure Reports | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: maven-test-reports | ||
| path: | | ||
| target/surefire-reports/ | ||
| target/failsafe-reports/ | ||
| retention-days: 14 | ||
|
|
||
| # --------------------------- | ||
| # PUBLISH TEST DASHBOARD IN GITHUB PR | ||
| # --------------------------- | ||
| - name: Publish Test Results Dashboard | ||
| uses: EnricoMi/publish-unit-test-result-action@v2 | ||
| if: always() | ||
| with: | ||
| files: | | ||
| target/failsafe-reports/TEST-*.xml | ||
| target/surefire-reports/TEST-*.xml | ||
|
|
||
| # --------------------------- | ||
| # FAIL WORKFLOW IF TESTS FAILED | ||
| # --------------------------- | ||
| - name: Check for Test Failures | ||
| if: always() | ||
| run: | | ||
| echo "Checking Surefire/Failsafe reports for failures..." | ||
| if grep -q "<failure" target/surefire-reports/*.xml target/failsafe-reports/*.xml 2>/dev/null; then | ||
| echo "Tests failed! Failing the workflow." | ||
| exit 1 | ||
| fi | ||
| echo "All tests passed." | ||
|
|
||
| # --------------------------- | ||
| # COLLECT DOCKER LOGS (ALWAYS, WITH MAPPING) | ||
| # --------------------------- | ||
| - name: Collect Docker logs (mapped) | ||
| if: always() | ||
| run: | | ||
| mkdir -p docker-logs | ||
| echo "Gathering container metadata..." | ||
| docker ps -a --format '{{.Names}}|{{.Image}}|{{.Status}}' > docker-logs/container-summary.txt | ||
| while IFS='|' read -r name image status; do | ||
| # Create a readable label | ||
| label="$name" | ||
| case "$name" in | ||
| *dataverse*) | ||
| label="dataverse-app" | ||
| ;; | ||
| *postgres*) | ||
| label="postgres-db" | ||
| ;; | ||
| *solr*) | ||
| label="solr-index" | ||
| ;; | ||
| *localstack*) | ||
| label="localstack-s3" | ||
| ;; | ||
| esac | ||
| echo "Collecting logs for $name ($label)" | ||
| { | ||
| echo "===== CONTAINER: $name =====" | ||
| echo "Label: $label" | ||
| echo "Image: $image" | ||
| echo "Status: $status" | ||
| echo "" | ||
| echo "===== LOGS =====" | ||
| docker logs --timestamps "$name" 2>&1 || true | ||
| } > "docker-logs/${label}__${name}.log" | ||
| done < docker-logs/container-summary.txt | ||
|
|
||
| # --------------------------- | ||
| # UPLOAD DOCKER LOGS (ALWAYS) | ||
| # --------------------------- | ||
| - name: Upload Docker logs | ||
| if: always() | ||
| uses: actions/upload-artifact@v7 | ||
| with: | ||
| name: docker-logs | ||
| path: docker-logs/ | ||
| retention-days: 14 | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The PR title suggests this change is primarily about adding a GitHub Actions workflow for CI redundancy, but the diff also includes multiple functional/API/UI changes (template update APIs, role assignment JSON output, file citation endpoint, file label/original filename handling, publish/submit file checks, etc.). Please update the PR title/description to reflect the full scope or split into smaller PRs to make review and risk assessment manageable.