Skip to content
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

chore: Improves Update Atlas SDK cache issues #1922

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/update-sdk.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ jobs:
- uses: actions/setup-go@0c52d547c9bc32b1aa3301fd7a9cb496313a4491
with:
go-version-file: 'go.mod'
- name: Trigger Go proxy cache refresh
run: |
LATEST_SDK_TAG=$(curl -sSfL https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')
LATEST_SDK_RELEASE=$(echo "${LATEST_SDK_TAG}" | cut -d '.' -f 1)
echo "tag: ${LATEST_SDK_TAG}, release: ${LATEST_SDK_RELEASE}"
curl -sSfL "https://proxy.golang.org/go.mongodb.org/atlas-sdk/${LATEST_SDK_RELEASE}/@v/${LATEST_SDK_TAG}.info"
- name: Update files
run: make tools update-atlas-sdk
- name: Verify Changed files
Expand All @@ -29,3 +35,4 @@ jobs:
delete-branch: true
branch: atlas-sdk-update
body: Automatic update for MongoDB Atlas Go Client SDK

14 changes: 10 additions & 4 deletions scripts/update-sdk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -16,10 +16,16 @@

set -euo pipefail

LATEST_SDK_TAG=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')

LATEST_SDK_TAG=$(curl -sSfL https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')
LATEST_SDK_RELEASE=$(echo "${LATEST_SDK_TAG}" | cut -d '.' -f 1)
echo "==> Updating SDK to latest major version ${LATEST_SDK_TAG}"

Copy link
Collaborator

@andreaangiolillo andreaangiolillo Feb 7, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you clarify what was the issue and how the improvement should help with? Thanks!

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

as an example a new Atlas Go SDK version was released this morning, but it took many hours until the script was successful because Go caches. We want to try to avoid/minimize that delay

echo "==> Updating SDK to latest major version tag: ${LATEST_SDK_TAG}, release: ${LATEST_SDK_RELEASE}"

echo "Refreshing cache"
curl "https://proxy.golang.org/go.mongodb.org/atlas-sdk/${LATEST_SDK_RELEASE}/@v/${LATEST_SDK_TAG}.info"
echo

gomajor get "go.mongodb.org/atlas-sdk/${LATEST_SDK_RELEASE}@${LATEST_SDK_TAG}"
go mod tidy
echo "Done"

echo "Done"
Loading