이 문서는 AWS CLI의 버전 1에만 해당합니다. AWS CLI의 버전 2와 관련된 문서는 버전 2 사용 설명서를 참조하세요.
다음 코드 예시에서는 CodeCommit에서 AWS Command Line Interface를 사용하여 작업을 수행하고 일반적인 시나리오를 구현하는 방법을 보여줍니다.
작업은 대규모 프로그램에서 발췌한 코드이며 컨텍스트에 맞춰 실행해야 합니다. 작업은 관련 시나리오의 컨텍스트에 따라 표시되며, 개별 서비스 함수를 직접적으로 호출하는 방법을 보여줍니다.
각 예시에는 전체 소스 코드에 대한 링크가 포함되어 있으며, 여기에서 컨텍스트에 맞춰 코드를 설정하고 실행하는 방법에 대한 지침을 찾을 수 있습니다.
주제
작업
다음 코드 예시에서는 associate-approval-rule-template-with-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿을 리포지토리와 연결
다음
associate-approval-rule-template-with-repository
예시는 지정된 승인 규칙 템플릿을MyDemoRepo
리포지토리와 연결합니다.aws codecommit associate-approval-rule-template-with-repository \ --repository-name
MyDemoRepo
\ --approval-rule-template-name2-approver-rule-for-main
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Associate an Approval Rule Template with a Repository 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 AssociateApprovalRuleTemplateWithRepository
섹션을 참조하세요.
-
다음 코드 예시에서는 batch-associate-approval-rule-template-with-repositories
의 사용 방법을 보여줍니다.
- AWS CLI
-
한 번의 작업으로 승인 규칙 템플릿을 여러 리포지토리와 연결
다음
batch-associate-approval-rule-template-with-repositories
예시에서는 지정된 승인 규칙 템플릿을MyDemoRepo
및MyOtherDemoRepo
리포지토리와 연결합니다.참고: 승인 규칙 템플릿은 해당 템플릿이 생성된 AWS 리전에만 적용됩니다. 해당 AWS 리전의 리포지토리에만 연결할 수 있습니다.
aws codecommit batch-associate-approval-rule-template-with-repositories \ --repository-names
MyDemoRepo,
MyOtherDemoRepo
\ --approval-rule-template-name2-approver-rule-for-main
출력:
{ "associatedRepositoryNames": [ "MyDemoRepo", "MyOtherDemoRepo" ], "errors": [] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Associate an Approval Rule Template with a Repository 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 BatchAssociateApprovalRuleTemplateWithRepositories
섹션을 참조하세요.
-
다음 코드 예시에서는 batch-describe-merge-conflicts
의 사용 방법을 보여줍니다.
- AWS CLI
-
두 커밋 지정자 간의 병합에서 모든 파일 또는 파일 하위 세트의 병합 충돌에 대한 정보 가져오기
다음
batch-describe-merge-conflicts
예시에서는MyDemoRepo
리포지토리에서THREE_WAY_MERGE
전략을 사용하여feature-randomizationfeature
소스 브랜치를main
대상 브랜치와 병합할 때 병합 충돌을 확인합니다.aws codecommit batch-describe-merge-conflicts \ --source-commit-specifier
feature-randomizationfeature
\ --destination-commit-specifiermain
\ --merge-optionTHREE_WAY_MERGE
\ --repository-nameMyDemoRepo
출력:
{ "conflicts": [ { "conflictMetadata": { "filePath": "readme.md", "fileSizes": { "source": 139, "destination": 230, "base": 85 }, "fileModes": { "source": "NORMAL", "destination": "NORMAL", "base": "NORMAL" }, "objectTypes": { "source": "FILE", "destination": "FILE", "base": "FILE" }, "numberOfConflicts": 1, "isBinaryFile": { "source": false, "destination": false, "base": false }, "contentConflict": true, "fileModeConflict": false, "objectTypeConflict": false, "mergeOperations": { "source": "M", "destination": "M" } }, "mergeHunks": [ { "isConflict": true, "source": { "startLine": 0, "endLine": 3, "hunkContent": "VGhpcyBpEXAMPLE==" }, "destination": { "startLine": 0, "endLine": 1, "hunkContent": "VXNlIHRoEXAMPLE=" } } ] } ], "errors": [], "destinationCommitId": "86958e0aEXAMPLE", "sourceCommitId": "6ccd57fdEXAMPLE", "baseCommitId": "767b6958EXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Resolve Conflicts in a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 BatchDescribeMergeConflicts
섹션을 참조하세요.
-
다음 코드 예시에서는 batch-disassociate-approval-rule-template-from-repositories
의 사용 방법을 보여줍니다.
- AWS CLI
-
한 번의 작업으로 여러 리포지토리에서 승인 규칙 템플릿 연결 해제
다음
batch-disassociate-approval-rule-template-from-repositories
예시는 지정된 승인 규칙 템플릿을 및 이라는 이름의MyDemoRepo
및MyOtherDemoRepo
리포지토리에서 연결 해제합니다.aws codecommit batch-disassociate-approval-rule-template-from-repositories \ --repository-names
MyDemoRepo,
MyOtherDemoRepo
\ --approval-rule-template-name1-approval-rule-for-all
pull
requests
출력:
{ "disassociatedRepositoryNames": [ "MyDemoRepo", "MyOtherDemoRepo" ], "errors": [] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Disassociate an Approval Rule Template 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 BatchDisassociateApprovalRuleTemplateFromRepositories
섹션을 참조하세요.
-
다음 코드 예시에서는 batch-get-commits
의 사용 방법을 보여줍니다.
- AWS CLI
-
여러 커밋에 대한 정보 보기
다음
batch-get-commits
예제에서는 지정된 커밋에 대한 세부 정보를 표시합니다.aws codecommit batch-get-commits \ --repository-name
MyDemoRepo
\ --commit-ids317f8570EXAMPLE
4c925148EXAMPLE
출력:
{ "commits": [ { "additionalData": "", "committer": { "date": "1508280564 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "author": { "date": "1508280564 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "commitId": "317f8570EXAMPLE", "treeId": "1f330709EXAMPLE", "parents": [ "6e147360EXAMPLE" ], "message": "Change variable name and add new response element" }, { "additionalData": "", "committer": { "date": "1508280542 -0800", "name": "Li Juan", "email": "li_juan@example.com" }, "author": { "date": "1508280542 -0800", "name": "Li Juan", "email": "li_juan@example.com" }, "commitId": "4c925148EXAMPLE", "treeId": "1f330709EXAMPLE", "parents": [ "317f8570EXAMPLE" ], "message": "Added new class" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 View Commit Details 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 BatchGetCommits
섹션을 참조하세요.
-
다음 코드 예시에서는 batch-get-repositories
의 사용 방법을 보여줍니다.
- AWS CLI
-
여러 리포지토리에 대한 세부 정보 보기
이 예시에서는 여러 AWS CodeCommit 리포지토리에 대한 세부 정보를 보여줍니다.
aws codecommit batch-get-repositories \ --repository-names
MyDemoRepo
MyOtherDemoRepo
출력:
{ "repositoriesNotFound": [], "repositories": [ { "creationDate": 1429203623.625, "defaultBranch": "main", "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1430783812.0869999, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyDemoRepo" "accountId": "111111111111" }, { "creationDate": 1429203623.627, "defaultBranch": "main", "repositoryName": "MyOtherDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo", "lastModifiedDate": 1430783812.0889999, "repositoryDescription": "My other demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-2.amazonaws.com/v1/repos/MyOtherDemoRepo", "repositoryId": "cfc29ac4-b0cb-44dc-9990-f6f51EXAMPLE", "Arn": "arn:aws:codecommit:us-east-2:111111111111:MyOtherDemoRepo" "accountId": "111111111111" } ], "repositoriesNotFound": [] }
-
API 세부 정보는 AWS CLI 명령 참조의 BatchGetRepositories
섹션을 참조하세요.
-
다음 코드 예시에서는 create-approval-rule-template
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿 생성
다음
create-approval-rule-template
예시에서는 풀 요청을main
브랜치에 병합하기 전에 승인하도록 명명된 승인 규칙2-approver-rule-for-main ``. The template requires two users who assume the role of ``CodeCommitReview
템플릿을 생성합니다.aws codecommit create-approval-rule-template \ --approval-rule-template-name
2-approver-rule-for-main
\ --approval-rule-template-description"Requires two developers from the team to approve the pull request if the destination branch is main"
\ --approval-rule-template-content "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}"출력:
{ "approvalRuleTemplate": { "approvalRuleTemplateName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "approvalRuleTemplateId": "dd8b17fe-EXAMPLE", "approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "approvalRuleTemplateDescription": "Requires two developers from the team to approve the pull request if the destination branch is main", "lastModifiedDate": 1571356106.936, "ruleContentSha256": "4711b576EXAMPLE" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Create an Approval Rule Template 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateApprovalRuleTemplate
섹션을 참조하세요.
-
다음 코드 예시에서는 create-branch
의 사용 방법을 보여줍니다.
- AWS CLI
-
브랜치 생성
이 예시에서는 AWS CodeCommit 리포지토리에 브랜치를 생성합니다. 이 명령은 오류가 있는 경우에만 출력을 생성합니다.
명령:
aws codecommit create-branch --repository-name
MyDemoRepo
--branch-nameMyNewBranch
--commit-id317f8570EXAMPLE
출력:
None.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateBranch
섹션을 참조하세요.
-
다음 코드 예시에서는 create-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋 생성
다음
create-commit
예시에서는main
브랜치에 이름이 지정된 리포지토리에readme.md
파일을 추가하는MyDemoRepo
리포지토리에 대한 초기 커밋을 만드는 방법을 보여줍니다.aws codecommit create-commit \ --repository-name
MyDemoRepo
\ --branch-namemain
\ --put-files"filePath=readme.md,fileContent='Welcome to our team repository.'"
출력:
{ "filesAdded": [ { "blobId": "5e1c309d-EXAMPLE", "absolutePath": "readme.md", "fileMode": "NORMAL" } ], "commitId": "4df8b524-EXAMPLE", "treeId": "55b57003-EXAMPLE", "filesDeleted": [], "filesUpdated": [] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Create a Commit in AWS CodeCommit 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 create-pull-request-approval-rule
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 규칙 생성
다음
create-pull-request-approval-rule
예시에서는 지정된 풀 리퀘스트에 대해 이름이 지정된Require two approved approvers
승인 규칙을 만듭니다. 이 규칙은 하나의 승인 풀에서 두 개의 승인이 필요하도록 지정합니다. 이 풀에는123456789012
AWS 계정에서CodeCommitReview
역할을 수임하고 CodeCommit에 액세스할 수 있는 모든 사용자가 포함됩니다. 또한 동일한 AWS 계정에서Nikhil_Jayashankar
IAM 사용자 또는 페더레이션 사용자도 포함됩니다.aws codecommit create-pull-request-approval-rule \ --approval-rule-name
"Require two approved approvers"
\ --approval-rule-content "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"CodeCommitApprovers:123456789012:Nikhil_Jayashankar\", \"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}"출력:
{ "approvalRule": { "approvalRuleName": "Require two approved approvers", "lastModifiedDate": 1570752871.932, "ruleContentSha256": "7c44e6ebEXAMPLE", "creationDate": 1570752871.932, "approvalRuleId": "aac33506-EXAMPLE", "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"CodeCommitApprovers:123456789012:Nikhil_Jayashankar\", \"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Create an Approval Rule 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreatePullRequestApprovalRule
섹션을 참조하세요.
-
다음 코드 예시에서는 create-pull-request
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청 생성
다음
create-pull-request
예시에서는 'jane-branch' 소스 브랜치를 대상으로 'Please review these changes by Tuesday'라는 설명과 함께 'Pronunciation difficulty analyzer'라는 풀 리퀘스트를 생성하고, 'MyDemoRepo'라는 CodeCommit 리포지토리의 기본 브랜치 'main'에 병합할 것입니다.aws codecommit create-pull-request \ --title
"My Pull Request"
\ --description"Please review these changes by Tuesday"
\ --client-request-token123Example
\ --targetsrepositoryName=MyDemoRepo,sourceReference=MyNewBranch
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "originApprovalRuleTemplate": { "approvalRuleTemplateId": "dd3d22fe-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::111111111111:user/Jane_Doe", "description": "Please review these changes by Tuesday", "title": "Pronunciation difficulty analyzer", "pullRequestTargets": [ { "destinationCommit": "5d036259EXAMPLE", "destinationReference": "refs/heads/main", "repositoryName": "MyDemoRepo", "sourceCommit": "317f8570EXAMPLE", "sourceReference": "refs/heads/jane-branch", "mergeMetadata": { "isMerged": false } } ], "lastActivityDate": 1508962823.285, "pullRequestId": "42", "clientRequestToken": "123Example", "pullRequestStatus": "OPEN", "creationDate": 1508962823.285 } }
-
API 세부 정보는 AWS CLI 명령 참조의 CreatePullRequest
섹션을 참조하세요.
-
다음 코드 예시에서는 create-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리 생성
이 예시에서는 리포지토리를 생성하고 사용자의 AWS 계정과 연결합니다.
명령:
aws codecommit create-repository --repository-name
MyDemoRepo
--repository-description"My demonstration repository"
출력:
{ "repositoryMetadata": { "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "lastModifiedDate": 1444766838.027, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://git-codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-1:111111111111EXAMPLE:MyDemoRepo", "accountId": "111111111111" } }
-
API 세부 정보는 AWS CLI 명령 참조의 CreateRepository
를 참조하세요.
-
다음 코드 예시에서는 create-unreferenced-merge-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
두 커밋 지정자를 병합한 결과를 나타내는 참조되지 않은 커밋
다음
create-unreferenced-merge-commit
예시에서는MyDemoRepo
리포지토리에서bugfix-1234
소스 브랜치와main
대상 브랜치 간의 병합 결과를 나타내는 커밋을 생성한다.aws codecommit create-unreferenced-merge-commit \ --source-commit-specifier
bugfix-1234
\ --destination-commit-specifiermain
\ --merge-optionTHREE_WAY_MERGE
\ --repository-nameMyDemoRepo
\ --name"Maria Garcia"
\ --email"maria_garcia@example.com"
\ --commit-message"Testing the results of this merge."
출력:
{ "commitId": "4f178133EXAMPLE", "treeId": "389765daEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Resolve Conflicts in a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CreateUnreferencedMergeCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 credential-helper
의 사용 방법을 보여줍니다.
- AWS CLI
-
AWS CodeCommit을 사용하여 AWS CLI에 포함된 자격 증명 도우미를 설정하는 방법
credential-helper
유틸리티는 AWS CLI에서 직접 호출하도록 설계되지 않았습니다. 대신 로컬 컴퓨터를 설정하기 위한git config
명령과 함께 파라미터로 사용하기 위한 것입니다. 이를 통해 Git은 CodeCommit 리포지토리와 상호 작용하기 위해 AWS로 인증해야 할 때마다 HTTPS와 암호로 서명된 버전의 IAM 사용자 자격 증명 또는 Amazon EC2 인스턴스 역할을 사용할 수 있습니다.git config --global credential.helper '!aws codecommit credential-helper $@' git config --global credential.UseHttpPath true
출력:
[credential] helper = !aws codecommit credential-helper $@ UseHttpPath = true
자세한 내용은 AWS CodeCommit AWS 사용 설명서의 Setting up for CodeCommit Using Other Methods 섹션을 참조하세요. 콘텐츠를 주의 깊게 검토한 다음AWS CodeCommit 사용 설명서의 Linux, macOS 또는 Unix에서 HTTPS 연결의 경우 또는 Windows에서 HTTPS 연결의 경우 중 하나의 절차를 따르세요.
-
API 세부 정보는 AWS CLI 명령 참조의 CredentialHelper
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-approval-rule-template
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿 삭제
다음
delete-approval-rule-template
예제에서는 지정된 승인 규칙 템플릿을 삭제합니다.aws codecommit delete-approval-rule-template \ --approval-rule-template-name
1-approver-for-all-pull-requests
출력:
{ "approvalRuleTemplateId": "41de97b7-EXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Delete an Approval Rule Template 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteApprovalRuleTemplate
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-branch
의 사용 방법을 보여줍니다.
- AWS CLI
-
브랜치 삭제
이 예시는 AWS CodeCommit 리포지토리에서 브랜치를 삭제하는 방법을 보여줍니다.
명령:
aws codecommit delete-branch --repository-name
MyDemoRepo
--branch-nameMyNewBranch
출력:
{ "branch": { "commitId": "317f8570EXAMPLE", "branchName": "MyNewBranch" } }
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteBranch
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-comment-content
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋의 설명 내용 삭제
설명을 작성한 경우에만 설명의 콘텐츠를 삭제할 수 있습니다. 이 예시에서는 시스템 생성 ID가
ff30b348EXAMPLEb9aa670f
인 설명의 내용을 삭제하는 방법을 보여줍니다.aws codecommit delete-comment-content \ --comment-id
ff30b348EXAMPLEb9aa670f
출력:
{ "comment": { "creationDate": 1508369768.142, "deleted": true, "lastModifiedDate": 1508369842.278, "clientRequestToken": "123Example", "commentId": "ff30b348EXAMPLEb9aa670f", "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "callerReactions": [], "reactionCounts": { "CLAP" : 1 } } }
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteCommentContent
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-file
의 사용 방법을 보여줍니다.
- AWS CLI
-
파일 삭제
다음
delete-file
예시에서는MyDemoRepo
리포지토리에서 가장 최근 커밋 ID가c5709475EXAMPLE
인main
브랜치에서README.md
파일을 삭제하는 방법을 보여줍니다.aws codecommit delete-file \ --repository-name
MyDemoRepo
\ --branch-namemain
\ --file-pathREADME.md
\ --parent-commit-idc5709475EXAMPLE
출력:
{ "blobId":"559b44fEXAMPLE", "commitId":"353cf655EXAMPLE", "filePath":"README.md", "treeId":"6bc824cEXAMPLE" }
자세한 내용은 AWS CodeCommit API 참조 안내서의 Edit or Delete a File in AWS CodeCommit 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteFile
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-pull-request-approval-rule
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 규칙 삭제
다음
delete-pull-request-approval-rule
예제에서는 지정된 풀 요청에 대해My Approval Rule
승인 규칙을 삭제합니다.aws codecommit delete-pull-request-approval-rule \ --approval-rule-name
"My Approval Rule"
\ --pull-request-id15
출력:
{ "approvalRuleId": "077d8e8a8-EXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Edit or Delete an Approval Rule 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DeletePullRequestApprovalRule
섹션을 참조하세요.
-
다음 코드 예시에서는 delete-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리 삭제
이 예시에서는 AWS CodeCommit 리포지토리를 삭제하는 방법을 보여줍니다.
명령:
aws codecommit delete-repository --repository-name
MyDemoRepo
출력:
{ "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE" }
-
API 세부 정보는 AWS CLI 명령 참조의 DeleteRepository
를 참조하세요.
-
다음 코드 예시에서는 describe-merge-conflicts
의 사용 방법을 보여줍니다.
- AWS CLI
-
병합 충돌에 대한 자세한 정보를 얻으려면
다음
describe-merge-conflicts
예시에서는 지정된 소스 브랜치와 대상 브랜치에 있는readme.md
파일에 대한 병합 충돌을 THREE_WAY_MERGE 전략을 사용하여 확인합니다.aws codecommit describe-merge-conflicts \ --source-commit-specifier
feature-randomizationfeature
\ --destination-commit-specifiermain
\ --merge-optionTHREE_WAY_MERGE
\ --file-pathreadme.md
\ --repository-nameMyDemoRepo
출력:
{ "conflictMetadata": { "filePath": "readme.md", "fileSizes": { "source": 139, "destination": 230, "base": 85 }, "fileModes": { "source": "NORMAL", "destination": "NORMAL", "base": "NORMAL" }, "objectTypes": { "source": "FILE", "destination": "FILE", "base": "FILE" }, "numberOfConflicts": 1, "isBinaryFile": { "source": false, "destination": false, "base": false }, "contentConflict": true, "fileModeConflict": false, "objectTypeConflict": false, "mergeOperations": { "source": "M", "destination": "M" } }, "mergeHunks": [ { "isConflict": true, "source": { "startLine": 0, "endLine": 3, "hunkContent": "VGhpcyBpEXAMPLE=" }, "destination": { "startLine": 0, "endLine": 1, "hunkContent": "VXNlIHRoEXAMPLE=" } } ], "destinationCommitId": "86958e0aEXAMPLE", "sourceCommitId": "6ccd57fdEXAMPLE", "baseCommitId": "767b69580EXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Resolve Conflicts in a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DescribeMergeConflicts
섹션을 참조하세요.
-
다음 코드 예시에서는 describe-pull-request-events
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에서 이벤트를 보는 방법
다음
describe-pull-request-events
예시에서는 ID가 '8'인 풀 리퀘스트에 대한 이벤트를 검색합니다.aws codecommit describe-pull-request-events --pull-request-id
8
출력:
{ "pullRequestEvents": [ { "pullRequestId": "8", "pullRequestEventType": "PULL_REQUEST_CREATED", "eventDate": 1510341779.53, "actor": "arn:aws:iam::111111111111:user/Zhang_Wei" }, { "pullRequestStatusChangedEventMetadata": { "pullRequestStatus": "CLOSED" }, "pullRequestId": "8", "pullRequestEventType": "PULL_REQUEST_STATUS_CHANGED", "eventDate": 1510341930.72, "actor": "arn:aws:iam::111111111111:user/Jane_Doe" } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 DescribePullRequestEvents
섹션을 참조하세요.
-
다음 코드 예시에서는 disassociate-approval-rule-template-from-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리에서 승인 규칙 템플릿 연결 해제
다음
disassociate-approval-rule-template-from-repository
예시는MyDemoRepo
리포지토리에서 지정된 승인 규칙 템플릿을 연결 해제합니다.aws codecommit disassociate-approval-rule-template-from-repository \ --repository-name
MyDemoRepo
\ --approval-rule-template-name1-approver-rule-for-all-pull-requests
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Disassociate an Approval Rule Template 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 DisassociateApprovalRuleTemplateFromRepository
섹션을 참조하세요.
-
다음 코드 예시에서는 evaluate-pull-request-approval-rules
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 모든 승인 규칙이 충족되었는지 평가하는 방법
다음
evaluate-pull-request-approval-rules
예시는 지정된 풀 리퀘스트에 대한 승인 규칙의 상태를 평가합니다. 이 예시에서는 풀 리퀘스트에 대한 승인 규칙이 충족되지 않았으므로 명령의 출력에false
의 값approved
가 표시됩니다.aws codecommit evaluate-pull-request-approval-rules \ --pull-request-id
27
\ --revision-id9f29d167EXAMPLE
출력:
{ "evaluation": { "approved": false, "approvalRulesNotSatisfied": [ "Require two approved approvers" ], "overridden": false, "approvalRulesSatisfied": [] } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Merge a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 EvaluatePullRequestApprovalRules
섹션을 참조하세요.
-
다음 코드 예시에서는 get-approval-rule-template
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿의 내용 가져오기
다음
get-approval-rule-template
예시는 승인 규칙 템플릿1-approver-rule-for-all-pull-requests
의 콘텐츠를 가져옵니다.aws codecommit get-approval-rule-template \ --approval-rule-template-name
1-approver-rule-for-all-pull-requests
출력:
{ "approvalRuleTemplate": { "approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 1,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "ruleContentSha256": "621181bbEXAMPLE", "lastModifiedDate": 1571356106.936, "creationDate": 1571356106.936, "approvalRuleTemplateName": "1-approver-rule-for-all-pull-requests", "lastModifiedUser": "arn:aws:iam::123456789012:user/Li_Juan", "approvalRuleTemplateId": "a29abb15-EXAMPLE", "approvalRuleTemplateDescription": "All pull requests must be approved by one developer on the team." } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetApprovalRuleTemplate
섹션을 참조하세요.
-
다음 코드 예시에서는 get-blob
의 사용 방법을 보여줍니다.
- AWS CLI
-
Git BLOB 객체에 대한 정보 보기
다음
get-blob
예시에서는 AWS CodeCommit 리포지토리 'MyDemoRepo'에 있는 ID가 '2eb4af3bEXAMPLE'인 Git 블롭에 대한 정보를 검색합니다.aws codecommit get-blob --repository-name
MyDemoRepo
--blob-id2eb4af3bEXAMPLE
출력:
{ "content": "QSBCaW5hcnkgTGFyToEXAMPLE=" }
-
API 세부 정보는 AWS CLI 명령 참조의 GetBlob
섹션을 참조하세요.
-
다음 코드 예시에서는 get-branch
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋에 대한 정보 가져오기
이 예시에서는 AWS CodeCommit 리포지토리의 브랜치에 대한 정보를 가져옵니다.
명령:
aws codecommit get-branch --repository-name
MyDemoRepo
--branch-nameMyNewBranch
출력:
{ "BranchInfo": { "commitID": "317f8570EXAMPLE", "branchName": "MyNewBranch" } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetBranch
섹션을 참조하세요.
-
다음 코드 예시에서는 get-comment-reactions
의 사용 방법을 보여줍니다.
- AWS CLI
-
설명에 대한 이모티콘 반응 보기
다음
get-comment-reactions
예시에서는 ID가abcd1234EXAMPLEb5678efgh
인 설명에 대한 모든 이모티콘 반응을 나열합니다. 셸의 글꼴이 이모지 버전 1.0 표시를 지원하는 경우emoji
의 출력에 이모지가 표시됩니다.aws codecommit get-comment-reactions \ --comment-id
abcd1234EXAMPLEb5678efgh
출력:
{ "reactionsForComment": { [ { "reaction": { "emoji:"??", "shortCode": "thumbsup", "unicode": "U+1F44D" }, "users": [ "arn:aws:iam::123456789012:user/Li_Juan", "arn:aws:iam::123456789012:user/Mary_Major", "arn:aws:iam::123456789012:user/Jorge_Souza" ] }, { "reaction": { "emoji": "??", "shortCode": "thumbsdown", "unicode": "U+1F44E" }, "users": [ "arn:aws:iam::123456789012:user/Nikhil_Jayashankar" ] }, { "reaction": { "emoji": "??", "shortCode": "confused", "unicode": "U+1F615" }, "users": [ "arn:aws:iam::123456789012:user/Saanvi_Sarkar" ] } ] } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Comment on a commit in AWS CodeCommit 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetCommentReactions
섹션을 참조하세요.
-
다음 코드 예시에서는 get-comment
의 사용 방법을 보여줍니다.
- AWS CLI
-
설명에 대한 세부 정보 보기
이 예시에서는 시스템에서 생성된 설명 ID가
ff30b348EXAMPLEb9aa670f
인 설명의 세부 정보를 보는 방법을 설명합니다.aws codecommit get-comment \ --comment-id
ff30b348EXAMPLEb9aa670f
출력:
{ "comment": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "123Example", "commentId": "ff30b348EXAMPLEb9aa670f", "content": "Whoops - I meant to add this comment to the line, but I don't see how to delete it.", "creationDate": 1508369768.142, "deleted": false, "commentId": "", "lastModifiedDate": 1508369842.278, "callerReactions": [], "reactionCounts": { "SMILE" : 6, "THUMBSUP" : 1 } } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetComment
섹션을 참조하세요.
-
다음 코드 예시에서는 get-comments-for-compared-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋에 대한 설명 보기
예를 들어
MyDemoRepo
리포지토리의 두 커밋 간의 비교에 대해 작성된 설명을 보려면 다음을 수행합니다.aws codecommit get-comments-for-compared-commit \ --repository-name
MyDemoRepo
\ --before-commit-ID6e147360EXAMPLE
\ --after-commit-id317f8570EXAMPLE
출력:
{ "commentsForComparedCommitData": [ { "afterBlobId": "1f330709EXAMPLE", "afterCommitId": "317f8570EXAMPLE", "beforeBlobId": "80906a4cEXAMPLE", "beforeCommitId": "6e147360EXAMPLE", "comments": [ { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "123Example", "commentId": "ff30b348EXAMPLEb9aa670f", "content": "Whoops - I meant to add this comment to the line, not the file, but I don't see how to delete it.", "creationDate": 1508369768.142, "deleted": false, "CommentId": "123abc-EXAMPLE", "lastModifiedDate": 1508369842.278, "callerReactions": [], "reactionCounts": { "SMILE" : 6, "THUMBSUP" : 1 } }, { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "123Example", "commentId": "553b509bEXAMPLE56198325", "content": "Can you add a test case for this?", "creationDate": 1508369612.240, "deleted": false, "commentId": "456def-EXAMPLE", "lastModifiedDate": 1508369612.240, "callerReactions": [], "reactionCounts": { "THUMBSUP" : 2 } } ], "location": { "filePath": "cl_sample.js", "filePosition": 1232, "relativeFileVersion": "after" }, "repositoryName": "MyDemoRepo" } ], "nextToken": "exampleToken" }
-
API 세부 정보는 AWS CLI 명령 참조의 GetCommentsForComparedCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 get-comments-for-pull-request
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 리퀘스트에 남긴 설명 보기
이 예시에서는
MyDemoRepo
리포지토리에서 풀 리퀘스트에 대한 설명을 보는 방법을 보여줍니다.aws codecommit get-comments-for-pull-request \ --repository-name
MyDemoRepo
\ --before-commit-ID317f8570EXAMPLE
\ --after-commit-id5d036259EXAMPLE
출력:
{ "commentsForPullRequestData": [ { "afterBlobId": "1f330709EXAMPLE", "afterCommitId": "5d036259EXAMPLE", "beforeBlobId": "80906a4cEXAMPLE", "beforeCommitId": "317f8570EXAMPLE", "comments": [ { "authorArn": "arn:aws:iam::111111111111:user/Saanvi_Sarkar", "clientRequestToken": "", "commentId": "abcd1234EXAMPLEb5678efgh", "content": "These don't appear to be used anywhere. Can we remove them?", "creationDate": 1508369622.123, "deleted": false, "lastModifiedDate": 1508369622.123, "callerReactions": [], "reactionCounts": { "THUMBSUP" : 6, "CONFUSED" : 1 } }, { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "commentId": "442b498bEXAMPLE5756813", "content": "Good catch. I'll remove them.", "creationDate": 1508369829.104, "deleted": false, "lastModifiedDate": 150836912.273, "callerReactions": ["THUMBSUP"] "reactionCounts": { "THUMBSUP" : 14 } } ], "location": { "filePath": "ahs_count.py", "filePosition": 367, "relativeFileVersion": "AFTER" }, "repositoryName": "MyDemoRepo", "pullRequestId": "42" } ], "nextToken": "exampleToken" }
-
API 세부 정보는 AWS CLI 명령 참조의 GetCommentsForPullRequest
섹션을 참조하세요.
-
다음 코드 예시에서는 get-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 커밋에 대한 정보 보기
이 예시에서는 'MyDemoRepo'라는 이름의 CodeCommit 리포지토리에 있는 시스템 생성 ID가 '7e9fd3091thisisanexamplethisisanexample1'인 커밋에 대한 세부 정보를 보여줍니다.
명령:
aws codecommit get-commit --repository-name
MyDemoRepo
--commit-id7e9fd3091thisisanexamplethisisanexample1
출력:
{ "commit": { "additionalData": "", "committer": { "date": "1484167798 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "author": { "date": "1484167798 -0800", "name": "Mary Major", "email": "mary_major@example.com" }, "treeId": "347a3408thisisanexampletreeidexample", "parents": [ "7aa87a031thisisanexamplethisisanexample1" ], "message": "Fix incorrect variable name" } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 get-differences
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 커밋 지정자의 차이점에 대한 정보를 가져오는 방법
이 예시에서는 AWS CodeCommit 리포지토리의 이름이 변경된 폴더에서 MyDemoRepo라는 이름의 두 커밋 지정자(브랜치, 태그, HEAD 또는 기타 정규화된 참조(커밋 ID 등)) 간의 변경 사항에 대한 보기 메타데이터 정보를 보여줍니다. 이 예시에서는 이러한 옵션을 사용하여 결과를 제한하는 방법을 보다 완벽하게 설명하기 위해 --before-commit-specifier, --before-path, --after-path 등 필수 옵션이 아닌 몇 가지 옵션을 포함합니다. 응답에는 파일 모드 권한이 포함됩니다.
명령:
aws codecommit get-differences --repository-name
MyDemoRepo
--before-commit-specifier955bba12thisisanexamplethisisanexample
--after-commit-specifier14a95463thisisanexamplethisisanexample
--before-pathtmp/example-folder
--after-pathtmp/renamed-folder
출력:
{ "differences": [ { "afterBlob": { "path": "blob.txt", "blobId": "2eb4af3b1thisisanexamplethisisanexample1", "mode": "100644" }, "changeType": "M", "beforeBlob": { "path": "blob.txt", "blobId": "bf7fcf281thisisanexamplethisisanexample1", "mode": "100644" } } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 GetDifferences
섹션을 참조하세요.
-
다음 코드 예시에서는 get-file
의 사용 방법을 보여줍니다.
- AWS CLI
-
AWS CodeCommit 리포지토리에서 파일의 base-64 인코딩 콘텐츠를 가져오는 방법
다음
get-file
예시에서는MyDemoRepo
리포지토리에main
브랜치에서README.md
파일의 base-64로 인코딩된 내용을 가져오는 방법을 보여줍니다.aws codecommit get-file \ --repository-name
MyDemoRepo
\ --commit-specifiermain
\ --file-pathREADME.md
출력:
{ "blobId":"559b44fEXAMPLE", "commitId":"c5709475EXAMPLE", "fileContent":"IyBQaHVzEXAMPLE", "filePath":"README.md", "fileMode":"NORMAL", "fileSize":1563 }
자세한 내용은 AWS CodeCommit API 참조 안내서의 GetFile을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetFile
섹션을 참조하세요.
-
다음 코드 예시에서는 get-folder
의 사용 방법을 보여줍니다.
- AWS CLI
-
AWS CodeCommit 리포지토리의 폴더 콘텐츠를 가져오는 방법
다음
get-folder
예시에서는MyDemoRepo
리포지토리에서 최상위 폴더의 콘텐츠를 가져오는 방법을 보여줍니다.aws codecommit get-folder --repository-name
MyDemoRepo
--folder-path ""출력:
{ "commitId":"c5709475EXAMPLE", "files":[ { "absolutePath":".gitignore", "blobId":"74094e8bEXAMPLE", "fileMode":"NORMAL", "relativePath":".gitignore" }, { "absolutePath":"Gemfile", "blobId":"9ceb72f6EXAMPLE", "fileMode":"NORMAL", "relativePath":"Gemfile" }, { "absolutePath":"Gemfile.lock", "blobId":"795c4a2aEXAMPLE", "fileMode":"NORMAL", "relativePath":"Gemfile.lock" }, { "absolutePath":"LICENSE.txt", "blobId":"0c7932c8EXAMPLE", "fileMode":"NORMAL", "relativePath":"LICENSE.txt" }, { "absolutePath":"README.md", "blobId":"559b44feEXAMPLE", "fileMode":"NORMAL", "relativePath":"README.md" } ], "folderPath":"", "subFolders":[ { "absolutePath":"public", "relativePath":"public", "treeId":"d5e92ae3aEXAMPLE" }, { "absolutePath":"tmp", "relativePath":"tmp", "treeId":"d564d0bcEXAMPLE" } ], "subModules":[], "symbolicLinks":[], "treeId":"7b3c4dadEXAMPLE" }
자세한 내용은 AWS CodeCommit API 참조 안내서의 GetFolder 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetFolder
섹션을 참조하세요.
-
다음 코드 예시에서는 get-merge-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
병합 커밋에 대한 자세한 정보 얻기
다음
get-merge-commit
예시에서는MyDemoRepo
리포지토리에서 THREE_WAY_MERGE 전략을 사용하여main
대상 브랜치와bugfix-bug1234
소스 브랜치에 대한 병합 커밋에 대한 세부 정보를 표시합니다.aws codecommit get-merge-commit \ --source-commit-specifier
bugfix-bug1234
\ --destination-commit-specifiermain
\ --merge-optionTHREE_WAY_MERGE
\ --repository-nameMyDemoRepo
출력:
{ "sourceCommitId": "c5709475EXAMPLE", "destinationCommitId": "317f8570EXAMPLE", "baseCommitId": "fb12a539EXAMPLE", "mergeCommitId": "ffc4d608eEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 View Commit Details 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetMergeCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 get-merge-conflicts
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 리퀘스트에 병합 충돌이 있는지 확인
다음
get-merge-conflicts
예시에서는MyDemoRepo
리포지토리에서feature-randomizationfeature
소스 브랜치 끝과 'main' 대상 브랜치 사이에 병합 충돌이 있는지 표시합니다.aws codecommit get-merge-conflicts \ --repository-name
MyDemoRepo
\ --source-commit-specifierfeature-randomizationfeature
\ --destination-commit-specifiermain
\ --merge-optionTHREE_WAY_MERGE
출력:
{ "mergeable": false, "destinationCommitId": "86958e0aEXAMPLE", "sourceCommitId": "6ccd57fdEXAMPLE", "baseCommitId": "767b6958EXAMPLE", "conflictMetadataList": [ { "filePath": "readme.md", "fileSizes": { "source": 139, "destination": 230, "base": 85 }, "fileModes": { "source": "NORMAL", "destination": "NORMAL", "base": "NORMAL" }, "objectTypes": { "source": "FILE", "destination": "FILE", "base": "FILE" }, "numberOfConflicts": 1, "isBinaryFile": { "source": false, "destination": false, "base": false }, "contentConflict": true, "fileModeConflict": false, "objectTypeConflict": false, "mergeOperations": { "source": "M", "destination": "M" } } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 GetMergeConflicts
섹션을 참조하세요.
-
다음 코드 예시에서는 get-merge-options
의 사용 방법을 보여줍니다.
- AWS CLI
-
두 개의 지정된 브랜치를 병합하는 데 사용할 수 있는 병합 옵션에 대한 정보를 가져오는 방법
다음
get-merge-options
예시에서는bugfix-bug1234
소스 브랜치를MyDemoRepo
리포지토리에 있는main
대상 브랜치와 병합하는 데 사용할 수 있는 병합 옵션을 결정합니다.aws codecommit get-merge-options \ --source-commit-specifier
bugfix-bug1234
\ --destination-commit-specifiermain
\ --repository-nameMyDemoRepo
출력:
{ "mergeOptions": [ "FAST_FORWARD_MERGE", "SQUASH_MERGE", "THREE_WAY_MERGE" ], "sourceCommitId": "18059494EXAMPLE", "destinationCommitId": "ffd3311dEXAMPLE", "baseCommitId": "ffd3311dEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Resolve Conflicts in a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetMergeOptions
섹션을 참조하세요.
-
다음 코드 예시에서는 get-pull-request-approval-states
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 보기
다음
get-pull-request-approval-states
예시에서는 지정된 풀 리퀘스트에 대한 승인을 반환합니다.aws codecommit get-pull-request-approval-states \ --pull-request-id
8
\ --revision-id9f29d167EXAMPLE
출력:
{ "approvals": [ { "userArn": "arn:aws:iam::123456789012:user/Mary_Major", "approvalState": "APPROVE" } ] }
자세한 내용은 AWS CodeCommit 사용 설명서의 View Pull Requests 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetPullRequestApprovalStates
섹션을 참조하세요.
-
다음 코드 예시에서는 get-pull-request-override-state
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 리퀘스트의 재정의 상태에 대한 정보 가져오기
다음
get-pull-request-override-state
예시에서는 지정된 풀 리퀘스트에 대한 재정의 상태를 반환합니다. 이 예시에서는 Mary Major라는 사용자가 풀 리퀘스트에 대한 승인 규칙을 재정의했기 때문에 출력은true
라는 값을 반환합니다.aws codecommit get-pull-request-override-state \ --pull-request-id
34
\ --revision-id9f29d167EXAMPLE
출력:
{ "overridden": true, "overrider": "arn:aws:iam::123456789012:user/Mary_Major" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Override Approval Rules on a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 GetPullRequestOverrideState
섹션을 참조하세요.
-
다음 코드 예시에서는 get-pull-request
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청의 세부 정보 보기
이 예시에서는 ID가
27
인 풀 요청에 대한 정보를 보는 방법을 보여줍니다.aws codecommit get-pull-request \ --pull-request-id
27
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "ruleContentSha256": "4711b576EXAMPLE" } ], "lastActivityDate": 1562619583.565, "pullRequestTargets": [ { "sourceCommit": "ca45e279EXAMPLE", "sourceReference": "refs/heads/bugfix-1234", "mergeBase": "a99f5ddbEXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false }, "destinationCommit": "2abfc6beEXAMPLE", "repositoryName": "MyDemoRepo" } ], "revisionId": "e47def21EXAMPLE", "title": "Quick fix for bug 1234", "authorArn": "arn:aws:iam::123456789012:user/Nikhil_Jayashankar", "clientRequestToken": "d8d7612e-EXAMPLE", "creationDate": 1562619583.565, "pullRequestId": "27", "pullRequestStatus": "OPEN" } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetPullRequest
섹션을 참조하세요.
-
다음 코드 예시에서는 get-repository-triggers
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 트리거에 대한 정보를 가져오는 방법
이 예시에서는
MyDemoRepo
라는 AWS CodeCommit 리포지토리에 대해 구성된 트리거에 대한 세부 정보를 보여줍니다.aws codecommit get-repository-triggers \ --repository-name
MyDemoRepo
출력:
{ "configurationId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "triggers": [ { "destinationArn": "arn:aws:sns:us-east-1:111111111111:MyCodeCommitTopic", "branches": [ "main", "preprod" ], "name": "MyFirstTrigger", "customData": "", "events": [ "all" ] }, { "destinationArn": "arn:aws:lambda:us-east-1:111111111111:function:MyCodeCommitPythonFunction", "branches": [], "name": "MySecondTrigger", "customData": "EXAMPLE", "events": [ "all" ] } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 GetRepositoryTriggers
섹션을 참조하세요.
-
다음 코드 예시에서는 get-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리 관련 정보를 가져오기
이 예시에서는 AWS CodeCommit 리포지토리에 대한 세부 정보를 보여줍니다.
aws codecommit get-repository \ --repository-name
MyDemoRepo
출력:
{ "repositoryMetadata": { "creationDate": 1429203623.625, "defaultBranch": "main", "repositoryName": "MyDemoRepo", "cloneUrlSsh": "ssh://git-codecommit.us-east-1.amazonaws.com/v1/repos/v1/repos/MyDemoRepo", "lastModifiedDate": 1430783812.0869999, "repositoryDescription": "My demonstration repository", "cloneUrlHttp": "https://codecommit.us-east-1.amazonaws.com/v1/repos/MyDemoRepo", "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", "Arn": "arn:aws:codecommit:us-east-1:80398EXAMPLE:MyDemoRepo "accountId": "111111111111" } }
-
API 세부 정보는 AWS CLI 명령 참조의 GetRepository
섹션을 참조하세요.
-
다음 코드 예시에서는 list-approval-rule-templates
의 사용 방법을 보여줍니다.
- AWS CLI
-
AWS 리전의 모든 승인 규칙 템플릿 나열
다음
list-approval-rule-templates
예시에서는 지정된 리전의 모든 승인 규칙 템플릿을 나열합니다. AWS 리전이 파라미터로 지정되지 않은 경우 명령은 명령을 실행하는 데 사용되는 AWS CLI 프로파일에 지정된 리전에 대한 승인 규칙 템플릿을 반환합니다.aws codecommit list-approval-rule-templates \ --region
us-east-2
출력:
{ "approvalRuleTemplateNames": [ "2-approver-rule-for-main", "1-approver-rule-for-all-pull-requests" ] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListApprovalRuleTemplates
섹션을 참조하세요.
-
다음 코드 예시에서는 list-associated-approval-rule-templates-for-repository
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리와 연결된 모든 템플릿 나열
다음
list-associated-approval-rule-templates-for-repository
예시에서는MyDemoRepo
리포지토리와 연결된 모든 승인 규칙 템플릿을 나열합니다.aws codecommit list-associated-approval-rule-templates-for-repository \ --repository-name
MyDemoRepo
출력:
{ "approvalRuleTemplateNames": [ "2-approver-rule-for-main", "1-approver-rule-for-all-pull-requests" ] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListAssociatedApprovalRuleTemplatesForRepository
섹션을 참조하세요.
-
다음 코드 예시에서는 list-branches
의 사용 방법을 보여줍니다.
- AWS CLI
-
브랜치 이름 목록 보기
이 예시에서는 AWS CodeCommit 리포지토리의 모든 브랜치 이름을 나열합니다.
aws codecommit list-branches \ --repository-name
MyDemoRepo
출력:
{ "branches": [ "MyNewBranch", "main" ] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListBranches
섹션을 참조하세요.
-
다음 코드 예시에서는 list-pull-requests
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 풀 요청 보기
이 예시에서는 ARN이 'arn:aws:iam::111111111111:user/Li_Juan'이고 상태가 'CLOSED'인 IAM 사용자가 만든 풀 리퀘스트를 'MyDemoRepo'라는 AWS CodeCommit 리포지토리에 나열하는 방법을 보여줍니다.
aws codecommit list-pull-requests --author-arn
arn:aws:iam::111111111111:user/Li_Juan
--pull-request-statusCLOSED
--repository-nameMyDemoRepo
출력:
{ "nextToken": "", "pullRequestIds": ["2","12","16","22","23","35","30","39","47"] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListPullRequests
섹션을 참조하세요.
-
다음 코드 예시에서는 list-repositories-for-approval-rule-template
의 사용 방법을 보여줍니다.
- AWS CLI
-
템플릿과 연결된 모든 리포지토리 나열
다음
list-repositories-for-approval-rule-template
예시에서는 지정된 승인 규칙 템플릿과 연결된 모든 리포지토리를 나열합니다.aws codecommit list-repositories-for-approval-rule-template \ --approval-rule-template-name
2-approver-rule-for-main
출력:
{ "repositoryNames": [ "MyDemoRepo", "MyClonedRepo" ] }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListRepositoriesForApprovalRuleTemplate
섹션을 참조하세요.
-
다음 코드 예시에서는 list-repositories
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 목록 보기
이 예시에서는 사용자의 AWS 계정과 연결된 모든 AWS CodeCommit 리포지토리를 나열합니다.
명령:
aws codecommit list-repositories
출력:
{ "repositories": [ { "repositoryName": "MyDemoRepo" "repositoryId": "f7579e13-b83e-4027-aaef-650c0EXAMPLE", }, { "repositoryName": "MyOtherDemoRepo" "repositoryId": "cfc29ac4-b0cb-44dc-9990-f6f51EXAMPLE" } ] }
-
API 세부 정보는 AWS CLI 명령 참조의 ListRepositories
섹션을 참조하세요.
-
다음 코드 예시에서는 list-tags-for-resource
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 AWS 태그 보기
다음
list-tags-for-resource
예시에서는 지정된 리포지토리의 태그 키와 태그 값을 나열합니다.aws codecommit list-tags-for-resource \ --resource-arn
arn:aws:codecommit:us-west-2:111111111111:MyDemoRepo
출력:
{ "tags": { "Status": "Secret", "Team": "Saanvi" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 View Tags for a Repository 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 ListTagsForResource
를 참조하세요.
-
다음 코드 예시에서는 merge-branches-by-fast-forward
의 사용 방법을 보여줍니다.
- AWS CLI
-
빨리 감기 병합 전략을 사용하여 두 브랜치 병합
다음
merge-branches-by-fast-forward
예시에서는 지정된 소스 브랜치를MyDemoRepo
리포지토리의 지정된 대상 브랜치와 병합합니다.aws codecommit merge-branches-by-fast-forward \ --source-commit-specifier
bugfix-bug1234
\ --destination-commit-specifierbugfix-bug1233
\ --repository-nameMyDemoRepo
출력:
{ "commitId": "4f178133EXAMPLE", "treeId": "389765daEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Compare and Merge Branches 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergeBranchesByFastForward
섹션을 참조하세요.
-
다음 코드 예시에서는 merge-branches-by-squash
의 사용 방법을 보여줍니다.
- AWS CLI
-
스쿼시 병합 전략을 사용하여 두 브랜치 병합
다음
merge-branches-by-squash
예시에서는 지정된 소스 브랜치를MyDemoRepo
리포지토리의 지정된 대상 브랜치와 병합합니다.aws codecommit merge-branches-by-squash \ --source-commit-specifier
bugfix-bug1234
\ --destination-commit-specifierbugfix-bug1233
\ --author-name"Maria Garcia"
\ --email"maria_garcia@example.com"
\ --commit-message"Merging two fix branches to prepare for a general patch."
\ --repository-nameMyDemoRepo
출력:
{ "commitId": "4f178133EXAMPLE", "treeId": "389765daEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Compare and Merge Branches 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergeBranchesBySquash
섹션을 참조하세요.
-
다음 코드 예시에서는 merge-branches-by-three-way
의 사용 방법을 보여줍니다.
- AWS CLI
-
3방향 병합 전략을 사용하여 두 브랜치 병합
다음
merge-branches-by-three-way
예시에서는 지정된 소스 브랜치를MyDemoRepo
리포지토리의 지정된 대상 브랜치와 병합합니다.aws codecommit merge-branches-by-three-way \ --source-commit-specifier
main
\ --destination-commit-specifierbugfix-bug1234
\ --author-name"Jorge Souza"
--email"jorge_souza@example.com"
\ --commit-message"Merging changes from main to bugfix branch before additional testing."
\ --repository-nameMyDemoRepo
출력:
{ "commitId": "4f178133EXAMPLE", "treeId": "389765daEXAMPLE" }
자세한 내용은 AWS CodeCommit 사용 설명서의 Compare and Merge Branches 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergeBranchesByThreeWay
섹션을 참조하세요.
-
다음 코드 예시에서는 merge-pull-request-by-fast-forward
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청을 병합하고 닫으려면
이 예시에서는
MyDemoRepo
리포지토리에서 ID가 '47'이고 소스 커밋 ID가 '99132ab0EXAMPLE'인 풀 리퀘스트를 병합하고 닫는 방법을 보여 줍니다.aws codecommit merge-pull-request-by-fast-forward \ --pull-request-id
47
\ --source-commit-id99132ab0EXAMPLE
\ --repository-nameMyDemoRepo
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 1,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "I want one approver for this pull request", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.142, "description": "Review the latest changes and updates to the global variables", "lastActivityDate": 1508887223.155, "pullRequestId": "47", "pullRequestStatus": "CLOSED", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": true, "mergedBy": "arn:aws:iam::123456789012:user/Mary_Major" }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Merge a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergePullRequestByFastForward
섹션을 참조하세요.
-
다음 코드 예시에서는 merge-pull-request-by-squash
의 사용 방법을 보여줍니다.
- AWS CLI
-
스쿼시 병합 전략을 사용하여 풀 요청을 병합하는 방법
다음
merge-pull-request-by-squash
예시에서는MyDemoRepo
리포지토리에서 ACCEPT_SOURCE의 충돌 해결 전략을 사용하여 지정된 풀 요청을 병합하고 닫습니다.aws codecommit merge-pull-request-by-squash \ --pull-request-id
47
\ --source-commit-id99132ab0EXAMPLE
\ --repository-nameMyDemoRepo
\ --conflict-detail-levelLINE_LEVEL
\ --conflict-resolution-strategyACCEPT_SOURCE
\ --name"Jorge Souza"
--email"jorge_souza@example.com"
\ --commit-message"Merging pull request 47 by squash and accepting source in merge conflicts"
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "originApprovalRuleTemplate": { "approvalRuleTemplateId": "dd8b17fe-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.142, "description": "Review the latest changes and updates to the global variables", "lastActivityDate": 1508887223.155, "pullRequestId": "47", "pullRequestStatus": "CLOSED", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": true, "mergedBy": "arn:aws:iam::123456789012:user/Mary_Major" }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Merge a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergePullRequestBySquash
섹션을 참조하세요.
-
다음 코드 예시에서는 merge-pull-request-by-three-way
의 사용 방법을 보여줍니다.
- AWS CLI
-
3방향 병합 전략을 사용하여 풀 요청을 병합하는 방법
다음
merge-pull-request-by-three-way
예시에서는MyDemoRepo
리포지토리에서 충돌 세부 정보 및 충돌 해결 전략에 대한 기본 옵션을 사용하여 지정된 풀 요청을 병합하고 닫습니다.aws codecommit merge-pull-request-by-three-way \ --pull-request-id
47
\ --source-commit-id99132ab0EXAMPLE
\ --repository-nameMyDemoRepo
\ --name"Maria Garcia"
\ --email"maria_garcia@example.com"
\ --commit-message"Merging pull request 47 by three-way with default options"
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "originApprovalRuleTemplate": { "approvalRuleTemplateId": "dd8b17fe-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.142, "description": "Review the latest changes and updates to the global variables", "lastActivityDate": 1508887223.155, "pullRequestId": "47", "pullRequestStatus": "CLOSED", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": true, "mergedBy": "arn:aws:iam::123456789012:user/Mary_Major" }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Merge a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 MergePullRequestByThreeWay
섹션을 참조하세요.
-
다음 코드 예시에서는 override-pull-request-approval-rules
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 규칙 요구 사항 재정의
다음
override-pull-request-approval-rules
예시에서는 지정된 풀 요청에 대한 승인 규칙을 재정의합니다. 대신 재정의를 취소하는 방법--override-status
파라미터 값을 로 설정합니다REVOKE
.aws codecommit override-pull-request-approval-rules \ --pull-request-id
34
\ --revision-id927df8d8EXAMPLE
\ --override-statusOVERRIDE
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Override Approval Rules on a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 OverridePullRequestApprovalRules
섹션을 참조하세요.
-
다음 코드 예시에서는 post-comment-for-compared-commit
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋에 설명 작성
이 예시에서는
MyDemoRepo
리포지토리에 있는 두 커밋을 비교하여cl_sample.js
파일에 변경 사항에 대한 설명"Can you add a test case for this?"
을 추가하는 방법을 보여줍니다.aws codecommit post-comment-for-compared-commit \ --repository-name
MyDemoRepo
\ --before-commit-id317f8570EXAMPLE
\ --after-commit-id5d036259EXAMPLE
\ --client-request-token123Example
\ --content"Can you add a test case for this?"
\ --locationfilePath=cl_sample.js,filePosition=1232,relativeFileVersion=AFTER
출력:
{ "afterBlobId": "1f330709EXAMPLE", "afterCommitId": "317f8570EXAMPLE", "beforeBlobId": "80906a4cEXAMPLE", "beforeCommitId": "6e147360EXAMPLE", "comment": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "commentId": "553b509bEXAMPLE56198325", "content": "Can you add a test case for this?", "creationDate": 1508369612.203, "deleted": false, "commentId": "abc123-EXAMPLE", "lastModifiedDate": 1508369612.203, "callerReactions": [], "reactionCounts": [] }, "location": { "filePath": "cl_sample.js", "filePosition": 1232, "relativeFileVersion": "AFTER" , "repositoryName": "MyDemoRepo" } }
-
API 세부 정보는 AWS CLI 명령 참조의 PostCommentForComparedCommit
섹션을 참조하세요.
-
다음 코드 예시에서는 post-comment-for-pull-request
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 리퀘스트에 설명 추가
다음
post-comment-for-pull-request
예시에서는 'These don't appear to be used anywhere Can we remove them?'라는 설명을MyDemoRepo
리포지토리에 있는 풀 리퀘스트의 ID가47
인ahs_count.py
파일에 대한 변경 사항에 추가합니다.aws codecommit post-comment-for-pull-request \ --pull-request-id
"47"
\ --repository-nameMyDemoRepo
\ --before-commit-id317f8570EXAMPLE
\ --after-commit-id5d036259EXAMPLE
\ --client-request-token123Example
\ --content"These don't appear to be used anywhere. Can we remove them?"
\ --locationfilePath=ahs_count.py,filePosition=367,relativeFileVersion=AFTER
출력:
{ "afterBlobId": "1f330709EXAMPLE", "afterCommitId": "5d036259EXAMPLE", "beforeBlobId": "80906a4cEXAMPLE", "beforeCommitId": "317f8570EXAMPLE", "comment": { "authorArn": "arn:aws:iam::111111111111:user/Saanvi_Sarkar", "clientRequestToken": "123Example", "commentId": "abcd1234EXAMPLEb5678efgh", "content": "These don't appear to be used anywhere. Can we remove them?", "creationDate": 1508369622.123, "deleted": false, "CommentId": "", "lastModifiedDate": 1508369622.123, "callerReactions": [], "reactionCounts": [] }, "location": { "filePath": "ahs_count.py", "filePosition": 367, "relativeFileVersion": "AFTER" }, "repositoryName": "MyDemoRepo", "pullRequestId": "47" }
-
API 세부 정보는 AWS CLI 명령 참조의 PostCommentForPullRequest
섹션을 참조하세요.
-
다음 코드 예시에서는 post-comment-reply
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋 또는 풀 리퀘스트의 설명에 답장
이 예시에서는 시스템 생성 ID가
abcd1234EXAMPLEb5678efgh
인 설명에 대한 응답"Good catch. I'll remove them."
을 추가하는 방법을 보여줍니다.aws codecommit post-comment-reply \ --in-reply-to
abcd1234EXAMPLEb5678efgh
\ --content"Good catch. I'll remove them."
\ --client-request-token123Example
출력:
{ "comment": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "123Example", "commentId": "442b498bEXAMPLE5756813", "content": "Good catch. I'll remove them.", "creationDate": 1508369829.136, "deleted": false, "CommentId": "abcd1234EXAMPLEb5678efgh", "lastModifiedDate": 150836912.221, "callerReactions": [], "reactionCounts": [] } }
-
API 세부 정보는 AWS CLI 명령 참조의 PostCommentReply
섹션을 참조하세요.
-
다음 코드 예시에서는 put-comment-reaction
의 사용 방법을 보여줍니다.
- AWS CLI
-
이모티콘으로 커밋에 대한 설명에 답글 달기
다음
put-comment-reaction
예시에서는 ID가:thumbsup:
이고 이모티콘 반응 값이abcd1234EXAMPLEb5678efgh
인 설명에 응답합니다.aws codecommit put-comment-reaction \ --comment-id
abcd1234EXAMPLEb5678efgh
\ --reaction-value:thumbsup:
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Comment on a commit in AWS CodeCommit 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 PutCommentReaction
섹션을 참조하세요.
-
다음 코드 예시에서는 put-file
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리에 파일 추가
다음
put-file
예시에서는 가장 최근 커밋의 ID가 '4c925148EXAMPLE'인 'feature-randomizationfeature'라는 브랜치에 'ExampleSolution.py'라는 파일을 'MyDemoRepo'라는 리포지토리에 추가합니다.aws codecommit put-file \ --repository-name
MyDemoRepo
\ --branch-namefeature-randomizationfeature
\ --file-contentfile://MyDirectory/ExampleSolution.py
\ --file-path/solutions/ExampleSolution.py
\ --parent-commit-id4c925148EXAMPLE
\ --name"Maria Garcia"
\ --email"maria_garcia@example.com"
\ --commit-message"I added a third randomization routine."
출력:
{ "blobId": "2eb4af3bEXAMPLE", "commitId": "317f8570EXAMPLE", "treeId": "347a3408EXAMPLE" }
-
API 세부 정보는 AWS CLI 명령 참조의 PutFile
섹션을 참조하세요.
-
다음 코드 예시에서는 put-repository-triggers
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리에서 트리거를 추가하거나 업데이트하는 방법
이 예시에서는 MyDemoRepo라는 리포지토리에 대한 모든 트리거의 구조가 포함된 이미 생성된 JSON 파일(여기서는 MyTriggers.json)을 사용하여 'MyFirstTrigger' 및 'MySecondTrigger'라는 트리거를 업데이트하는 방법을 보여줍니다. 기존 트리거에 대한 JSON을 가져오는 방법을 알아보려면 get-repository-triggers 명령을 참조하세요.
aws codecommit put-repository-triggers \ --repository-name
MyDemoRepo
file://MyTriggers.json
MyTriggers.json
의 콘텐츠:{ "repositoryName": "MyDemoRepo", "triggers": [ { "destinationArn": "arn:aws:sns:us-east-1:80398EXAMPLE:MyCodeCommitTopic", "branches": [ "main", "preprod" ], "name": "MyFirstTrigger", "customData": "", "events": [ "all" ] }, { "destinationArn": "arn:aws:lambda:us-east-1:111111111111:function:MyCodeCommitPythonFunction", "branches": [], "name": "MySecondTrigger", "customData": "EXAMPLE", "events": [ "all" ] } ] }
출력:
{ "configurationId": "6fa51cd8-35c1-EXAMPLE" }
-
API 세부 정보는 AWS CLI 명령 참조의 PutRepositoryTriggers
섹션을 참조하세요.
-
다음 코드 예시에서는 tag-resource
의 사용 방법을 보여줍니다.
- AWS CLI
-
기존 리포지토리에 AWS 태그 추가
다음
tag-resource
예시에서는 지정된 리포지토리에 두 개의 태그를 지정합니다.aws codecommit tag-resource \ --resource-arn
arn:aws:codecommit:us-west-2:111111111111:MyDemoRepo
\ --tagsStatus=Secret,Team=Saanvi
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Add a Tag to a Repository 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 TagResource
를 참조하세요.
-
다음 코드 예시에서는 test-repository-triggers
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리에서 트리거를 테스트하는 방법
이 예시에서는 MyDemoRepo라는 AWS CodeCommit 리포지토리에서 'MyFirstTrigger'라는 트리거를 테스트하는 방법을 보여줍니다. 이 예시에서는 리포지토리의 이벤트가 Amazon Simple Notification Service(Amazon SNS) 주제에서 알림을 트리거합니다.
명령:
aws codecommit test-repository-triggers --repository-name
MyDemoRepo
--triggersname=MyFirstTrigger,destinationArn=arn:aws:sns:us-east-1:111111111111:MyCodeCommitTopic,branches=mainline,preprod,events=all
출력:
{ "successfulExecutions": [ "MyFirstTrigger" ], "failedExecutions": [] }
-
API 세부 정보는 AWS CLI 명령 참조의 TestRepositoryTriggers
섹션을 참조하세요.
-
다음 코드 예시에서는 untag-resource
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리에서 AWS 태그 제거
다음
untag-resource
예시에서는MyDemoRepo
리포지토리에서 지정된 키가 있는 태그를 제거합니다.aws codecommit untag-resource \ --resource-arn
arn:aws:codecommit:us-west-2:111111111111:MyDemoRepo
\ --tag-keysStatus
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Remove a Tag from a Repository 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UntagResource
를 참조하세요.
-
다음 코드 예시에서는 update-approval-rule-template-content
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿의 내용 업데이트
다음
update-approval-rule-template-content
예시에서는 지정된 승인 규칙 템플릿의 내용을 변경하여 승인 풀을CodeCommitReview
역할을 맡는 사용자로 재정의합니다.aws codecommit update-approval-rule-template-content \ --approval-rule-template-name
1-approver-rule
\ --new-rule-content "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}"출력:
{ "approvalRuleTemplate": { "creationDate": 1571352720.773, "approvalRuleTemplateDescription": "Requires 1 approval for all pull requests from the CodeCommitReview pool", "lastModifiedDate": 1571358728.41, "approvalRuleTemplateId": "41de97b7-EXAMPLE", "approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 1,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleTemplateName": "1-approver-rule-for-all-pull-requests", "ruleContentSha256": "2f6c21a5EXAMPLE", "lastModifiedUser": "arn:aws:iam::123456789012:user/Li_Juan" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateApprovalRuleTemplateContent
섹션을 참조하세요.
-
다음 코드 예시에서는 update-approval-rule-template-description
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿의 설명 업데이트
다음
update-approval-rule-template-description
예시에서는 지정된 승인 규칙 템플릿의 설명을Requires 1 approval for all pull requests from the CodeCommitReview pool
로 변경합니다.aws codecommit update-approval-rule-template-description \ --approval-rule-template-name
1-approver-rule-for-all-pull-requests
\ --approval-rule-template-description"Requires 1 approval for all pull requests from the CodeCommitReview pool"
출력:
{ "approvalRuleTemplate": { "creationDate": 1571352720.773, "approvalRuleTemplateDescription": "Requires 1 approval for all pull requests from the CodeCommitReview pool", "lastModifiedDate": 1571358728.41, "approvalRuleTemplateId": "41de97b7-EXAMPLE", "approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 1,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleTemplateName": "1-approver-rule-for-all-pull-requests", "ruleContentSha256": "2f6c21a5EXAMPLE", "lastModifiedUser": "arn:aws:iam::123456789012:user/Li_Juan" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateApprovalRuleTemplateDescription
섹션을 참조하세요.
-
다음 코드 예시에서는 update-approval-rule-template-name
의 사용 방법을 보여줍니다.
- AWS CLI
-
승인 규칙 템플릿의 이름 업데이트
다음
update-approval-rule-template-name
예시에서는 승인 규칙 템플릿의 이름을1-approver-rule
에서 1-approvers-rule-for-all-pull-requests`로 변경합니다.aws codecommit update-approval-rule-template-name \ --old-approval-rule-template-name
1-approver-rule
\ --new-approval-rule-template-name1-approver-rule-for-all-pull-requests
출력:
{ "approvalRuleTemplate": { "approvalRuleTemplateName": "1-approver-rule-for-all-pull-requests", "lastModifiedDate": 1571358241.619, "approvalRuleTemplateId": "41de97b7-EXAMPLE", "approvalRuleTemplateContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 1,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "creationDate": 1571352720.773, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "approvalRuleTemplateDescription": "All pull requests must be approved by one developer on the team.", "ruleContentSha256": "2f6c21a5cEXAMPLE" } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Manage Approval Rule Templates 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateApprovalRuleTemplateName
섹션을 참조하세요.
-
다음 코드 예시에서는 update-comment
의 사용 방법을 보여줍니다.
- AWS CLI
-
커밋에 대한 설명 업데이트
이 예시에서는 ID가
442b498bEXAMPLE5756813
인 설명에"Fixed as requested. I'll update the pull request."
콘텐츠를 추가하는 방법을 보여줍니다.aws codecommit update-comment \ --comment-id
442b498bEXAMPLE5756813
\ --content"Fixed as requested. I'll update the pull request."
출력:
{ "comment": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "commentId": "442b498bEXAMPLE5756813", "content": "Fixed as requested. I'll update the pull request.", "creationDate": 1508369929.783, "deleted": false, "lastModifiedDate": 1508369929.287, "callerReactions": [], "reactionCounts": { "THUMBSUP" : 2 } } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateComment
섹션을 참조하세요.
-
다음 코드 예시에서는 update-default-branch
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 기본 브랜치 변경
이 예시에서는 AWS CodeCommit 리포지토리의 기본 브랜치를 변경합니다. 이 명령은 오류가 있는 경우에만 출력을 생성합니다.
명령:
aws codecommit update-default-branch --repository-name
MyDemoRepo
--default-branch-nameMyNewBranch
출력:
None.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateDefaultBranch
섹션을 참조하세요.
-
다음 코드 예시에서는 update-pull-request-approval-rule-content
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 규칙 편집
다음
update-pull-request-approval-rule-content
예시에서는123456789012
AWS 계정의 모든 IAM 사용자를 포함하는 승인 풀에서 한 명의 사용자 승인을 요구하도록 승인 규칙을 지정하여 업데이트합니다.aws codecommit update-pull-request-approval-rule-content \ --pull-request-id
27
\ --approval-rule-name"Require two approved approvers"
\ --approval-rule-content "{Version: 2018-11-08, Statements: [{Type: \"Approvers\", NumberOfApprovalsNeeded: 1, ApprovalPoolMembers:[\"CodeCommitApprovers:123456789012:user/*\"]}]}}"출력:
{ "approvalRule": { "approvalRuleContent": "{Version: 2018-11-08, Statements: [{Type: \"Approvers\", NumberOfApprovalsNeeded: 1, ApprovalPoolMembers:[\"CodeCommitApprovers:123456789012:user/*\"]}]}}", "approvalRuleId": "aac33506-EXAMPLE", "originApprovalRuleTemplate": {}, "creationDate": 1570752871.932, "lastModifiedDate": 1570754058.333, "approvalRuleName": Require two approved approvers", "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "ruleContentSha256": "cd93921cEXAMPLE", } }
자세한 내용은 AWS CodeCommit 사용 설명서의 Edit or Delete an Approval Rule 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePullRequestApprovalRuleContent
섹션을 참조하세요.
-
다음 코드 예시에서는 update-pull-request-approval-state
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 승인 또는 승인 취소
다음
update-pull-request-approval-state
ID가27
이고 개정 ID가9f29d167EXAMPLE
인 풀 리퀘스트를 승인합니다. 대신 승인을 취소하려면--approval-state
파라미터 값을REVOKE
로 설정합니다.aws codecommit update-pull-request-approval-state \ --pull-request-id
27
\ --revision-id9f29d167EXAMPLE
\ --approval-state"APPROVE"
이 명령은 출력을 생성하지 않습니다.
자세한 내용은 AWS CodeCommit 사용 설명서의 Review a Pull Request 섹션을 참조하세요.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePullRequestApprovalState
섹션을 참조하세요.
-
다음 코드 예시에서는 update-pull-request-description
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청에 대한 설명을 변경하는 방법
이 예시에서는 ID가
47
인 풀 리퀘스트에 대한 설명을 변경하는 방법을 보여줍니다.aws codecommit update-pull-request-description \ --pull-request-id
47
\ --description"Updated the pull request to remove unused global variable."
출력:
{ "pullRequest": { "authorArn": "arn:aws:iam::111111111111:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.155, "description": "Updated the pull request to remove unused global variable.", "lastActivityDate": 1508372423.204, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePullRequestDescription
섹션을 참조하세요.
-
다음 코드 예시에서는 update-pull-request-status
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청의 상태 변경
이 예시에서는
MyDemoRepo
라는 이름의 AWS CodeCommit 리포지토리에서 ID가42
인 풀 리퀘스트의 상태를CLOSED
로 변경하는 방법을 보여줍니다.aws codecommit update-pull-request-status \ --pull-request-id
42
\ --pull-request-statusCLOSED
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approvers-needed-for-this-change", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.165, "description": "Updated the pull request to remove unused global variable.", "lastActivityDate": 1508372423.12, "pullRequestId": "47", "pullRequestStatus": "CLOSED", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables" } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePullRequestStatus
섹션을 참조하세요.
-
다음 코드 예시에서는 update-pull-request-title
의 사용 방법을 보여줍니다.
- AWS CLI
-
풀 요청의 제목을 변경하는 방법
이 예시에서는 ID가
47
인 풀 리퀘스트의 제목을 변경하는 방법을 보여줍니다.aws codecommit update-pull-request-title \ --pull-request-id
47
\ --title"Consolidation of global variables - updated review"
출력:
{ "pullRequest": { "approvalRules": [ { "approvalRuleContent": "{\"Version\": \"2018-11-08\",\"DestinationReferences\": [\"refs/heads/main\"],\"Statements\": [{\"Type\": \"Approvers\",\"NumberOfApprovalsNeeded\": 2,\"ApprovalPoolMembers\": [\"arn:aws:sts::123456789012:assumed-role/CodeCommitReview/*\"]}]}", "approvalRuleId": "dd8b17fe-EXAMPLE", "approvalRuleName": "2-approver-rule-for-main", "creationDate": 1571356106.936, "lastModifiedDate": 571356106.936, "lastModifiedUser": "arn:aws:iam::123456789012:user/Mary_Major", "originApprovalRuleTemplate": { "approvalRuleTemplateId": "dd8b26gr-EXAMPLE", "approvalRuleTemplateName": "2-approver-rule-for-main" }, "ruleContentSha256": "4711b576EXAMPLE" } ], "authorArn": "arn:aws:iam::123456789012:user/Li_Juan", "clientRequestToken": "", "creationDate": 1508530823.12, "description": "Review the latest changes and updates to the global variables. I have updated this request with some changes, including removing some unused variables.", "lastActivityDate": 1508372657.188, "pullRequestId": "47", "pullRequestStatus": "OPEN", "pullRequestTargets": [ { "destinationCommit": "9f31c968EXAMPLE", "destinationReference": "refs/heads/main", "mergeMetadata": { "isMerged": false, }, "repositoryName": "MyDemoRepo", "sourceCommit": "99132ab0EXAMPLE", "sourceReference": "refs/heads/variables-branch" } ], "title": "Consolidation of global variables - updated review" } }
-
API 세부 정보는 AWS CLI 명령 참조의 UpdatePullRequestTitle
섹션을 참조하세요.
-
다음 코드 예시에서는 update-repository-description
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 설명 변경
이 예시에서는 AWS CodeCommit 리포지토리에 대한 설명을 변경합니다. 이 명령은 오류가 있는 경우에만 출력을 생성합니다.
명령:
aws codecommit update-repository-description --repository-name
MyDemoRepo
--repository-description"This description was changed"
출력:
None.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateDocumentDefaultVersion
섹션을 참조하세요.
-
다음 코드 예시에서는 update-repository-name
의 사용 방법을 보여줍니다.
- AWS CLI
-
리포지토리의 이름 변경
이 예시에서는 AWS CodeCommit 리포지토리의 이름을 변경합니다. 이 명령은 오류가 있는 경우에만 출력을 생성합니다. AWS CodeCommit 리포지토리의 이름을 변경하면 사용자가 리포지토리에 연결하는 데 필요한 SSH 및 HTTPS URL이 변경됩니다. 사용자는 연결 설정을 업데이트할 때까지 이 리포지토리에 연결할 수 없습니다. 또한 리포지토리의 ARN이 변경되므로, 리포지토리 이름을 변경하면 이 리포지토리의 ARN을 사용하는 모든 IAM 사용자 정책이 무효화됩니다.
명령:
aws codecommit update-repository-name --old-name
MyDemoRepo
--new-nameMyRenamedDemoRepo
출력:
None.
-
API 세부 정보는 AWS CLI 명령 참조의 UpdateRepositoryName
섹션을 참조하세요.
-