Skip to content

Replace elastic/infra GitHub API check with public GCS branches endpoint#6698

Merged
v1v merged 4 commits intomainfrom
copilot/update-check-if-file-exist
Apr 12, 2026
Merged

Replace elastic/infra GitHub API check with public GCS branches endpoint#6698
v1v merged 4 commits intomainfrom
copilot/update-check-if-file-exist

Conversation

Copy link
Copy Markdown
Contributor

Copilot AI commented Mar 30, 2026

The DRA pipeline was checking branch availability by querying the private elastic/infra GitHub repo via the GitHub API, requiring a GITHUB_REPO_TOKEN. This should instead use the public endpoint https://storage.googleapis.com/artifacts-api/snapshots/branches.json.

Changes

  • .buildkite/hooks/pre-command
    • Removed GITHUB_REPO_TOKEN dependency
    • Replaced check_if_file_exist_in_repo() (GitHub API + file path lookup) with check_if_branch_available() (public GCS JSON endpoint)
    • Uses jq any(. == $branch) for exact branch name matching — avoids false positives from substring matches
    • Updated call site to match new single-argument signature
# Before: queried private elastic/infra repo via GitHub API
check_if_file_exist_in_repo() {
    local path_to_file="cd/release/release-manager/project-configs/${branchName}/build.gradle"
    local response=$(curl --fail -s -H "Authorization: token $GITHUB_REPO_TOKEN" \
        https://api.github.com/repos/elastic/${repoName}/contents/${path_to_file} | ...)
}

# After: queries public GCS endpoint
check_if_branch_available() {
    local url="https://storage.googleapis.com/artifacts-api/snapshots/branches.json"
    local response=$(curl --fail -s "${url}")
    if echo "${response}" | jq -e --arg branch "${branch}" 'any(. == $branch)' > /dev/null 2>&1; then
        ...
    fi
}

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • https://storage.googleapis.com/artifacts-api/snapshots/branches.json
    • Triggering command: /usr/bin/curl curl -s REDACTED (http block)

If you need me to access, download, or install something from one of these locations, you can either:

Copilot AI changed the title [WIP] Update implementation to check branch availability Replace elastic/infra GitHub API check with public GCS branches endpoint Mar 30, 2026
Copilot finished work on behalf of v1v March 30, 2026 17:43
Copilot AI requested a review from v1v March 30, 2026 17:43
@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Mar 30, 2026

This pull request does not have a backport label. Could you fix it @Copilot? 🙏
To fixup this pull request, you need to add the backport labels for the needed
branches, such as:

  • backport-./d./d is the label to automatically backport to the 8./d branch. /d is the digit
  • backport-active-all is the label that automatically backports to all active branches.
  • backport-active-8 is the label that automatically backports to all active minor branches for the 8 major.
  • backport-active-9 is the label that automatically backports to all active minor branches for the 9 major.

Comment thread .buildkite/hooks/pre-command Outdated
Comment thread .buildkite/hooks/pre-command
Comment thread .buildkite/hooks/pre-command
@v1v v1v marked this pull request as ready for review March 30, 2026 17:53
@v1v v1v requested a review from a team as a code owner March 30, 2026 17:53
@v1v
Copy link
Copy Markdown
Member

v1v commented Mar 30, 2026

buildkite test

@v1v
Copy link
Copy Markdown
Member

v1v commented Mar 31, 2026

/test

@v1v v1v enabled auto-merge (squash) April 12, 2026 13:26
@v1v v1v merged commit 20b13a6 into main Apr 12, 2026
11 checks passed
@v1v v1v deleted the copilot/update-check-if-file-exist branch April 12, 2026 13:26
@v1v v1v added the backport-active-all Automated backport with mergify to all the active branches label Apr 12, 2026
@github-actions
Copy link
Copy Markdown
Contributor

@Mergifyio backport 8.19 9.3 9.4

@mergify
Copy link
Copy Markdown
Contributor

mergify bot commented Apr 12, 2026

backport 8.19 9.3 9.4

❌ No backport have been created

Details

Unable to add assignees to the duplicate PR: Not Found

mergify bot pushed a commit that referenced this pull request Apr 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

backport-active-all Automated backport with mergify to all the active branches

Projects

None yet

Development

Successfully merging this pull request may close these issues.

DRA pipeline step accessed the elastic/infra to know if a given branch is available

3 participants