Skip to content

Commit

Permalink
Merge pull request #41 from moosetechnology/feat/import-analyses-from-s3
Browse files Browse the repository at this point in the history
feat: import analyses from s3
  • Loading branch information
alkalinan authored Aug 22, 2024
2 parents 01ca1f4 + 0091990 commit 7d0029a
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 1 deletion.
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ In the Moose image, in a playground (`Ctrl+O`, `Ctrl+W`), perform:
Metacello new
repository: 'github://moosetechnology/GitProjectHealth:main/src';
baseline: 'GitLabHealth';
onConflict: [ :ex | ex useIncoming ];
onConflict: [ :ex | ex useLoaded ];
onUpgrade: [ :ex | ex useIncoming ];
onDowngrade: [ :ex | ex useLoaded ];
load
Expand Down
24 changes: 24 additions & 0 deletions src/GitLabHealth-Model-Analysis/GitMetricExporter.class.st
Original file line number Diff line number Diff line change
Expand Up @@ -359,6 +359,30 @@ GitMetricExporter >> glhImporter: anImporter [
glhImporter := anImporter withInitialCommits: false; yourself.
]

{ #category : #adding }
GitMetricExporter >> importAnalysesFromS3: bucketName accessKey: accessKey secretKey: secretKey region: region [

| s3 bucket xmlObjects contentElements filesContent |
AWSS3Config default
accessKeyId: accessKey;
secretKey: secretKey;
regionName: region.

s3 := AWSS3 new.
bucket := s3 bucketNamed: bucketName.
xmlObjects := bucket listObjects.
contentElements := xmlObjects root elementsSelect: [ :element |
element isNamed: 'Contents' ].

filesContent := contentElements collect: [ :contentElement |
| keyValue |
keyValue := contentElement contentStringAt: 'Key'.
bucket getObject: keyValue ].

^ analyses := (filesContent collect: [ :file | STON fromString: file ])
flattened
]

{ #category : #initialization }
GitMetricExporter >> initialize [

Expand Down

0 comments on commit 7d0029a

Please sign in to comment.