refactor: replace AWS SDK with a REST client for CodeCommit migration (#39330)

Replace `aws-sdk-go-v2` in the CodeCommit migration with a minimal REST
client for the four read-only API calls it uses. Binary shrinks by ~3.1
MB.

Mock data was recorded against live from a AWS CodeCommit repo and then
anonymized.

Also stop storing the repo description as the default branch which fixes
below issue. All comments in
https://github.com/go-gitea/gitea/issues/34627 are addressed, the merge
metadata was fixed earlier in
https://github.com/go-gitea/gitea/pull/34645.

Fixes: https://github.com/go-gitea/gitea/issues/34627
This commit is contained in:
silverwind
2026-09-17 09:58:05 +00:00
committed by GitHub
parent e77d3bffae
commit afb7edef07
11 changed files with 244 additions and 143 deletions
@@ -0,0 +1,4 @@
Content-Length: 577
Content-Type: application/x-amz-json-1.1
{"commentsForPullRequestData":[{"afterCommitId":"43bddef3095d527c6d95d89d0ce992e2e79eeb76","beforeCommitId":"73bb36ac7a26a4d595f5b0bb892aeaa85a078ee7","comments":[{"authorArn":"arn:aws:iam::123456789012:user/gitea-codecommit","callerReactions":[],"clientRequestToken":"00000000-0000-0000-0000-000000000000","commentId":"00000000-0000-0000-0000-000000000000:00000000-0000-0000-0000-000000000000","content":"Test comment","creationDate":1.789574710911E9,"deleted":false,"lastModifiedDate":1.789574710911E9,"reactionCounts":{}}],"pullRequestId":"4","repositoryName":"test_repo"}]}
@@ -0,0 +1,4 @@
Content-Length: 928
Content-Type: application/x-amz-json-1.1
{"pullRequest":{"approvalRules":[],"authorArn":"arn:aws:iam::123456789012:user/gitea-codecommit","clientRequestToken":"00000000-0000-0000-0000-000000000000","creationDate":1.789574708027E9,"description":"Test pull request description","lastActivityDate":1.789574713962E9,"pullRequestId":"4","pullRequestStatus":"CLOSED","pullRequestTargets":[{"destinationCommit":"73bb36ac7a26a4d595f5b0bb892aeaa85a078ee7","destinationReference":"refs/heads/main","mergeBase":"73bb36ac7a26a4d595f5b0bb892aeaa85a078ee7","mergeMetadata":{"isMerged":true,"mergeCommitId":"43bddef3095d527c6d95d89d0ce992e2e79eeb76","mergeOption":"FAST_FORWARD_MERGE","mergedBy":"arn:aws:iam::123456789012:user/gitea-codecommit"},"repositoryName":"test_repo","sourceCommit":"43bddef3095d527c6d95d89d0ce992e2e79eeb76","sourceReference":"refs/heads/feature"}],"revisionId":"0000000000000000000000000000000000000000000000000000000000000000","title":"Test pull request"}}
@@ -0,0 +1,4 @@
Content-Length: 600
Content-Type: application/x-amz-json-1.1
{"repositoryMetadata":{"Arn":"arn:aws:codecommit:us-east-1:123456789012:test_repo","accountId":"123456789012","cloneUrlHttp":"https://git-codecommit.us-east-1.amazonaws.com/v1/repos/test_repo","cloneUrlSsh":"ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/test_repo","creationDate":1.789574698542E9,"defaultBranch":"main","kmsKeyId":"arn:aws:kms:us-east-1:123456789012:key/00000000-0000-0000-0000-000000000000","lastModifiedDate":1.789574713936E9,"repositoryDescription":"Test repository for Gitea migrations","repositoryId":"00000000-0000-0000-0000-000000000000","repositoryName":"test_repo"}}
@@ -0,0 +1,4 @@
Content-Length: 24
Content-Type: application/x-amz-json-1.1
{"pullRequestIds":["4"]}