From 99c97c723683d81eb2704d29861b82f0107d2ea3 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 10:59:12 -0700 Subject: [PATCH 01/22] test: connection to azure devops --- .github/workflows/build.yml | 181 +++++++++++++++++++++++++++++++++++- 1 file changed, 178 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 228e4b5416c..7daf0172608 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ jobs: strategy: fail-fast: false matrix: - java-version: [ 23, 24-ea ] + java-version: [ 23, 24-ea ] steps: - uses: actions/checkout@v3 - uses: actions/setup-java@v3 @@ -37,13 +37,188 @@ jobs: - name: Build ${{ matrix.java-version }} run: mvn -B clean test - name: Package JAR - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' run: mvn -B package -DskipTests - name: Upload JAR Artifact - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' uses: actions/upload-artifact@v4 with: name: graphhopper-jar-${{ matrix.java-version }} path: web-bundle/target/*.jar retention-days: 90 + # Push to Azure DevOps + push-to-azure: + runs-on: ubuntu-22.04 + needs: build + # Run on master or test branch + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/test-azure-push' + steps: + - name: Set dry-run mode + id: config + run: | + if [ "${{ github.ref }}" = "refs/heads/master" ]; then + echo "dry_run=false" >> $GITHUB_OUTPUT + echo "Running in PRODUCTION mode - PR will be created" + else + echo "dry_run=true" >> $GITHUB_OUTPUT + echo "Running in DRY-RUN mode - No PR will be created (testing only)" + fi + + - name: Download JAR Artifact + uses: actions/download-artifact@v4 + with: + name: graphhopper-jar-23 # Use Java 23 build + path: ./artifacts + + - name: Get JAR info and set date + id: jar-info + run: | + JAR_FILE=$(ls ./artifacts/*.jar | head -n 1) + JAR_NAME=$(basename $JAR_FILE) + DATE=$(date +%Y%m%d-%H%M%S) + echo "jar_file=$JAR_FILE" >> $GITHUB_OUTPUT + echo "jar_name=$JAR_NAME" >> $GITHUB_OUTPUT + echo "date=$DATE" >> $GITHUB_OUTPUT + echo "Found JAR: $JAR_NAME" + + - name: Clone Azure DevOps repo and create branch + env: + AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} + AZURE_ORG: trihydro + AZURE_PROJECT: SDX + AZURE_REPO: graphhopper + run: | + echo "Authenticating with Azure DevOps" + + # Clone the Azure DevOps repo + git clone https://$AZURE_DEVOPS_PAT@dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO azure-repo + + if [ $? -eq 0 ]; then + echo "Successfully cloned Azure DevOps repository" + else + echo "Failed to clone repository - check your PAT and repository details" + exit 1 + fi + + cd azure-repo + + # Configure git + git config user.name "GitHub Actions Bot" + git config user.email "github-actions@users.noreply.github.com" + + # Create a new branch + BRANCH_NAME="update-graphhopper-jar-${{ steps.jar-info.outputs.date }}" + git checkout -b $BRANCH_NAME + echo "Created branch: $BRANCH_NAME" + + # Create resources directory if it doesn't exist + mkdir -p resources + echo "Resources directory ready" + + # Rename existing JAR file if it exists + if [ -f "resources/${{ steps.jar-info.outputs.jar_name }}" ]; then + OLD_NAME="resources/${{ steps.jar-info.outputs.jar_name }}-old-${{ steps.jar-info.outputs.date }}" + mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" + echo "Renamed existing JAR to: $(basename $OLD_NAME)" + else + echo " No existing JAR file found (this may be the first upload)" + fi + + # Copy new JAR file + cp ../${{ steps.jar-info.outputs.jar_file }} resources/ + echo "Copied new JAR file to resources/" + + # Show what changed + echo "" + echo "Changes to be committed:" + git status --short + + # Determine mode for commit message + if [ "${{ steps.config.outputs.dry_run }}" = "true" ]; then + MODE="DRY-RUN (test)" + else + MODE="PRODUCTION" + fi + + # Commit changes with multi-line message + git add resources/ + git commit -m "Update GraphHopper JAR from GitHub build - ${{ steps.jar-info.outputs.date }}" \ + -m "Built from commit: ${{ github.sha }}" \ + -m "Java version: 23" \ + -m "Mode: $MODE" + + echo "Changes committed" + + # Push the branch + git push origin $BRANCH_NAME + + if [ $? -eq 0 ]; then + echo "Successfully pushed branch to Azure DevOps" + else + echo "Failed to push branch" + exit 1 + fi + + # Save branch name for PR creation + echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV + + echo "" + echo "======================================" + echo "Summary:" + echo " Branch: $BRANCH_NAME" + echo " JAR: ${{ steps.jar-info.outputs.jar_name }}" + echo " Mode: $MODE" + echo "======================================" + + - name: Create Pull Request in Azure DevOps + if: steps.config.outputs.dry_run == 'false' + env: + AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} + AZURE_ORG: your-org + AZURE_PROJECT: your-project + AZURE_REPO: your-repo + run: | + echo "Creating Pull Request in Azure DevOps..." + + # Create PR using Azure DevOps REST API + PR_RESPONSE=$(curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Basic $(echo -n :$AZURE_DEVOPS_PAT | base64)" \ + -d "{ + \"sourceRefName\": \"refs/heads/${{ env.BRANCH_NAME }}\", + \"targetRefName\": \"refs/heads/main\", + \"title\": \"Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}\", + \"description\": \"Automated PR to update GraphHopper JAR file.\\n\\n**Source:** GitHub repository\\n**Commit:** ${{ github.sha }}\\n**Java Version:** 23\\n**Build Date:** ${{ steps.jar-info.outputs.date }}\\n\\nThis JAR was automatically built and uploaded by GitHub Actions.\" + }" \ + "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") + + PR_ID=$(echo $PR_RESPONSE | jq -r '.pullRequestId // empty') + + if [ -n "$PR_ID" ]; then + echo "Pull Request created successfully!" + echo " PR ID: $PR_ID" + echo " URL: https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO/pullrequest/$PR_ID" + else + echo "Failed to create Pull Request" + echo "Response:" + echo "$PR_RESPONSE" | jq . + exit 1 + fi + + - name: Dry-run summary + if: steps.config.outputs.dry_run == 'true' + run: | + echo "" + echo "======================================" + echo " DRY-RUN MODE SUMMARY" + echo "======================================" + echo "" + echo "✅ Authentication: SUCCESS" + echo "✅ Repository clone: SUCCESS" + echo "✅ Branch creation: SUCCESS (${{ env.BRANCH_NAME }})" + echo "✅ File operations: SUCCESS" + echo "✅ Git commit: SUCCESS" + echo "✅ Git push: SUCCESS" + echo "" + echo "======================================" From 258b1ffa5bc2d3df006d09c7e7b46566b78aba1f Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 11:09:11 -0700 Subject: [PATCH 02/22] test2: connection to azure devops --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7daf0172608..9d4348bf978 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -52,7 +52,7 @@ jobs: runs-on: ubuntu-22.04 needs: build # Run on master or test branch - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/test-azure-push' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' steps: - name: Set dry-run mode id: config From 103eba8bcd8916826eef45434ed3e8ffc534f426 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 14:25:20 -0700 Subject: [PATCH 03/22] remove pull request creation from pipeline --- .github/workflows/build.yml | 51 +++---------------------------------- 1 file changed, 4 insertions(+), 47 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 8f000e36c56..3616a75a72c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -68,7 +68,7 @@ jobs: - name: Download JAR Artifact uses: actions/download-artifact@v4 with: - name: graphhopper-jar-23 # Use Java 23 build + name: graphhopper-jar-25 path: ./artifacts - name: Get JAR info and set date @@ -82,7 +82,7 @@ jobs: echo "date=$DATE" >> $GITHUB_OUTPUT echo "Found JAR: $JAR_NAME" - - name: Clone Azure DevOps repo and create branch + - name: Clone Azure DevOps repo and upload JAR env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} AZURE_ORG: trihydro @@ -122,7 +122,7 @@ jobs: mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" echo "Renamed existing JAR to: $(basename $OLD_NAME)" else - echo " No existing JAR file found (this may be the first upload)" + echo " No existing JAR file found" fi # Copy new JAR file @@ -134,19 +134,11 @@ jobs: echo "Changes to be committed:" git status --short - # Determine mode for commit message - if [ "${{ steps.config.outputs.dry_run }}" = "true" ]; then - MODE="DRY-RUN (test)" - else - MODE="PRODUCTION" - fi - # Commit changes with multi-line message git add resources/ git commit -m "Update GraphHopper JAR from GitHub build - ${{ steps.jar-info.outputs.date }}" \ -m "Built from commit: ${{ github.sha }}" \ - -m "Java version: 23" \ - -m "Mode: $MODE" + -m "Java version: 25" echo "Changes committed" @@ -171,41 +163,6 @@ jobs: echo " Mode: $MODE" echo "======================================" - - name: Create Pull Request in Azure DevOps - if: steps.config.outputs.dry_run == 'false' - env: - AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} - AZURE_ORG: your-org - AZURE_PROJECT: your-project - AZURE_REPO: your-repo - run: | - echo "Creating Pull Request in Azure DevOps..." - - # Create PR using Azure DevOps REST API - PR_RESPONSE=$(curl -s -X POST \ - -H "Content-Type: application/json" \ - -H "Authorization: Basic $(echo -n :$AZURE_DEVOPS_PAT | base64)" \ - -d "{ - \"sourceRefName\": \"refs/heads/${{ env.BRANCH_NAME }}\", - \"targetRefName\": \"refs/heads/main\", - \"title\": \"Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}\", - \"description\": \"Automated PR to update GraphHopper JAR file.\\n\\n**Source:** GitHub repository\\n**Commit:** ${{ github.sha }}\\n**Java Version:** 23\\n**Build Date:** ${{ steps.jar-info.outputs.date }}\\n\\nThis JAR was automatically built and uploaded by GitHub Actions.\" - }" \ - "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") - - PR_ID=$(echo $PR_RESPONSE | jq -r '.pullRequestId // empty') - - if [ -n "$PR_ID" ]; then - echo "Pull Request created successfully!" - echo " PR ID: $PR_ID" - echo " URL: https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO/pullrequest/$PR_ID" - else - echo "Failed to create Pull Request" - echo "Response:" - echo "$PR_RESPONSE" | jq . - exit 1 - fi - - name: Dry-run summary if: steps.config.outputs.dry_run == 'true' run: | From ad5667c30e075c29a3c02d2951a0242e7e418c39 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 14:38:54 -0700 Subject: [PATCH 04/22] test devops jar file rename --- .github/workflows/build.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 3616a75a72c..05684761be8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -76,6 +76,7 @@ jobs: run: | JAR_FILE=$(ls ./artifacts/*.jar | head -n 1) JAR_NAME=$(basename $JAR_FILE) + JAR_NAME=${JAR_NAME/-SNAPSHOT/} DATE=$(date +%Y%m%d-%H%M%S) echo "jar_file=$JAR_FILE" >> $GITHUB_OUTPUT echo "jar_name=$JAR_NAME" >> $GITHUB_OUTPUT From 4a7909109822a2d08cc364f43c44fe52f9888aca Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 14:58:14 -0700 Subject: [PATCH 05/22] test2 devops jar file rename --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 05684761be8..1994b2951b5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -119,7 +119,7 @@ jobs: # Rename existing JAR file if it exists if [ -f "resources/${{ steps.jar-info.outputs.jar_name }}" ]; then - OLD_NAME="resources/${{ steps.jar-info.outputs.jar_name }}-old-${{ steps.jar-info.outputs.date }}" + OLD_NAME="resources/$(basename ${{ steps.jar-info.outputs.jar_name }} .jar)-old-${{ steps.jar-info.outputs.date }}.jar" mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" echo "Renamed existing JAR to: $(basename $OLD_NAME)" else From c342697aad559d8dc1f9011cf98ae6972935cc7c Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 15:21:27 -0700 Subject: [PATCH 06/22] readd the PR creation step --- .github/workflows/build.yml | 52 +++++++++++++++++++++++-------------- 1 file changed, 32 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1994b2951b5..85c81209659 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -130,11 +130,6 @@ jobs: cp ../${{ steps.jar-info.outputs.jar_file }} resources/ echo "Copied new JAR file to resources/" - # Show what changed - echo "" - echo "Changes to be committed:" - git status --short - # Commit changes with multi-line message git add resources/ git commit -m "Update GraphHopper JAR from GitHub build - ${{ steps.jar-info.outputs.date }}" \ @@ -164,19 +159,36 @@ jobs: echo " Mode: $MODE" echo "======================================" - - name: Dry-run summary - if: steps.config.outputs.dry_run == 'true' + - name: Create Pull Request in Azure DevOps + env: + AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} + AZURE_ORG: trihydro + AZURE_PROJECT: SDX + AZURE_REPO: graphhopper run: | - echo "" - echo "======================================" - echo " DRY-RUN MODE SUMMARY" - echo "======================================" - echo "" - echo "✅ Authentication: SUCCESS" - echo "✅ Repository clone: SUCCESS" - echo "✅ Branch creation: SUCCESS (${{ env.BRANCH_NAME }})" - echo "✅ File operations: SUCCESS" - echo "✅ Git commit: SUCCESS" - echo "✅ Git push: SUCCESS" - echo "" - echo "======================================" + echo "Creating Pull Request in Azure DevOps..." + + # Create PR using Azure DevOps REST API + PR_RESPONSE=$(curl -s -X POST \ + -H "Content-Type: application/json" \ + -H "Authorization: Basic $(echo -n :$AZURE_DEVOPS_PAT | base64)" \ + -d "{ + \"sourceRefName\": \"refs/heads/${{ env.BRANCH_NAME }}\", + \"targetRefName\": \"refs/heads/main\", + \"title\": \"Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}\", + \"description\": \"Automated PR to update GraphHopper JAR file.\\n\\n**Source:** GitHub repository\\n**Commit:** ${{ github.sha }}\\n**Java Version:** 23\\n**Build Date:** ${{ steps.jar-info.outputs.date }}\\n\\nThis JAR was automatically built and uploaded by GitHub Actions.\" + }" \ + "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") + + PR_ID=$(echo $PR_RESPONSE | jq -r '.pullRequestId // empty') + + if [ -n "$PR_ID" ]; then + echo "Pull Request created successfully!" + echo " PR ID: $PR_ID" + echo " URL: https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO/pullrequest/$PR_ID" + else + echo "Failed to create Pull Request" + echo "Response:" + echo "$PR_RESPONSE" | jq . + exit 1 + fi From cd628cf7aab7ab49dd1502d5fb9bc0caf20322f0 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 15:34:04 -0700 Subject: [PATCH 07/22] fix: test --- .github/workflows/build.yml | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 85c81209659..43d1682bf41 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -54,17 +54,6 @@ jobs: # Run on master or test branch if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' steps: - - name: Set dry-run mode - id: config - run: | - if [ "${{ github.ref }}" = "refs/heads/master" ]; then - echo "dry_run=false" >> $GITHUB_OUTPUT - echo "Running in PRODUCTION mode - PR will be created" - else - echo "dry_run=true" >> $GITHUB_OUTPUT - echo "Running in DRY-RUN mode - No PR will be created (testing only)" - fi - - name: Download JAR Artifact uses: actions/download-artifact@v4 with: @@ -159,6 +148,9 @@ jobs: echo " Mode: $MODE" echo "======================================" + - name: Install jq + run: sudo apt-get update && sudo apt-get install -y jq + - name: Create Pull Request in Azure DevOps env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} From 6dc7697e9b5a511e2002d41e53507163b55ae1e1 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 15:47:35 -0700 Subject: [PATCH 08/22] fix: test2 + error handling --- .github/workflows/build.yml | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 43d1682bf41..914e7112c1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -166,21 +166,27 @@ jobs: -H "Authorization: Basic $(echo -n :$AZURE_DEVOPS_PAT | base64)" \ -d "{ \"sourceRefName\": \"refs/heads/${{ env.BRANCH_NAME }}\", - \"targetRefName\": \"refs/heads/main\", + \"targetRefName\": \"refs/heads/master\", \"title\": \"Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}\", \"description\": \"Automated PR to update GraphHopper JAR file.\\n\\n**Source:** GitHub repository\\n**Commit:** ${{ github.sha }}\\n**Java Version:** 23\\n**Build Date:** ${{ steps.jar-info.outputs.date }}\\n\\nThis JAR was automatically built and uploaded by GitHub Actions.\" }" \ "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") - PR_ID=$(echo $PR_RESPONSE | jq -r '.pullRequestId // empty') - - if [ -n "$PR_ID" ]; then - echo "Pull Request created successfully!" - echo " PR ID: $PR_ID" - echo " URL: https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO/pullrequest/$PR_ID" + # Extract HTTP code and response body + HTTP_CODE=$(echo "$PR_RESPONSE" | grep -oP 'HTTP_CODE:\K[0-9]+') + RESPONSE_BODY=$(echo "$PR_RESPONSE" | sed 's/HTTP_CODE:[0-9]*$//') + + echo "HTTP Status Code: $HTTP_CODE" + echo "Response Body: $RESPONSE_BODY" + if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then + PR_ID=$(echo "$RESPONSE_BODY" | jq -r '.pullRequestId // empty') + if [ -n "$PR_ID" ]; then + echo "Pull Request created successfully!" + echo " PR ID: $PR_ID" + echo " URL: https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO/pullrequest/$PR_ID" + fi else - echo "Failed to create Pull Request" - echo "Response:" - echo "$PR_RESPONSE" | jq . + echo "Failed to create Pull Request (HTTP $HTTP_CODE)" + echo "$RESPONSE_BODY" | jq . 2>/dev/null || echo "$RESPONSE_BODY" exit 1 fi From 202f376cb6c4d1468019488eedddb268cef9017d Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 16:03:04 -0700 Subject: [PATCH 09/22] fix: test http/1.1 for devops pr --- .github/workflows/build.yml | 42 ++++++++++++++++++++++--------------- 1 file changed, 25 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 914e7112c1e..2255c55f74c 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -160,26 +160,34 @@ jobs: run: | echo "Creating Pull Request in Azure DevOps..." - # Create PR using Azure DevOps REST API - PR_RESPONSE=$(curl -s -X POST \ + # Encode PAT for authentication + AUTH_HEADER=$(printf ":%s" "$AZURE_DEVOPS_PAT" | base64) + + # Create PR payload + PR_PAYLOAD=$(cat <<'EOF' + { + "sourceRefName": "refs/heads/${{ env.BRANCH_NAME }}", + "targetRefName": "refs/heads/master", + "title": "Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}", + "description": "Automated PR to update GraphHopper JAR file.\n\n**Source:** GitHub repository\n**Commit:** ${{ github.sha }}\n**Java Version:** 25\n**Build Date:** ${{ steps.jar-info.outputs.date }}\n\nThis JAR was automatically built and uploaded by GitHub Actions." + } + EOF + ) + + # Make API request - force HTTP/1.1 and show verbose output + HTTP_CODE=$(curl --http1.1 -w "%{http_code}" -o /tmp/pr_response.json \ + -X POST \ -H "Content-Type: application/json" \ - -H "Authorization: Basic $(echo -n :$AZURE_DEVOPS_PAT | base64)" \ - -d "{ - \"sourceRefName\": \"refs/heads/${{ env.BRANCH_NAME }}\", - \"targetRefName\": \"refs/heads/master\", - \"title\": \"Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}\", - \"description\": \"Automated PR to update GraphHopper JAR file.\\n\\n**Source:** GitHub repository\\n**Commit:** ${{ github.sha }}\\n**Java Version:** 23\\n**Build Date:** ${{ steps.jar-info.outputs.date }}\\n\\nThis JAR was automatically built and uploaded by GitHub Actions.\" - }" \ + -H "Authorization: Basic $AUTH_HEADER" \ + -d "$PR_PAYLOAD" \ "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") - - # Extract HTTP code and response body - HTTP_CODE=$(echo "$PR_RESPONSE" | grep -oP 'HTTP_CODE:\K[0-9]+') - RESPONSE_BODY=$(echo "$PR_RESPONSE" | sed 's/HTTP_CODE:[0-9]*$//') - + echo "HTTP Status Code: $HTTP_CODE" - echo "Response Body: $RESPONSE_BODY" + echo "Response Body:" + cat /tmp/pr_response.json + if [ "$HTTP_CODE" -ge 200 ] && [ "$HTTP_CODE" -lt 300 ]; then - PR_ID=$(echo "$RESPONSE_BODY" | jq -r '.pullRequestId // empty') + PR_ID=$(jq -r '.pullRequestId // empty' /tmp/pr_response.json) if [ -n "$PR_ID" ]; then echo "Pull Request created successfully!" echo " PR ID: $PR_ID" @@ -187,6 +195,6 @@ jobs: fi else echo "Failed to create Pull Request (HTTP $HTTP_CODE)" - echo "$RESPONSE_BODY" | jq . 2>/dev/null || echo "$RESPONSE_BODY" + jq . /tmp/pr_response.json 2>/dev/null || cat /tmp/pr_response.json exit 1 fi From fee274c7d5fdf08cfb4498fead52161d04054e2c Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 6 Jan 2026 16:25:52 -0700 Subject: [PATCH 10/22] fix: test repo ID --- .github/workflows/build.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2255c55f74c..4b49df1bf35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -157,6 +157,7 @@ jobs: AZURE_ORG: trihydro AZURE_PROJECT: SDX AZURE_REPO: graphhopper + AZURE_GH_REPO_ID: ${{ secrets.AZURE_GH_REPO_ID }} run: | echo "Creating Pull Request in Azure DevOps..." @@ -180,7 +181,7 @@ jobs: -H "Content-Type: application/json" \ -H "Authorization: Basic $AUTH_HEADER" \ -d "$PR_PAYLOAD" \ - "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_REPO/pullrequests?api-version=7.0") + "https://dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_apis/git/repositories/$AZURE_GH_REPO_ID/pullrequests?api-version=7.1") echo "HTTP Status Code: $HTTP_CODE" echo "Response Body:" From 47f54725436eb142db30fd962e311eab8e11a982 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Wed, 7 Jan 2026 09:49:44 -0700 Subject: [PATCH 11/22] fix: bad request changes --- .github/workflows/build.yml | 23 ++++++++--------------- 1 file changed, 8 insertions(+), 15 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b49df1bf35..5b9854fa098 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -148,9 +148,6 @@ jobs: echo " Mode: $MODE" echo "======================================" - - name: Install jq - run: sudo apt-get update && sudo apt-get install -y jq - - name: Create Pull Request in Azure DevOps env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} @@ -162,10 +159,10 @@ jobs: echo "Creating Pull Request in Azure DevOps..." # Encode PAT for authentication - AUTH_HEADER=$(printf ":%s" "$AZURE_DEVOPS_PAT" | base64) + AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') # Create PR payload - PR_PAYLOAD=$(cat <<'EOF' + PR_PAYLOAD=$(cat </dev/null || cat /tmp/pr_response.json + cat /tmp/pr_response.json exit 1 fi From 4ef2f4c411b0f224eb529a19931fc84e3a7678c8 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Wed, 7 Jan 2026 10:22:58 -0700 Subject: [PATCH 12/22] fix: rename added file and add reviewer to PR --- .github/workflows/build.yml | 37 ++++++++++++++++++++++++++----------- 1 file changed, 26 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 5b9854fa098..a1f03374e08 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -116,8 +116,9 @@ jobs: fi # Copy new JAR file - cp ../${{ steps.jar-info.outputs.jar_file }} resources/ - echo "Copied new JAR file to resources/" + cp ../${{ steps.jar-info.outputs.jar_file }} resources/${{ steps.jar-info.outputs.jar_name }} + echo "Copied new JAR file to resources/ as ${{ steps.jar-info.outputs.jar_name }}" + # Commit changes with multi-line message git add resources/ @@ -145,7 +146,6 @@ jobs: echo "Summary:" echo " Branch: $BRANCH_NAME" echo " JAR: ${{ steps.jar-info.outputs.jar_name }}" - echo " Mode: $MODE" echo "======================================" - name: Create Pull Request in Azure DevOps @@ -153,21 +153,39 @@ jobs: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} AZURE_ORG: trihydro AZURE_PROJECT: SDX - AZURE_REPO: graphhopper AZURE_GH_REPO_ID: ${{ secrets.AZURE_GH_REPO_ID }} + REVIEWER_EMAIL: tsweckard@trihydro.com run: | echo "Creating Pull Request in Azure DevOps..." # Encode PAT for authentication AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') + # Get reviewer user ID + echo "Looking up reviewer ID for ${REVIEWER_EMAIL}..." + REVIEWER_ID=$(curl -sSL \ + -H "Authorization: Basic $AUTH_HEADER" \ + "https://vssps.dev.azure.com/${AZURE_ORG}/_apis/graph/users?api-version=7.1-preview.1" | \ + jq -r ".value[] | select(.mailAddress==\"${REVIEWER_EMAIL}\") | .originId") + + if [ -z "$REVIEWER_ID" ]; then + echo "Warning: Could not find user with email ${REVIEWER_EMAIL}" + else + echo "Found reviewer ID: $REVIEWER_ID" + fi + # Create PR payload PR_PAYLOAD=$(cat < Date: Wed, 7 Jan 2026 10:37:04 -0700 Subject: [PATCH 13/22] debug: list users for reviewers --- .github/workflows/build.yml | 34 ++++++++++++++-------------------- 1 file changed, 14 insertions(+), 20 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a1f03374e08..ba16569dc28 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -148,6 +148,18 @@ jobs: echo " JAR: ${{ steps.jar-info.outputs.jar_name }}" echo "======================================" + - name: Debug - List all users + env: + AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} + run: | + AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') + + echo "Fetching all users from Azure DevOps..." + curl -sSL \ + -H "Authorization: Basic $AUTH_HEADER" \ + "https://vssps.dev.azure.com/${AZURE_ORG}/_apis/graph/users?api-version=7.1-preview.1" | \ + jq -r '.value[] | "Name: \(.displayName) | Email: \(.mailAddress // "N/A") | ID: \(.originId)"' + - name: Create Pull Request in Azure DevOps env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} @@ -160,32 +172,14 @@ jobs: # Encode PAT for authentication AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') - - # Get reviewer user ID - echo "Looking up reviewer ID for ${REVIEWER_EMAIL}..." - REVIEWER_ID=$(curl -sSL \ - -H "Authorization: Basic $AUTH_HEADER" \ - "https://vssps.dev.azure.com/${AZURE_ORG}/_apis/graph/users?api-version=7.1-preview.1" | \ - jq -r ".value[] | select(.mailAddress==\"${REVIEWER_EMAIL}\") | .originId") - - if [ -z "$REVIEWER_ID" ]; then - echo "Warning: Could not find user with email ${REVIEWER_EMAIL}" - else - echo "Found reviewer ID: $REVIEWER_ID" - fi - + # Create PR payload PR_PAYLOAD=$(cat < Date: Wed, 7 Jan 2026 10:53:23 -0700 Subject: [PATCH 14/22] test: reviewer secret --- .github/workflows/build.yml | 21 +++++++-------------- 1 file changed, 7 insertions(+), 14 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ba16569dc28..a32a4b783db 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -148,25 +148,13 @@ jobs: echo " JAR: ${{ steps.jar-info.outputs.jar_name }}" echo "======================================" - - name: Debug - List all users - env: - AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} - run: | - AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') - - echo "Fetching all users from Azure DevOps..." - curl -sSL \ - -H "Authorization: Basic $AUTH_HEADER" \ - "https://vssps.dev.azure.com/${AZURE_ORG}/_apis/graph/users?api-version=7.1-preview.1" | \ - jq -r '.value[] | "Name: \(.displayName) | Email: \(.mailAddress // "N/A") | ID: \(.originId)"' - - name: Create Pull Request in Azure DevOps env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} AZURE_ORG: trihydro AZURE_PROJECT: SDX AZURE_GH_REPO_ID: ${{ secrets.AZURE_GH_REPO_ID }} - REVIEWER_EMAIL: tsweckard@trihydro.com + REVIEWER_ID: ${{ secrets.TEAGHEN_DEVOPS_USER_ID }} run: | echo "Creating Pull Request in Azure DevOps..." @@ -179,7 +167,12 @@ jobs: "sourceRefName": "refs/heads/${{ env.BRANCH_NAME }}", "targetRefName": "refs/heads/master", "title": "Update GraphHopper JAR - ${{ steps.jar-info.outputs.date }}", - "description": "Automated PR to update GraphHopper JAR file.\n\n**Source:** GitHub repository\n**Commit:** ${{ github.sha }}\n**Java Version:** 25\n**Build Date:** ${{ steps.jar-info.outputs.date }}\n\nThis JAR was automatically built and uploaded by GitHub Actions." + "description": "Automated PR to update GraphHopper JAR file.\n\n**Source:** GitHub repository\n**Commit:** ${{ github.sha }}\n**Java Version:** 25\n**Build Date:** ${{ steps.jar-info.outputs.date }}\n\nThis JAR was automatically built and uploaded by GitHub Actions.", + "reviewers": [ + { + "id": "${REVIEWER_ID}" + } + ] } EOF ) From 6f35e746b7fd84c995659d7cd14f1b3c5b228283 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Wed, 7 Jan 2026 11:36:24 -0700 Subject: [PATCH 15/22] test: code cleanup, abstract variables, separate large steps --- .github/workflows/build.yml | 88 +++++++++++-------------------------- 1 file changed, 26 insertions(+), 62 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a32a4b783db..74eb24225aa 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,5 +1,11 @@ name: Build and Test on: push + +env: + AZURE_ORG: trihydro + AZURE_PROJECT: SDX + AZURE_REPO: graphhopper + jobs: build: runs-on: ubuntu-latest @@ -47,11 +53,9 @@ jobs: path: web/target/*.jar retention-days: 90 - # Push to Azure DevOps push-to-azure: runs-on: ubuntu-22.04 needs: build - # Run on master or test branch if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' steps: - name: Download JAR Artifact @@ -64,35 +68,24 @@ jobs: id: jar-info run: | JAR_FILE=$(ls ./artifacts/*.jar | head -n 1) - JAR_NAME=$(basename $JAR_FILE) - JAR_NAME=${JAR_NAME/-SNAPSHOT/} + JAR_NAME=$(basename "$JAR_FILE" | sed 's/-SNAPSHOT//') DATE=$(date +%Y%m%d-%H%M%S) - echo "jar_file=$JAR_FILE" >> $GITHUB_OUTPUT - echo "jar_name=$JAR_NAME" >> $GITHUB_OUTPUT - echo "date=$DATE" >> $GITHUB_OUTPUT - echo "Found JAR: $JAR_NAME" - - name: Clone Azure DevOps repo and upload JAR + { + echo "jar_file=$JAR_FILE" + echo "jar_name=$JAR_NAME" + echo "date=$DATE" + } >> "$GITHUB_OUTPUT" + + - name: Clone Azure DevOps Repository env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} - AZURE_ORG: trihydro - AZURE_PROJECT: SDX - AZURE_REPO: graphhopper run: | - echo "Authenticating with Azure DevOps" - - # Clone the Azure DevOps repo git clone https://$AZURE_DEVOPS_PAT@dev.azure.com/$AZURE_ORG/$AZURE_PROJECT/_git/$AZURE_REPO azure-repo - - if [ $? -eq 0 ]; then - echo "Successfully cloned Azure DevOps repository" - else - echo "Failed to clone repository - check your PAT and repository details" - exit 1 - fi - - cd azure-repo - + + - name: Commit and push JAR to new branch + working-directory: azure-repo + run: | # Configure git git config user.name "GitHub Actions Bot" git config user.email "github-actions@users.noreply.github.com" @@ -100,68 +93,40 @@ jobs: # Create a new branch BRANCH_NAME="update-graphhopper-jar-${{ steps.jar-info.outputs.date }}" git checkout -b $BRANCH_NAME - echo "Created branch: $BRANCH_NAME" # Create resources directory if it doesn't exist mkdir -p resources - echo "Resources directory ready" # Rename existing JAR file if it exists if [ -f "resources/${{ steps.jar-info.outputs.jar_name }}" ]; then OLD_NAME="resources/$(basename ${{ steps.jar-info.outputs.jar_name }} .jar)-old-${{ steps.jar-info.outputs.date }}.jar" - mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" - echo "Renamed existing JAR to: $(basename $OLD_NAME)" - else - echo " No existing JAR file found" + mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME fi # Copy new JAR file cp ../${{ steps.jar-info.outputs.jar_file }} resources/${{ steps.jar-info.outputs.jar_name }} - echo "Copied new JAR file to resources/ as ${{ steps.jar-info.outputs.jar_name }}" - - # Commit changes with multi-line message + # Commit changes git add resources/ git commit -m "Update GraphHopper JAR from GitHub build - ${{ steps.jar-info.outputs.date }}" \ -m "Built from commit: ${{ github.sha }}" \ -m "Java version: 25" - echo "Changes committed" - # Push the branch git push origin $BRANCH_NAME - if [ $? -eq 0 ]; then - echo "Successfully pushed branch to Azure DevOps" - else - echo "Failed to push branch" - exit 1 - fi - # Save branch name for PR creation echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV - - echo "" - echo "======================================" - echo "Summary:" - echo " Branch: $BRANCH_NAME" - echo " JAR: ${{ steps.jar-info.outputs.jar_name }}" - echo "======================================" - name: Create Pull Request in Azure DevOps env: AZURE_DEVOPS_PAT: ${{ secrets.AZURE_DEVOPS_PAT }} - AZURE_ORG: trihydro - AZURE_PROJECT: SDX AZURE_GH_REPO_ID: ${{ secrets.AZURE_GH_REPO_ID }} - REVIEWER_ID: ${{ secrets.TEAGHEN_DEVOPS_USER_ID }} + REVIEWER_ID_TEAGHEN: ${{ secrets.TEAGHEN_DEVOPS_USER_ID }} + REVIEWER_ID_CHAN: ${{ secrets.CHAN_DEVOPS_USER_ID }} run: | - echo "Creating Pull Request in Azure DevOps..." - - # Encode PAT for authentication AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') - # Create PR payload PR_PAYLOAD=$(cat < Date: Wed, 7 Jan 2026 11:47:21 -0700 Subject: [PATCH 16/22] fix: annoying bug --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 74eb24225aa..4b1e865ccf6 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -100,7 +100,7 @@ jobs: # Rename existing JAR file if it exists if [ -f "resources/${{ steps.jar-info.outputs.jar_name }}" ]; then OLD_NAME="resources/$(basename ${{ steps.jar-info.outputs.jar_name }} .jar)-old-${{ steps.jar-info.outputs.date }}.jar" - mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME + mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" fi # Copy new JAR file From 86517a31c8ce798fb4eaf7e019d0ee4db8ce0d2c Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Wed, 7 Jan 2026 11:56:27 -0700 Subject: [PATCH 17/22] chore: remove test branch exception --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4b1e865ccf6..ad966c8000a 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,10 +43,10 @@ jobs: - name: Build ${{ matrix.java-version }} run: mvn -B clean test - name: Package JAR - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' + if: github.ref == 'refs/heads/master' run: mvn -B package -DskipTests - name: Upload JAR Artifact - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' + if: github.ref == 'refs/heads/master' uses: actions/upload-artifact@v4 with: name: graphhopper-jar-${{ matrix.java-version }} @@ -56,7 +56,7 @@ jobs: push-to-azure: runs-on: ubuntu-22.04 needs: build - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' + if: github.ref == 'refs/heads/master' steps: - name: Download JAR Artifact uses: actions/download-artifact@v4 From 21752acecd3137d5e1e1f6daaa70e77e465a3079 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Mon, 12 Jan 2026 12:44:34 -0700 Subject: [PATCH 18/22] test: comment changes --- .github/workflows/build.yml | 82 ++++++++++++++++++------------------- 1 file changed, 40 insertions(+), 42 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ad966c8000a..ae168500628 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,11 +1,6 @@ name: Build and Test on: push -env: - AZURE_ORG: trihydro - AZURE_PROJECT: SDX - AZURE_REPO: graphhopper - jobs: build: runs-on: ubuntu-latest @@ -42,32 +37,26 @@ jobs: ${{ runner.os}}-node_modules- - name: Build ${{ matrix.java-version }} run: mvn -B clean test - - name: Package JAR - if: github.ref == 'refs/heads/master' - run: mvn -B package -DskipTests - - name: Upload JAR Artifact - if: github.ref == 'refs/heads/master' - uses: actions/upload-artifact@v4 - with: - name: graphhopper-jar-${{ matrix.java-version }} - path: web/target/*.jar - retention-days: 90 push-to-azure: - runs-on: ubuntu-22.04 + runs-on: ubuntu-latest needs: build - if: github.ref == 'refs/heads/master' + if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' + env: + AZURE_ORG: trihydro + AZURE_PROJECT: SDX + AZURE_REPO: graphhopper + JAVA_VERSION: 25 steps: - - name: Download JAR Artifact - uses: actions/download-artifact@v4 - with: - name: graphhopper-jar-25 - path: ./artifacts + - uses: actions/checkout@v4 + + - name: Package JAR + run: mvn -B package -DskipTests - name: Get JAR info and set date id: jar-info run: | - JAR_FILE=$(ls ./artifacts/*.jar | head -n 1) + JAR_FILE=$(ls web/target/*.jar | head -n 1) JAR_NAME=$(basename "$JAR_FILE" | sed 's/-SNAPSHOT//') DATE=$(date +%Y%m%d-%H%M%S) @@ -86,35 +75,41 @@ jobs: - name: Commit and push JAR to new branch working-directory: azure-repo run: | + # Set variables + JAR_FILE="${{ steps.jar-info.outputs.jar_file }}" + JAR_NAME="${{ steps.jar-info.outputs.jar_name }}" + BUILD_DATE="${{ steps.jar-info.outputs.date }}" + COMMIT_SHA="${{ github.sha }}" + # Configure git git config user.name "GitHub Actions Bot" git config user.email "github-actions@users.noreply.github.com" - + # Create a new branch - BRANCH_NAME="update-graphhopper-jar-${{ steps.jar-info.outputs.date }}" + BRANCH_NAME="update-graphhopper-jar-$BUILD_DATE" git checkout -b $BRANCH_NAME - + # Create resources directory if it doesn't exist mkdir -p resources - + # Rename existing JAR file if it exists - if [ -f "resources/${{ steps.jar-info.outputs.jar_name }}" ]; then - OLD_NAME="resources/$(basename ${{ steps.jar-info.outputs.jar_name }} .jar)-old-${{ steps.jar-info.outputs.date }}.jar" - mv "resources/${{ steps.jar-info.outputs.jar_name }}" "$OLD_NAME" + if [ -f "resources/$JAR_NAME" ]; then + OLD_NAME="resources/$(basename $JAR_NAME .jar)-old-$BUILD_DATE.jar" + mv "resources/$JAR_NAME" "$OLD_NAME" fi - + # Copy new JAR file - cp ../${{ steps.jar-info.outputs.jar_file }} resources/${{ steps.jar-info.outputs.jar_name }} - + cp ../$JAR_FILE resources/$JAR_NAME + # Commit changes git add resources/ - git commit -m "Update GraphHopper JAR from GitHub build - ${{ steps.jar-info.outputs.date }}" \ - -m "Built from commit: ${{ github.sha }}" \ - -m "Java version: 25" - + git commit -m "Update GraphHopper JAR from GitHub build - $BUILD_DATE" \ + -m "Built from commit: $COMMIT_SHA" \ + -m "Java version: $JAVA_VERSION" + # Push the branch git push origin $BRANCH_NAME - + # Save branch name for PR creation echo "BRANCH_NAME=$BRANCH_NAME" >> $GITHUB_ENV @@ -125,14 +120,17 @@ jobs: REVIEWER_ID_TEAGHEN: ${{ secrets.TEAGHEN_DEVOPS_USER_ID }} REVIEWER_ID_CHAN: ${{ secrets.CHAN_DEVOPS_USER_ID }} run: | + # Set variables + BUILD_DATE="${{ steps.jar-info.outputs.date }}" + COMMIT_SHA="${{ github.sha }}" AUTH_HEADER=$(echo -n ":${AZURE_DEVOPS_PAT}" | base64 | tr -d '\n') PR_PAYLOAD=$(cat < Date: Mon, 12 Jan 2026 12:55:41 -0700 Subject: [PATCH 19/22] chore: remove test branch filter --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index ae168500628..b75f1ea6b47 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,7 +41,7 @@ jobs: push-to-azure: runs-on: ubuntu-latest needs: build - if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/us/17033-azure-gh-pipeline' + if: github.ref == 'refs/heads/master' env: AZURE_ORG: trihydro AZURE_PROJECT: SDX From 5941899766a23a114e7f9f869ca927c740bebb3a Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Tue, 13 Jan 2026 15:34:21 -0700 Subject: [PATCH 20/22] comment: build pipeline documentation --- .github/BUILD-PIPELINE.md | 148 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 148 insertions(+) create mode 100644 .github/BUILD-PIPELINE.md diff --git a/.github/BUILD-PIPELINE.md b/.github/BUILD-PIPELINE.md new file mode 100644 index 00000000000..a357f5a3595 --- /dev/null +++ b/.github/BUILD-PIPELINE.md @@ -0,0 +1,148 @@ +# GraphHopper Build Pipeline Documentation + +## Overview + +The GraphHopper build pipeline (`build.yml`) is a GitHub Actions workflow that automates building, testing, and deploying the GraphHopper routing engine to Azure DevOps. The pipeline runs on every push to the repository. + +## Pipeline Structure + +### Job 1: Build and Test +**Trigger:** Every push to any branch + +This job builds and tests the GraphHopper project across multiple Java versions to ensure compatibility. + +**Steps:** +1. **Checkout code** - Retrieves the repository code +2. **Setup Java** - Configures Java using the Temurin distribution + - Tested versions: Java 25 and Java 26-ea (early access) + - Uses a matrix strategy to test both versions in parallel +3. **Cache Maven artifacts** - Caches `~/.m2/repository` to speed up builds +4. **Cache node** - Caches `web-bundle/node` directory +5. **Cache node_modules** - Caches `web-bundle/node_modules` directory +6. **Build and Test** - Runs `mvn -B clean test` + +### Job 2: Push to Azure DevOps +**Trigger:** Only runs on successful build when pushing to the `master` branch + +This job packages the GraphHopper JAR file and pushes it to the Azure DevOps repository for deployment. + +**Configuration Variables:** +- `AZURE_ORG`: trihydro +- `AZURE_PROJECT`: SDX +- `AZURE_REPO`: graphhopper +- `JAVA_VERSION`: 25 + +**Steps:** +1. **Checkout code** - Retrieves the repository code +2. **Package JAR** - Runs `mvn -B package -DskipTests` to create the JAR file +3. **Get JAR info** - Extracts JAR filename and creates a timestamp +4. **Clone Azure DevOps Repository** - Clones the Azure repo using PAT authentication +5. **Commit and push JAR** - Creates a new branch, backs up old JAR, commits new JAR +6. **Create Pull Request** - Creates PR in Azure DevOps with designated reviewers + +## Required Secrets + +The following GitHub repository secrets must be configured for the pipeline to work: + +### `AZURE_DEVOPS_PAT` +**Type:** Personal Access Token +**Purpose:** Authenticates GitHub Actions with Azure DevOps +**Permissions Required:** +- Code: Read & Write + +**How to Update:** +1. Go to Azure DevOps → User Settings → Personal Access Tokens +2. Create a new token or regenerate existing one with the required permissions +3. Copy the token value +4. Go to GitHub repository → Settings → Secrets and variables → Actions +5. Update or create `AZURE_DEVOPS_PAT` secret with the new token value + +### `AZURE_GH_REPO_ID` +**Type:** Repository GUID +**Purpose:** Identifies the Azure DevOps repository for API calls + +**How to Find:** +1. Run command: `az repos list --organization "https://dev.azure.com/trihydro" --project "SDX" --query "[?name == 'graphhopper'].id" --output tsv` + +### `TEAGHEN_DEVOPS_USER_ID` & `CHAN_DEVOPS_USER_ID` +**Type:** User GUID +**Purpose:** Adds Teaghen and Chan as a PR reviewer automatically + +**How to Find/Update:** +1. Make API call to: https://vssps.dev.azure.com/trihydro/_apis/graph/users?api-version=7.1-preview.1 + 1. Authorization header: Basic `` + 2. Content-Type header: application/json +2. Update the GitHub secret with the originId value. + +## Maintenance Guide + +### Updating Java Versions +To test against different Java versions: +1. Edit `.github/workflows/build.yml` +2. Modify the `matrix.java-version` array (currently `[25, 26-ea]`) +3. Update the `JAVA_VERSION` environment variable in the `push-to-azure` job if changing the deployment version + +### Updating Azure DevOps Configuration +To change the target Azure DevOps organization, project, or repository: +1. Edit `.github/workflows/build.yml` +2. Update the environment variables in the `push-to-azure` job: + - `AZURE_ORG` + - `AZURE_PROJECT` + - `AZURE_REPO` + +### Adding/Removing Reviewers +To modify automatic PR reviewers: +1. Add the new reviewer user ID secrets in GitHub repository settings +2. Edit the `Create Pull Request in Azure DevOps` step in `build.yml` +3. Add/remove reviewer objects in the `reviewers` array of the PR payload + +### Monitoring Secrets Expiration +**Recommended Schedule:** +- Azure DevOps PATs typically expire after 90 days depending on configuration +- Set up calendar reminders 2 weeks before known expiration dates + +### Troubleshooting Common Issues + +**Build fails but tests pass locally:** +- Check Java version compatibility (pipeline uses Java 25/26) +- Clear Maven cache by removing the cache action temporarily + +**Azure push fails with an authentication error:** +- `AZURE_DEVOPS_PAT` has likely expired - regenerate it +- Verify the PAT has Code and Pull Request permissions + +**Pull Request creation fails:** +- Verify `AZURE_GH_REPO_ID` is correct +- Check that reviewer IDs are valid and users have access to the repository +- Ensure the target branch (master) exists in Azure DevOps repo + +## Workflow Diagram + +``` +┌─────────────────┐ +│ Push Event │ +└────────┬────────┘ + │ + ▼ +┌─────────────────────────┐ +│ Build & Test Job │ +│ - Java 25 │ +│ - Java 26-ea │ +│ - Maven clean test │ +└────────┬────────────────┘ + │ + ▼ + [master branch?] + │ Yes + ▼ +┌─────────────────────────┐ +│ Push to Azure Job │ +│ 1. Package JAR │ +│ 2. Clone Azure repo │ +│ 3. Create branch │ +│ 4. Commit JAR │ +│ 5. Push branch │ +│ 6. Create PR │ +└─────────────────────────┘ +``` + From 3bd48fbce34e0204dd02ff83c29dec6353242c6e Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard <78238654+tsweckard@users.noreply.github.com> Date: Mon, 19 Jan 2026 09:06:16 -0700 Subject: [PATCH 21/22] comment: verify JAR file exists Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.com> --- .github/workflows/build.yml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b75f1ea6b47..f9369769790 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -57,6 +57,10 @@ jobs: id: jar-info run: | JAR_FILE=$(ls web/target/*.jar | head -n 1) + if [ -z "$JAR_FILE" ] || [ ! -f "$JAR_FILE" ]; then + echo "Error: No JAR file found in web/target/. Maven package step may have failed to produce a JAR." >&2 + exit 1 + fi JAR_NAME=$(basename "$JAR_FILE" | sed 's/-SNAPSHOT//') DATE=$(date +%Y%m%d-%H%M%S) From 5e7e493ca93b3518847539c34f5f88117d1d4cb0 Mon Sep 17 00:00:00 2001 From: Teaghen Sweckard Date: Mon, 19 Jan 2026 09:20:10 -0700 Subject: [PATCH 22/22] comment: add Java to push to azure job --- .github/workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b75f1ea6b47..60f1a7939ba 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -49,6 +49,11 @@ jobs: JAVA_VERSION: 25 steps: - uses: actions/checkout@v4 + - uses: actions/setup-java@v4 + with: + java-version: ${{ env.JAVA_VERSION }} + distribution: temurin + cache: maven - name: Package JAR run: mvn -B package -DskipTests