-
Notifications
You must be signed in to change notification settings - Fork 76
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
CLOUDP-240677 Update SDK update process to handle minor versions and create jiras #2825
Merged
Merged
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
e35f9b4
CLOUDP-240677 Update SDK update process to handle minor versions and …
fmenezes 73ccdbe
add labels
fmenezes e4c07bb
fix
fmenezes c30f52a
debug
fmenezes 84dbf12
fix
fmenezes 2bc9620
fix sed
fmenezes d94aa3a
revert update-sdk.sh change
fmenezes 463b192
fix
fmenezes fbdb94c
update base branch for testing
fmenezes b53bc09
Revert "debug"
fmenezes 60aaabb
check if jira was already found
fmenezes 52b95c3
fix
fmenezes 1504691
fix
fmenezes 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 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 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 |
---|---|---|
|
@@ -3,7 +3,6 @@ on: | |
schedule: | ||
- cron: 30 8 * * TUE | ||
workflow_dispatch: | ||
|
||
jobs: | ||
update-sdk: | ||
runs-on: ubuntu-latest | ||
|
@@ -13,23 +12,94 @@ jobs: | |
- uses: actions/setup-go@v5 | ||
with: | ||
go-version-file: 'go.mod' | ||
- name: update | ||
run: | | ||
go install github.com/icholy/gomajor@latest | ||
make update-atlas-sdk | ||
- run: go install github.com/icholy/gomajor@latest | ||
- id: version | ||
run: echo "VERSION=$(curl -sSfL -X GET https://api.github.com/repos/mongodb/atlas-sdk-go/releases/latest | jq -r '.tag_name')" >> "$GITHUB_OUTPUT" | ||
- run: make update-atlas-sdk | ||
- name: Verify Changed files | ||
uses: tj-actions/verify-changed-files@1e517a7f5663673148ceb7c09c1900e5af48e7a1 | ||
id: verify-changed-files | ||
with: | ||
files: | | ||
./internal/**/* | ||
- uses: peter-evans/create-pull-request@v6 | ||
go.mod | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this is the actual change to make it work for minor and patch versions |
||
go.sum | ||
- name: Find JIRA ticket | ||
id: find | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' | ||
|
||
shell: bash | ||
env: | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | ||
run: | | ||
json_response=$(curl --request POST \ | ||
--url 'https://jira.mongodb.org/rest/api/2/search' \ | ||
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \ | ||
--header 'Accept: application/json' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"jql": "project = CLOUDP and summary ~ \"Bump Atlas GO SDK to '"${VERSION}"'\"" | ||
}') | ||
echo "Response: ${json_response}" | ||
echo "FOUND=$(echo "${json_response}" | jq -c '[.issues] | flatten | any')" >> "$GITHUB_OUTPUT" | ||
- name: Create JIRA ticket | ||
id: create | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' && steps.find.outputs.FOUND == 'false' | ||
shell: bash | ||
env: | ||
VERSION: ${{ steps.version.outputs.VERSION }} | ||
JIRA_API_TOKEN: ${{ secrets.JIRA_API_TOKEN }} | ||
JIRA_ASSIGNEE: ${{ secrets.ASSIGNEE_JIRA_TICKET }} | ||
run: | | ||
json_response=$(curl --request POST \ | ||
--url 'https://jira.mongodb.org/rest/api/2/issue' \ | ||
--header 'Authorization: Bearer '"${JIRA_API_TOKEN}" \ | ||
--header 'Accept: application/json' \ | ||
--header 'Content-Type: application/json' \ | ||
--data '{ | ||
"fields": { | ||
"project": { | ||
"id": "10984" | ||
}, | ||
"summary": "Bump Atlas GO SDK to '"${VERSION}"'", | ||
"issuetype": { | ||
"id": "12" | ||
}, | ||
"customfield_12751": [{ | ||
"id": "22223" | ||
}], | ||
"description": "Update Atlas GO SDK to '"${VERSION}"'.", | ||
"components": [ | ||
{ | ||
"id": "30450" | ||
} | ||
], | ||
"assignee": { | ||
"name": "'"${JIRA_ASSIGNEE}"'" | ||
} | ||
} | ||
}') | ||
|
||
echo "Response: ${json_response}" | ||
|
||
JIRA_TICKET_ID=$(echo "${json_response}" | jq -r '.key') | ||
|
||
echo "The following JIRA ticket has been created: ${JIRA_TICKET_ID}" | ||
echo "jira-ticket-id=${JIRA_TICKET_ID}" >> "${GITHUB_OUTPUT}" | ||
- uses: peter-evans/create-pull-request@v6 | ||
id: pr | ||
if: steps.verify-changed-files.outputs.files_changed == 'true' && steps.find.outputs.FOUND == 'false' | ||
with: | ||
title: "APIBot: Atlas GO SDK update" | ||
commit-message: "build(deps): bump go.mongodb.org/atlas-sdk" | ||
title: "${{ steps.create.outputs.jira-ticket-id }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}" | ||
commit-message: "${{ steps.create.outputs.jira-ticket-id }}: Bump Atlas GO SDK to ${{ steps.version.outputs.VERSION }}" | ||
delete-branch: true | ||
branch: atlas-sdk-update | ||
base: master | ||
branch: ${{ steps.create.outputs.jira-ticket-id }} | ||
labels: | | ||
dependencies | ||
go | ||
atlas-sdk | ||
body: | | ||
Automatic update for MongoDB Atlas Go Client SDK | ||
## Proposed changes | ||
Update MongoDB Atlas Go Client SDK to ${{ steps.version.outputs.VERSION }} | ||
_Jira ticket:_ ${{ steps.create.outputs.jira-ticket-id }} |
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.
ignoring on dependabot
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.
Actualy I'm not sure that we should do this. Do we have other job covering minor updates?
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.
this one